/* MapModel.c generated by valac 0.56.19, the Vala compiler
 * generated from MapModel.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 <gtk/gtk.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <libxml/tree.h>
#include <float.h>
#include <math.h>
#include <gtk/gtkimmodule.h>
#include <cairo-gobject.h>
#include <glib/gi18n-lib.h>
#include <libxml/parser.h>
#include <gdk-pixbuf/gdk-pixbuf.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  {
	MAP_ITEM_COMPONENT_NONE,
	MAP_ITEM_COMPONENT_CURVE,
	MAP_ITEM_COMPONENT_TITLE_BOX,
	MAP_ITEM_COMPONENT_TITLE,
	MAP_ITEM_COMPONENT_NOTE,
	MAP_ITEM_COMPONENT_DRAG_HANDLE,
	MAP_ITEM_COMPONENT_FROM_HANDLE,
	MAP_ITEM_COMPONENT_TO_HANDLE,
	MAP_ITEM_COMPONENT_STICKER,
	MAP_ITEM_COMPONENT_NODE_LINK,
	MAP_ITEM_COMPONENT_IMAGE,
	MAP_ITEM_COMPONENT_LINK,
	MAP_ITEM_COMPONENT_TASK,
	MAP_ITEM_COMPONENT_FOLD,
	MAP_ITEM_COMPONENT_RESIZER,
	MAP_ITEM_COMPONENT_TAGS
} MapItemComponent;

#define TYPE_MAP_ITEM_COMPONENT (map_item_component_get_type ())

#define TYPE_MAP_MODEL (map_model_get_type ())
#define MAP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_MODEL, MapModel))
#define MAP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_MODEL, MapModelClass))
#define IS_MAP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_MODEL))
#define IS_MAP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_MODEL))
#define MAP_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_MODEL, MapModelClass))

typedef struct _MapModel MapModel;
typedef struct _MapModelClass MapModelClass;
typedef struct _MapModelPrivate MapModelPrivate;

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

#define TYPE_CONNECTIONS (connections_get_type ())
#define CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONNECTIONS, Connections))
#define CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONNECTIONS, ConnectionsClass))
#define IS_CONNECTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONNECTIONS))
#define IS_CONNECTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONNECTIONS))
#define CONNECTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONNECTIONS, ConnectionsClass))

typedef struct _Connections Connections;
typedef struct _ConnectionsClass ConnectionsClass;

#define TYPE_STICKERS (stickers_get_type ())
#define STICKERS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STICKERS, Stickers))
#define STICKERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_STICKERS, StickersClass))
#define IS_STICKERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STICKERS))
#define IS_STICKERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_STICKERS))
#define STICKERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_STICKERS, StickersClass))

typedef struct _Stickers Stickers;
typedef struct _StickersClass StickersClass;

#define TYPE_THEME (theme_get_type ())
#define THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME, Theme))
#define THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME, ThemeClass))
#define IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME))
#define IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME))
#define THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME, ThemeClass))

typedef struct _Theme Theme;
typedef struct _ThemeClass ThemeClass;

#define TYPE_SUMMARY_NODE (summary_node_get_type ())
#define SUMMARY_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SUMMARY_NODE, SummaryNode))
#define SUMMARY_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SUMMARY_NODE, SummaryNodeClass))
#define IS_SUMMARY_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SUMMARY_NODE))
#define IS_SUMMARY_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SUMMARY_NODE))
#define SUMMARY_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SUMMARY_NODE, SummaryNodeClass))

typedef struct _SummaryNode SummaryNode;
typedef struct _SummaryNodeClass SummaryNodeClass;

#define TYPE_CONNECTION (connection_get_type ())
#define CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CONNECTION, Connection))
#define CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CONNECTION, ConnectionClass))
#define IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CONNECTION))
#define IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CONNECTION))
#define CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CONNECTION, ConnectionClass))

typedef struct _Connection Connection;
typedef struct _ConnectionClass ConnectionClass;

#define TYPE_STICKER (sticker_get_type ())
#define STICKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STICKER, Sticker))
#define STICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_STICKER, StickerClass))
#define IS_STICKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STICKER))
#define IS_STICKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_STICKER))
#define STICKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_STICKER, StickerClass))

typedef struct _Sticker Sticker;
typedef struct _StickerClass StickerClass;

#define TYPE_NODE_GROUPS (node_groups_get_type ())
#define NODE_GROUPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_GROUPS, NodeGroups))
#define NODE_GROUPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_GROUPS, NodeGroupsClass))
#define IS_NODE_GROUPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_GROUPS))
#define IS_NODE_GROUPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_GROUPS))
#define NODE_GROUPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_GROUPS, NodeGroupsClass))

typedef struct _NodeGroups NodeGroups;
typedef struct _NodeGroupsClass NodeGroupsClass;

#define TYPE_NODE_LINKS (node_links_get_type ())
#define NODE_LINKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_LINKS, NodeLinks))
#define NODE_LINKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_LINKS, NodeLinksClass))
#define IS_NODE_LINKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_LINKS))
#define IS_NODE_LINKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_LINKS))
#define NODE_LINKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_LINKS, NodeLinksClass))

typedef struct _NodeLinks NodeLinks;
typedef struct _NodeLinksClass NodeLinksClass;

#define TYPE_TAGS (tags_get_type ())
#define TAGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAGS, Tags))
#define TAGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAGS, TagsClass))
#define IS_TAGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAGS))
#define IS_TAGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAGS))
#define TAGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAGS, TagsClass))

typedef struct _Tags Tags;
typedef struct _TagsClass TagsClass;

#define TYPE_LAYOUTS (layouts_get_type ())
#define LAYOUTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LAYOUTS, Layouts))
#define LAYOUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LAYOUTS, LayoutsClass))
#define IS_LAYOUTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LAYOUTS))
#define IS_LAYOUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LAYOUTS))
#define LAYOUTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LAYOUTS, LayoutsClass))

typedef struct _Layouts Layouts;
typedef struct _LayoutsClass LayoutsClass;

#define TYPE_IMAGE_MANAGER (image_manager_get_type ())
#define IMAGE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IMAGE_MANAGER, ImageManager))
#define IMAGE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IMAGE_MANAGER, ImageManagerClass))
#define IS_IMAGE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IMAGE_MANAGER))
#define IS_IMAGE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IMAGE_MANAGER))
#define IMAGE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IMAGE_MANAGER, ImageManagerClass))

typedef struct _ImageManager ImageManager;
typedef struct _ImageManagerClass ImageManagerClass;
#define _mind_map_unref0(var) ((var == NULL) ? NULL : (var = (mind_map_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_array_unref0(var) ((var == NULL) ? NULL : (var = (g_array_unref (var), NULL)))
#define _connections_unref0(var) ((var == NULL) ? NULL : (var = (connections_unref (var), NULL)))
#define _stickers_unref0(var) ((var == NULL) ? NULL : (var = (stickers_unref (var), NULL)))
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
#define _node_groups_unref0(var) ((var == NULL) ? NULL : (var = (node_groups_unref (var), NULL)))
#define _node_links_unref0(var) ((var == NULL) ? NULL : (var = (node_links_unref (var), NULL)))
#define _tags_unref0(var) ((var == NULL) ? NULL : (var = (tags_unref (var), NULL)))
#define _image_manager_unref0(var) ((var == NULL) ? NULL : (var = (image_manager_unref (var), NULL)))

#define TYPE_MAIN_WINDOW (main_window_get_type ())
#define MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN_WINDOW, MainWindow))
#define MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN_WINDOW, MainWindowClass))
#define IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN_WINDOW))
#define IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN_WINDOW))
#define MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN_WINDOW, MainWindowClass))

typedef struct _MainWindow MainWindow;
typedef struct _MainWindowClass MainWindowClass;

#define TYPE_THEMES (themes_get_type ())
#define THEMES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEMES, Themes))
#define THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEMES, ThemesClass))
#define IS_THEMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEMES))
#define IS_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEMES))
#define THEMES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEMES, ThemesClass))

typedef struct _Themes Themes;
typedef struct _ThemesClass ThemesClass;

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

#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_NODE_LAYOUT (undo_node_layout_get_type ())
#define UNDO_NODE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_LAYOUT, UndoNodeLayout))
#define UNDO_NODE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_LAYOUT, UndoNodeLayoutClass))
#define IS_UNDO_NODE_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_LAYOUT))
#define IS_UNDO_NODE_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_LAYOUT))
#define UNDO_NODE_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_LAYOUT, UndoNodeLayoutClass))

typedef struct _UndoNodeLayout UndoNodeLayout;
typedef struct _UndoNodeLayoutClass UndoNodeLayoutClass;

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

#define TYPE_STYLE (style_get_type ())
#define STYLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STYLE, Style))
#define STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_STYLE, StyleClass))
#define IS_STYLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STYLE))
#define IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_STYLE))
#define STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_STYLE, StyleClass))

typedef struct _Style Style;
typedef struct _StyleClass StyleClass;

#define TYPE_STYLES (styles_get_type ())
#define STYLES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STYLES, Styles))
#define STYLES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_STYLES, StylesClass))
#define IS_STYLES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STYLES))
#define IS_STYLES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_STYLES))
#define STYLES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_STYLES, StylesClass))

typedef struct _Styles Styles;
typedef struct _StylesClass StylesClass;
#define _style_unref0(var) ((var == NULL) ? NULL : (var = (style_unref (var), NULL)))

#define TYPE_NODE_GROUP (node_group_get_type ())
#define NODE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_GROUP, NodeGroup))
#define NODE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_GROUP, NodeGroupClass))
#define IS_NODE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_GROUP))
#define IS_NODE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_GROUP))
#define NODE_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_GROUP, NodeGroupClass))

typedef struct _NodeGroup NodeGroup;
typedef struct _NodeGroupClass NodeGroupClass;

#define TYPE_NODE_BOUNDS (node_bounds_get_type ())
#define NODE_BOUNDS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_BOUNDS, NodeBounds))
#define NODE_BOUNDS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_BOUNDS, NodeBoundsClass))
#define IS_NODE_BOUNDS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_BOUNDS))
#define IS_NODE_BOUNDS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_BOUNDS))
#define NODE_BOUNDS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_BOUNDS, NodeBoundsClass))

typedef struct _NodeBounds NodeBounds;
typedef struct _NodeBoundsClass NodeBoundsClass;
#define _node_bounds_unref0(var) ((var == NULL) ? NULL : (var = (node_bounds_unref (var), NULL)))
typedef enum  {
	SEARCH_OPTIONS_NODES,
	SEARCH_OPTIONS_CONNECTIONS,
	SEARCH_OPTIONS_CALLOUTS,
	SEARCH_OPTIONS_GROUPS,
	SEARCH_OPTIONS_TITLES,
	SEARCH_OPTIONS_NOTES,
	SEARCH_OPTIONS_FOLDED,
	SEARCH_OPTIONS_UNFOLDED,
	SEARCH_OPTIONS_TASKS,
	SEARCH_OPTIONS_NONTASKS,
	SEARCH_OPTIONS_NUM
} SearchOptions;

#define TYPE_SEARCH_OPTIONS (search_options_get_type ())
typedef enum  {
	NODE_MODE_NONE = 0,
	NODE_MODE_CURRENT,
	NODE_MODE_SELECTED,
	NODE_MODE_EDITABLE,
	NODE_MODE_ATTACHABLE,
	NODE_MODE_DROPPABLE,
	NODE_MODE_HIGHLIGHTED
} NodeMode;

#define TYPE_NODE_MODE (node_mode_get_type ())

#define TYPE_DRAW_AREA (draw_area_get_type ())
#define DRAW_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DRAW_AREA, DrawArea))
#define DRAW_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DRAW_AREA, DrawAreaClass))
#define IS_DRAW_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DRAW_AREA))
#define IS_DRAW_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DRAW_AREA))
#define DRAW_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DRAW_AREA, DrawAreaClass))

typedef struct _DrawArea DrawArea;
typedef struct _DrawAreaClass DrawAreaClass;

#define TYPE_CANVAS_TEXT (canvas_text_get_type ())
#define CANVAS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CANVAS_TEXT, CanvasText))
#define CANVAS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CANVAS_TEXT, CanvasTextClass))
#define IS_CANVAS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CANVAS_TEXT))
#define IS_CANVAS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CANVAS_TEXT))
#define CANVAS_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CANVAS_TEXT, CanvasTextClass))

typedef struct _CanvasText CanvasText;
typedef struct _CanvasTextClass CanvasTextClass;

#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_TEXT_BUFFER (undo_text_buffer_get_type ())
#define UNDO_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_TEXT_BUFFER, UndoTextBuffer))
#define UNDO_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_TEXT_BUFFER, UndoTextBufferClass))
#define IS_UNDO_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_TEXT_BUFFER))
#define IS_UNDO_TEXT_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_TEXT_BUFFER))
#define UNDO_TEXT_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_TEXT_BUFFER, UndoTextBufferClass))

typedef struct _UndoTextBuffer UndoTextBuffer;
typedef struct _UndoTextBufferClass UndoTextBufferClass;

#define TYPE_UNDO_NODE_NAME (undo_node_name_get_type ())
#define UNDO_NODE_NAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_NAME, UndoNodeName))
#define UNDO_NODE_NAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_NAME, UndoNodeNameClass))
#define IS_UNDO_NODE_NAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_NAME))
#define IS_UNDO_NODE_NAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_NAME))
#define UNDO_NODE_NAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_NAME, UndoNodeNameClass))

typedef struct _UndoNodeName UndoNodeName;
typedef struct _UndoNodeNameClass UndoNodeNameClass;
typedef enum  {
	CONN_MODE_NONE = 0,
	CONN_MODE_LINKING,
	CONN_MODE_CONNECTING,
	CONN_MODE_SELECTED,
	CONN_MODE_ADJUSTING,
	CONN_MODE_EDITABLE,
	CONN_MODE_DROPPABLE
} ConnMode;

#define TYPE_CONN_MODE (conn_mode_get_type ())

#define TYPE_UNDO_CONNECTION_TITLE (undo_connection_title_get_type ())
#define UNDO_CONNECTION_TITLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTION_TITLE, UndoConnectionTitle))
#define UNDO_CONNECTION_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTION_TITLE, UndoConnectionTitleClass))
#define IS_UNDO_CONNECTION_TITLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTION_TITLE))
#define IS_UNDO_CONNECTION_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTION_TITLE))
#define UNDO_CONNECTION_TITLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTION_TITLE, UndoConnectionTitleClass))

typedef struct _UndoConnectionTitle UndoConnectionTitle;
typedef struct _UndoConnectionTitleClass UndoConnectionTitleClass;

#define TYPE_CALLOUT (callout_get_type ())
#define CALLOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CALLOUT, Callout))
#define CALLOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CALLOUT, CalloutClass))
#define IS_CALLOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CALLOUT))
#define IS_CALLOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CALLOUT))
#define CALLOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CALLOUT, CalloutClass))

typedef struct _Callout Callout;
typedef struct _CalloutClass CalloutClass;
typedef enum  {
	CALLOUT_MODE_NONE = 0,
	CALLOUT_MODE_SELECTED,
	CALLOUT_MODE_EDITABLE,
	CALLOUT_MODE_HIDING,
	CALLOUT_MODE_HIDDEN
} CalloutMode;

#define TYPE_CALLOUT_MODE (callout_mode_get_type ())

#define TYPE_UNDO_CALLOUT_TEXT (undo_callout_text_get_type ())
#define UNDO_CALLOUT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CALLOUT_TEXT, UndoCalloutText))
#define UNDO_CALLOUT_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CALLOUT_TEXT, UndoCalloutTextClass))
#define IS_UNDO_CALLOUT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CALLOUT_TEXT))
#define IS_UNDO_CALLOUT_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CALLOUT_TEXT))
#define UNDO_CALLOUT_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CALLOUT_TEXT, UndoCalloutTextClass))

typedef struct _UndoCalloutText UndoCalloutText;
typedef struct _UndoCalloutTextClass UndoCalloutTextClass;

#define TYPE_NODE_TASK_INFO (node_task_info_get_type ())
typedef struct _NodeTaskInfo NodeTaskInfo;

#define TYPE_UNDO_NODE_TASKS (undo_node_tasks_get_type ())
#define UNDO_NODE_TASKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_TASKS, UndoNodeTasks))
#define UNDO_NODE_TASKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_TASKS, UndoNodeTasksClass))
#define IS_UNDO_NODE_TASKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_TASKS))
#define IS_UNDO_NODE_TASKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_TASKS))
#define UNDO_NODE_TASKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_TASKS, UndoNodeTasksClass))

typedef struct _UndoNodeTasks UndoNodeTasks;
typedef struct _UndoNodeTasksClass UndoNodeTasksClass;

#define TYPE_SELECTION (selection_get_type ())
#define SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SELECTION, Selection))
#define SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SELECTION, SelectionClass))
#define IS_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SELECTION))
#define IS_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SELECTION))
#define SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SELECTION, SelectionClass))

typedef struct _Selection Selection;
typedef struct _SelectionClass SelectionClass;

#define TYPE_UNDO_NODE_FOLDS (undo_node_folds_get_type ())
#define UNDO_NODE_FOLDS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_FOLDS, UndoNodeFolds))
#define UNDO_NODE_FOLDS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_FOLDS, UndoNodeFoldsClass))
#define IS_UNDO_NODE_FOLDS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_FOLDS))
#define IS_UNDO_NODE_FOLDS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_FOLDS))
#define UNDO_NODE_FOLDS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_FOLDS, UndoNodeFoldsClass))

typedef struct _UndoNodeFolds UndoNodeFolds;
typedef struct _UndoNodeFoldsClass UndoNodeFoldsClass;

#define TYPE_TAG (tag_get_type ())
#define TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TAG, Tag))
#define TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TAG, TagClass))
#define IS_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TAG))
#define IS_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TAG))
#define TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TAG, TagClass))

typedef struct _Tag Tag;
typedef struct _TagClass TagClass;
typedef enum  {
	TAG_COMBO_TYPE_AND,
	TAG_COMBO_TYPE_OR,
	TAG_COMBO_TYPE_NONE,
	TAG_COMBO_TYPE_NUM
} TagComboType;

#define TYPE_TAG_COMBO_TYPE (tag_combo_type_get_type ())

#define TYPE_UNDO_GROUPS_MERGE (undo_groups_merge_get_type ())
#define UNDO_GROUPS_MERGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_GROUPS_MERGE, UndoGroupsMerge))
#define UNDO_GROUPS_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_GROUPS_MERGE, UndoGroupsMergeClass))
#define IS_UNDO_GROUPS_MERGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_GROUPS_MERGE))
#define IS_UNDO_GROUPS_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_GROUPS_MERGE))
#define UNDO_GROUPS_MERGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_GROUPS_MERGE, UndoGroupsMergeClass))

typedef struct _UndoGroupsMerge UndoGroupsMerge;
typedef struct _UndoGroupsMergeClass UndoGroupsMergeClass;

#define TYPE_UNDO_GROUP_ADD (undo_group_add_get_type ())
#define UNDO_GROUP_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_GROUP_ADD, UndoGroupAdd))
#define UNDO_GROUP_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_GROUP_ADD, UndoGroupAddClass))
#define IS_UNDO_GROUP_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_GROUP_ADD))
#define IS_UNDO_GROUP_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_GROUP_ADD))
#define UNDO_GROUP_ADD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_GROUP_ADD, UndoGroupAddClass))

typedef struct _UndoGroupAdd UndoGroupAdd;
typedef struct _UndoGroupAddClass UndoGroupAddClass;

#define TYPE_UNDO_GROUPS_REMOVE (undo_groups_remove_get_type ())
#define UNDO_GROUPS_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_GROUPS_REMOVE, UndoGroupsRemove))
#define UNDO_GROUPS_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_GROUPS_REMOVE, UndoGroupsRemoveClass))
#define IS_UNDO_GROUPS_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_GROUPS_REMOVE))
#define IS_UNDO_GROUPS_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_GROUPS_REMOVE))
#define UNDO_GROUPS_REMOVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_GROUPS_REMOVE, UndoGroupsRemoveClass))

typedef struct _UndoGroupsRemove UndoGroupsRemove;
typedef struct _UndoGroupsRemoveClass UndoGroupsRemoveClass;

#define TYPE_UNDO_GROUPS_COLOR (undo_groups_color_get_type ())
#define UNDO_GROUPS_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_GROUPS_COLOR, UndoGroupsColor))
#define UNDO_GROUPS_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_GROUPS_COLOR, UndoGroupsColorClass))
#define IS_UNDO_GROUPS_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_GROUPS_COLOR))
#define IS_UNDO_GROUPS_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_GROUPS_COLOR))
#define UNDO_GROUPS_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_GROUPS_COLOR, UndoGroupsColorClass))

typedef struct _UndoGroupsColor UndoGroupsColor;
typedef struct _UndoGroupsColorClass UndoGroupsColorClass;

#define TYPE_UNDO_NODE_CALLOUT (undo_node_callout_get_type ())
#define UNDO_NODE_CALLOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_CALLOUT, UndoNodeCallout))
#define UNDO_NODE_CALLOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_CALLOUT, UndoNodeCalloutClass))
#define IS_UNDO_NODE_CALLOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_CALLOUT))
#define IS_UNDO_NODE_CALLOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_CALLOUT))
#define UNDO_NODE_CALLOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_CALLOUT, UndoNodeCalloutClass))

typedef struct _UndoNodeCallout UndoNodeCallout;
typedef struct _UndoNodeCalloutClass UndoNodeCalloutClass;

#define TYPE_FORMATTED_TEXT (formatted_text_get_type ())
#define FORMATTED_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORMATTED_TEXT, FormattedText))
#define FORMATTED_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORMATTED_TEXT, FormattedTextClass))
#define IS_FORMATTED_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORMATTED_TEXT))
#define IS_FORMATTED_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORMATTED_TEXT))
#define FORMATTED_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORMATTED_TEXT, FormattedTextClass))

typedef struct _FormattedText FormattedText;
typedef struct _FormattedTextClass FormattedTextClass;

#define TYPE_NODE_LINK (node_link_get_type ())
#define NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_LINK, NodeLink))
#define NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_LINK, NodeLinkClass))
#define IS_NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_LINK))
#define IS_NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_LINK))
#define NODE_LINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_LINK, NodeLinkClass))

typedef struct _NodeLink NodeLink;
typedef struct _NodeLinkClass NodeLinkClass;
#define _node_link_unref0(var) ((var == NULL) ? NULL : (var = (node_link_unref (var), NULL)))
typedef enum  {
	FORMAT_TAG_BOLD = 0,
	FORMAT_TAG_ITALICS,
	FORMAT_TAG_UNDERLINE,
	FORMAT_TAG_STRIKETHRU,
	FORMAT_TAG_CODE,
	FORMAT_TAG_SUB,
	FORMAT_TAG_SUPER,
	FORMAT_TAG_HEADER,
	FORMAT_TAG_COLOR,
	FORMAT_TAG_HILITE,
	FORMAT_TAG_URL,
	FORMAT_TAG_SYNTAX,
	FORMAT_TAG_TAG,
	FORMAT_TAG_MATCH,
	FORMAT_TAG_SELECT,
	FORMAT_TAG_LENGTH
} FormatTag;

#define TYPE_FORMAT_TAG (format_tag_get_type ())

#define TYPE_NODE_IMAGE (node_image_get_type ())
#define NODE_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NODE_IMAGE, NodeImage))
#define NODE_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NODE_IMAGE, NodeImageClass))
#define IS_NODE_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NODE_IMAGE))
#define IS_NODE_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NODE_IMAGE))
#define NODE_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NODE_IMAGE, NodeImageClass))

typedef struct _NodeImage NodeImage;
typedef struct _NodeImageClass NodeImageClass;
typedef void (*ImageIdFunc) (gint id, gpointer user_data);
#define _node_image_unref0(var) ((var == NULL) ? NULL : (var = (node_image_unref (var), NULL)))

#define TYPE_UNDO_NODE_IMAGE (undo_node_image_get_type ())
#define UNDO_NODE_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_IMAGE, UndoNodeImage))
#define UNDO_NODE_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_IMAGE, UndoNodeImageClass))
#define IS_UNDO_NODE_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_IMAGE))
#define IS_UNDO_NODE_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_IMAGE))
#define UNDO_NODE_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_IMAGE, UndoNodeImageClass))

typedef struct _UndoNodeImage UndoNodeImage;
typedef struct _UndoNodeImageClass UndoNodeImageClass;

#define TYPE_IMAGE_EDITOR (image_editor_get_type ())
#define IMAGE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IMAGE_EDITOR, ImageEditor))
#define IMAGE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IMAGE_EDITOR, ImageEditorClass))
#define IS_IMAGE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IMAGE_EDITOR))
#define IS_IMAGE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IMAGE_EDITOR))
#define IMAGE_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IMAGE_EDITOR, ImageEditorClass))

typedef struct _ImageEditor ImageEditor;
typedef struct _ImageEditorClass ImageEditorClass;

#define TYPE_UNDO_NODE_LINK (undo_node_link_get_type ())
#define UNDO_NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_LINK, UndoNodeLink))
#define UNDO_NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_LINK, UndoNodeLinkClass))
#define IS_UNDO_NODE_LINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_LINK))
#define IS_UNDO_NODE_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_LINK))
#define UNDO_NODE_LINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_LINK, UndoNodeLinkClass))

typedef struct _UndoNodeLink UndoNodeLink;
typedef struct _UndoNodeLinkClass UndoNodeLinkClass;

#define TYPE_UNDO_NODES_LINK (undo_nodes_link_get_type ())
#define UNDO_NODES_LINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_LINK, UndoNodesLink))
#define UNDO_NODES_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_LINK, UndoNodesLinkClass))
#define IS_UNDO_NODES_LINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_LINK))
#define IS_UNDO_NODES_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_LINK))
#define UNDO_NODES_LINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_LINK, UndoNodesLinkClass))

typedef struct _UndoNodesLink UndoNodesLink;
typedef struct _UndoNodesLinkClass UndoNodesLinkClass;

#define TYPE_UNDO_NODE_LINK_COLOR (undo_node_link_color_get_type ())
#define UNDO_NODE_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_LINK_COLOR, UndoNodeLinkColor))
#define UNDO_NODE_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_LINK_COLOR, UndoNodeLinkColorClass))
#define IS_UNDO_NODE_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_LINK_COLOR))
#define IS_UNDO_NODE_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_LINK_COLOR))
#define UNDO_NODE_LINK_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_LINK_COLOR, UndoNodeLinkColorClass))

typedef struct _UndoNodeLinkColor UndoNodeLinkColor;
typedef struct _UndoNodeLinkColorClass UndoNodeLinkColorClass;
#define __vala_GdkRGBA_free0(var) ((var == NULL) ? NULL : (var = (_vala_GdkRGBA_free (var), NULL)))

#define TYPE_UNDO_NODES_LINK_COLOR (undo_nodes_link_color_get_type ())
#define UNDO_NODES_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_LINK_COLOR, UndoNodesLinkColor))
#define UNDO_NODES_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_LINK_COLOR, UndoNodesLinkColorClass))
#define IS_UNDO_NODES_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_LINK_COLOR))
#define IS_UNDO_NODES_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_LINK_COLOR))
#define UNDO_NODES_LINK_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_LINK_COLOR, UndoNodesLinkColorClass))

typedef struct _UndoNodesLinkColor UndoNodesLinkColor;
typedef struct _UndoNodesLinkColorClass UndoNodesLinkColorClass;

#define TYPE_UNDO_NODES_RAND_LINK_COLOR (undo_nodes_rand_link_color_get_type ())
#define UNDO_NODES_RAND_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_RAND_LINK_COLOR, UndoNodesRandLinkColor))
#define UNDO_NODES_RAND_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_RAND_LINK_COLOR, UndoNodesRandLinkColorClass))
#define IS_UNDO_NODES_RAND_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_RAND_LINK_COLOR))
#define IS_UNDO_NODES_RAND_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_RAND_LINK_COLOR))
#define UNDO_NODES_RAND_LINK_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_RAND_LINK_COLOR, UndoNodesRandLinkColorClass))

typedef struct _UndoNodesRandLinkColor UndoNodesRandLinkColor;
typedef struct _UndoNodesRandLinkColorClass UndoNodesRandLinkColorClass;

#define TYPE_UNDO_NODE_REPARENT_LINK_COLOR (undo_node_reparent_link_color_get_type ())
#define UNDO_NODE_REPARENT_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_REPARENT_LINK_COLOR, UndoNodeReparentLinkColor))
#define UNDO_NODE_REPARENT_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_REPARENT_LINK_COLOR, UndoNodeReparentLinkColorClass))
#define IS_UNDO_NODE_REPARENT_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_REPARENT_LINK_COLOR))
#define IS_UNDO_NODE_REPARENT_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_REPARENT_LINK_COLOR))
#define UNDO_NODE_REPARENT_LINK_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_REPARENT_LINK_COLOR, UndoNodeReparentLinkColorClass))

typedef struct _UndoNodeReparentLinkColor UndoNodeReparentLinkColor;
typedef struct _UndoNodeReparentLinkColorClass UndoNodeReparentLinkColorClass;

#define TYPE_UNDO_NODES_REPARENT_LINK_COLOR (undo_nodes_reparent_link_color_get_type ())
#define UNDO_NODES_REPARENT_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_REPARENT_LINK_COLOR, UndoNodesReparentLinkColor))
#define UNDO_NODES_REPARENT_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_REPARENT_LINK_COLOR, UndoNodesReparentLinkColorClass))
#define IS_UNDO_NODES_REPARENT_LINK_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_REPARENT_LINK_COLOR))
#define IS_UNDO_NODES_REPARENT_LINK_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_REPARENT_LINK_COLOR))
#define UNDO_NODES_REPARENT_LINK_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_REPARENT_LINK_COLOR, UndoNodesReparentLinkColorClass))

typedef struct _UndoNodesReparentLinkColor UndoNodesReparentLinkColor;
typedef struct _UndoNodesReparentLinkColorClass UndoNodesReparentLinkColorClass;

#define TYPE_UNDO_CONNECTION_COLOR (undo_connection_color_get_type ())
#define UNDO_CONNECTION_COLOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTION_COLOR, UndoConnectionColor))
#define UNDO_CONNECTION_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTION_COLOR, UndoConnectionColorClass))
#define IS_UNDO_CONNECTION_COLOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTION_COLOR))
#define IS_UNDO_CONNECTION_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTION_COLOR))
#define UNDO_CONNECTION_COLOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTION_COLOR, UndoConnectionColorClass))

typedef struct _UndoConnectionColor UndoConnectionColor;
typedef struct _UndoConnectionColorClass UndoConnectionColorClass;
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 ())
typedef enum  {
	STICKER_MODE_NONE = 0,
	STICKER_MODE_SELECTED,
	STICKER_MODE_DROPPABLE
} StickerMode;

#define TYPE_STICKER_MODE (sticker_mode_get_type ())

#define TYPE_NODE_INFO (node_info_get_type ())
typedef struct _NodeInfo NodeInfo;

#define TYPE_UNDO_NODE_ATTACH (undo_node_attach_get_type ())
#define UNDO_NODE_ATTACH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_ATTACH, UndoNodeAttach))
#define UNDO_NODE_ATTACH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_ATTACH, UndoNodeAttachClass))
#define IS_UNDO_NODE_ATTACH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_ATTACH))
#define IS_UNDO_NODE_ATTACH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_ATTACH))
#define UNDO_NODE_ATTACH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_ATTACH, UndoNodeAttachClass))

typedef struct _UndoNodeAttach UndoNodeAttach;
typedef struct _UndoNodeAttachClass UndoNodeAttachClass;

#define TYPE_UNDO_NODE_SEQUENCES (undo_node_sequences_get_type ())
#define UNDO_NODE_SEQUENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_SEQUENCES, UndoNodeSequences))
#define UNDO_NODE_SEQUENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_SEQUENCES, UndoNodeSequencesClass))
#define IS_UNDO_NODE_SEQUENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_SEQUENCES))
#define IS_UNDO_NODE_SEQUENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_SEQUENCES))
#define UNDO_NODE_SEQUENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_SEQUENCES, UndoNodeSequencesClass))

typedef struct _UndoNodeSequences UndoNodeSequences;
typedef struct _UndoNodeSequencesClass UndoNodeSequencesClass;

#define TYPE_UNDO_NODE_GROUPS (undo_node_groups_get_type ())
typedef struct _UndoNodeGroups UndoNodeGroups;

#define TYPE_UNDO_NODE_DELETE (undo_node_delete_get_type ())
#define UNDO_NODE_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_DELETE, UndoNodeDelete))
#define UNDO_NODE_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_DELETE, UndoNodeDeleteClass))
#define IS_UNDO_NODE_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_DELETE))
#define IS_UNDO_NODE_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_DELETE))
#define UNDO_NODE_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_DELETE, UndoNodeDeleteClass))

typedef struct _UndoNodeDelete UndoNodeDelete;
typedef struct _UndoNodeDeleteClass UndoNodeDeleteClass;

#define TYPE_UNDO_NODE_SUMMARY_DELETE (undo_node_summary_delete_get_type ())
#define UNDO_NODE_SUMMARY_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_SUMMARY_DELETE, UndoNodeSummaryDelete))
#define UNDO_NODE_SUMMARY_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_SUMMARY_DELETE, UndoNodeSummaryDeleteClass))
#define IS_UNDO_NODE_SUMMARY_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_SUMMARY_DELETE))
#define IS_UNDO_NODE_SUMMARY_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_SUMMARY_DELETE))
#define UNDO_NODE_SUMMARY_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_SUMMARY_DELETE, UndoNodeSummaryDeleteClass))

typedef struct _UndoNodeSummaryDelete UndoNodeSummaryDelete;
typedef struct _UndoNodeSummaryDeleteClass UndoNodeSummaryDeleteClass;
#define _undo_node_groups_free0(var) ((var == NULL) ? NULL : (var = (undo_node_groups_free (var), NULL)))

#define TYPE_UNDO_NODES_DELETE (undo_nodes_delete_get_type ())
#define UNDO_NODES_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_DELETE, UndoNodesDelete))
#define UNDO_NODES_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_DELETE, UndoNodesDeleteClass))
#define IS_UNDO_NODES_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_DELETE))
#define IS_UNDO_NODES_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_DELETE))
#define UNDO_NODES_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_DELETE, UndoNodesDeleteClass))

typedef struct _UndoNodesDelete UndoNodesDelete;
typedef struct _UndoNodesDeleteClass UndoNodesDeleteClass;

#define TYPE_UNDO_STICKER_REMOVE (undo_sticker_remove_get_type ())
#define UNDO_STICKER_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_STICKER_REMOVE, UndoStickerRemove))
#define UNDO_STICKER_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_STICKER_REMOVE, UndoStickerRemoveClass))
#define IS_UNDO_STICKER_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_STICKER_REMOVE))
#define IS_UNDO_STICKER_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_STICKER_REMOVE))
#define UNDO_STICKER_REMOVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_STICKER_REMOVE, UndoStickerRemoveClass))

typedef struct _UndoStickerRemove UndoStickerRemove;
typedef struct _UndoStickerRemoveClass UndoStickerRemoveClass;

#define TYPE_UNDO_NODE_STICKER_REMOVE (undo_node_sticker_remove_get_type ())
#define UNDO_NODE_STICKER_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_STICKER_REMOVE, UndoNodeStickerRemove))
#define UNDO_NODE_STICKER_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_STICKER_REMOVE, UndoNodeStickerRemoveClass))
#define IS_UNDO_NODE_STICKER_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_STICKER_REMOVE))
#define IS_UNDO_NODE_STICKER_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_STICKER_REMOVE))
#define UNDO_NODE_STICKER_REMOVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_STICKER_REMOVE, UndoNodeStickerRemoveClass))

typedef struct _UndoNodeStickerRemove UndoNodeStickerRemove;
typedef struct _UndoNodeStickerRemoveClass UndoNodeStickerRemoveClass;

#define TYPE_UNDO_CONNECTION_STICKER_REMOVE (undo_connection_sticker_remove_get_type ())
#define UNDO_CONNECTION_STICKER_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTION_STICKER_REMOVE, UndoConnectionStickerRemove))
#define UNDO_CONNECTION_STICKER_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTION_STICKER_REMOVE, UndoConnectionStickerRemoveClass))
#define IS_UNDO_CONNECTION_STICKER_REMOVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTION_STICKER_REMOVE))
#define IS_UNDO_CONNECTION_STICKER_REMOVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTION_STICKER_REMOVE))
#define UNDO_CONNECTION_STICKER_REMOVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTION_STICKER_REMOVE, UndoConnectionStickerRemoveClass))

typedef struct _UndoConnectionStickerRemove UndoConnectionStickerRemove;
typedef struct _UndoConnectionStickerRemoveClass UndoConnectionStickerRemoveClass;

#define TYPE_UNDO_NODE_INSERT (undo_node_insert_get_type ())
#define UNDO_NODE_INSERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_INSERT, UndoNodeInsert))
#define UNDO_NODE_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_INSERT, UndoNodeInsertClass))
#define IS_UNDO_NODE_INSERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_INSERT))
#define IS_UNDO_NODE_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_INSERT))
#define UNDO_NODE_INSERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_INSERT, UndoNodeInsertClass))

typedef struct _UndoNodeInsert UndoNodeInsert;
typedef struct _UndoNodeInsertClass UndoNodeInsertClass;

#define TYPE_UNDO_CONNECTED_NODE (undo_connected_node_get_type ())
#define UNDO_CONNECTED_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTED_NODE, UndoConnectedNode))
#define UNDO_CONNECTED_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTED_NODE, UndoConnectedNodeClass))
#define IS_UNDO_CONNECTED_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTED_NODE))
#define IS_UNDO_CONNECTED_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTED_NODE))
#define UNDO_CONNECTED_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTED_NODE, UndoConnectedNodeClass))

typedef struct _UndoConnectedNode UndoConnectedNode;
typedef struct _UndoConnectedNodeClass UndoConnectedNodeClass;

#define TYPE_UNDO_NODE_ADD_PARENT (undo_node_add_parent_get_type ())
#define UNDO_NODE_ADD_PARENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_ADD_PARENT, UndoNodeAddParent))
#define UNDO_NODE_ADD_PARENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_ADD_PARENT, UndoNodeAddParentClass))
#define IS_UNDO_NODE_ADD_PARENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_ADD_PARENT))
#define IS_UNDO_NODE_ADD_PARENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_ADD_PARENT))
#define UNDO_NODE_ADD_PARENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_ADD_PARENT, UndoNodeAddParentClass))

typedef struct _UndoNodeAddParent UndoNodeAddParent;
typedef struct _UndoNodeAddParentClass UndoNodeAddParentClass;

#define TYPE_UNDO_NODE_SUMMARY (undo_node_summary_get_type ())
#define UNDO_NODE_SUMMARY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_SUMMARY, UndoNodeSummary))
#define UNDO_NODE_SUMMARY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_SUMMARY, UndoNodeSummaryClass))
#define IS_UNDO_NODE_SUMMARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_SUMMARY))
#define IS_UNDO_NODE_SUMMARY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_SUMMARY))
#define UNDO_NODE_SUMMARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_SUMMARY, UndoNodeSummaryClass))

typedef struct _UndoNodeSummary UndoNodeSummary;
typedef struct _UndoNodeSummaryClass UndoNodeSummaryClass;

#define TYPE_UNDO_NODE_SUMMARY_FROM_NODE (undo_node_summary_from_node_get_type ())
#define UNDO_NODE_SUMMARY_FROM_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_SUMMARY_FROM_NODE, UndoNodeSummaryFromNode))
#define UNDO_NODE_SUMMARY_FROM_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_SUMMARY_FROM_NODE, UndoNodeSummaryFromNodeClass))
#define IS_UNDO_NODE_SUMMARY_FROM_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_SUMMARY_FROM_NODE))
#define IS_UNDO_NODE_SUMMARY_FROM_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_SUMMARY_FROM_NODE))
#define UNDO_NODE_SUMMARY_FROM_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_SUMMARY_FROM_NODE, UndoNodeSummaryFromNodeClass))

typedef struct _UndoNodeSummaryFromNode UndoNodeSummaryFromNode;
typedef struct _UndoNodeSummaryFromNodeClass UndoNodeSummaryFromNodeClass;

#define TYPE_UNDO_NODE_DETACH (undo_node_detach_get_type ())
#define UNDO_NODE_DETACH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_DETACH, UndoNodeDetach))
#define UNDO_NODE_DETACH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_DETACH, UndoNodeDetachClass))
#define IS_UNDO_NODE_DETACH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_DETACH))
#define IS_UNDO_NODE_DETACH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_DETACH))
#define UNDO_NODE_DETACH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_DETACH, UndoNodeDetachClass))

typedef struct _UndoNodeDetach UndoNodeDetach;
typedef struct _UndoNodeDetachClass UndoNodeDetachClass;

#define TYPE_UNDO_NODE_BALANCE (undo_node_balance_get_type ())
#define UNDO_NODE_BALANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_BALANCE, UndoNodeBalance))
#define UNDO_NODE_BALANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_BALANCE, UndoNodeBalanceClass))
#define IS_UNDO_NODE_BALANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_BALANCE))
#define IS_UNDO_NODE_BALANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_BALANCE))
#define UNDO_NODE_BALANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_BALANCE, UndoNodeBalanceClass))

typedef struct _UndoNodeBalance UndoNodeBalance;
typedef struct _UndoNodeBalanceClass UndoNodeBalanceClass;

#define TYPE_PARTITIONER (partitioner_get_type ())
#define PARTITIONER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PARTITIONER, Partitioner))
#define PARTITIONER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PARTITIONER, PartitionerClass))
#define IS_PARTITIONER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PARTITIONER))
#define IS_PARTITIONER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PARTITIONER))
#define PARTITIONER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PARTITIONER, PartitionerClass))

typedef struct _Partitioner Partitioner;
typedef struct _PartitionerClass PartitionerClass;
#define _xmlFreeDoc0(var) ((var == NULL) ? NULL : (var = (xmlFreeDoc (var), NULL)))

#define TYPE_UNDO_NODE_CUT (undo_node_cut_get_type ())
#define UNDO_NODE_CUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_CUT, UndoNodeCut))
#define UNDO_NODE_CUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_CUT, UndoNodeCutClass))
#define IS_UNDO_NODE_CUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_CUT))
#define IS_UNDO_NODE_CUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_CUT))
#define UNDO_NODE_CUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_CUT, UndoNodeCutClass))

typedef struct _UndoNodeCut UndoNodeCut;
typedef struct _UndoNodeCutClass UndoNodeCutClass;

#define TYPE_UNDO_NODES_CUT (undo_nodes_cut_get_type ())
#define UNDO_NODES_CUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_CUT, UndoNodesCut))
#define UNDO_NODES_CUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_CUT, UndoNodesCutClass))
#define IS_UNDO_NODES_CUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_CUT))
#define IS_UNDO_NODES_CUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_CUT))
#define UNDO_NODES_CUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_CUT, UndoNodesCutClass))

typedef struct _UndoNodesCut UndoNodesCut;
typedef struct _UndoNodesCutClass UndoNodesCutClass;

#define TYPE_UNDO_NODES_REPLACE (undo_nodes_replace_get_type ())
#define UNDO_NODES_REPLACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_REPLACE, UndoNodesReplace))
#define UNDO_NODES_REPLACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_REPLACE, UndoNodesReplaceClass))
#define IS_UNDO_NODES_REPLACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_REPLACE))
#define IS_UNDO_NODES_REPLACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_REPLACE))
#define UNDO_NODES_REPLACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_REPLACE, UndoNodesReplaceClass))

typedef struct _UndoNodesReplace UndoNodesReplace;
typedef struct _UndoNodesReplaceClass UndoNodesReplaceClass;

#define TYPE_EXPORT (export_get_type ())
#define EXPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EXPORT, Export))
#define EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXPORT, ExportClass))
#define IS_EXPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EXPORT))
#define IS_EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EXPORT))
#define EXPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EXPORT, ExportClass))

typedef struct _Export Export;
typedef struct _ExportClass ExportClass;

#define TYPE_EXPORT_TEXT (export_text_get_type ())
#define EXPORT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EXPORT_TEXT, ExportText))
#define EXPORT_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXPORT_TEXT, ExportTextClass))
#define IS_EXPORT_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EXPORT_TEXT))
#define IS_EXPORT_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EXPORT_TEXT))
#define EXPORT_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EXPORT_TEXT, ExportTextClass))

typedef struct _ExportText ExportText;
typedef struct _ExportTextClass ExportTextClass;

#define TYPE_EXPORTS (exports_get_type ())
#define EXPORTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EXPORTS, Exports))
#define EXPORTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EXPORTS, ExportsClass))
#define IS_EXPORTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EXPORTS))
#define IS_EXPORTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EXPORTS))
#define EXPORTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EXPORTS, ExportsClass))

typedef struct _Exports Exports;
typedef struct _ExportsClass ExportsClass;
#define _export_unref0(var) ((var == NULL) ? NULL : (var = (export_unref (var), NULL)))

#define TYPE_UNDO_NODES_INSERT (undo_nodes_insert_get_type ())
#define UNDO_NODES_INSERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODES_INSERT, UndoNodesInsert))
#define UNDO_NODES_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODES_INSERT, UndoNodesInsertClass))
#define IS_UNDO_NODES_INSERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODES_INSERT))
#define IS_UNDO_NODES_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODES_INSERT))
#define UNDO_NODES_INSERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODES_INSERT, UndoNodesInsertClass))

typedef struct _UndoNodesInsert UndoNodesInsert;
typedef struct _UndoNodesInsertClass UndoNodesInsertClass;

#define TYPE_UNDO_NODE_PASTE (undo_node_paste_get_type ())
#define UNDO_NODE_PASTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_PASTE, UndoNodePaste))
#define UNDO_NODE_PASTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_PASTE, UndoNodePasteClass))
#define IS_UNDO_NODE_PASTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_PASTE))
#define IS_UNDO_NODE_PASTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_PASTE))
#define UNDO_NODE_PASTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_PASTE, UndoNodePasteClass))

typedef struct _UndoNodePaste UndoNodePaste;
typedef struct _UndoNodePasteClass UndoNodePasteClass;

#define TYPE_UNDO_CONNECTION_ADD (undo_connection_add_get_type ())
#define UNDO_CONNECTION_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTION_ADD, UndoConnectionAdd))
#define UNDO_CONNECTION_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTION_ADD, UndoConnectionAddClass))
#define IS_UNDO_CONNECTION_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTION_ADD))
#define IS_UNDO_CONNECTION_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTION_ADD))
#define UNDO_CONNECTION_ADD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTION_ADD, UndoConnectionAddClass))

typedef struct _UndoConnectionAdd UndoConnectionAdd;
typedef struct _UndoConnectionAddClass UndoConnectionAddClass;

#define TYPE_UNDO_CONNECTION_DELETE (undo_connection_delete_get_type ())
#define UNDO_CONNECTION_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTION_DELETE, UndoConnectionDelete))
#define UNDO_CONNECTION_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTION_DELETE, UndoConnectionDeleteClass))
#define IS_UNDO_CONNECTION_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTION_DELETE))
#define IS_UNDO_CONNECTION_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTION_DELETE))
#define UNDO_CONNECTION_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTION_DELETE, UndoConnectionDeleteClass))

typedef struct _UndoConnectionDelete UndoConnectionDelete;
typedef struct _UndoConnectionDeleteClass UndoConnectionDeleteClass;

#define TYPE_UNDO_CONNECTIONS_DELETE (undo_connections_delete_get_type ())
#define UNDO_CONNECTIONS_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_CONNECTIONS_DELETE, UndoConnectionsDelete))
#define UNDO_CONNECTIONS_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_CONNECTIONS_DELETE, UndoConnectionsDeleteClass))
#define IS_UNDO_CONNECTIONS_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_CONNECTIONS_DELETE))
#define IS_UNDO_CONNECTIONS_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_CONNECTIONS_DELETE))
#define UNDO_CONNECTIONS_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_CONNECTIONS_DELETE, UndoConnectionsDeleteClass))

typedef struct _UndoConnectionsDelete UndoConnectionsDelete;
typedef struct _UndoConnectionsDeleteClass UndoConnectionsDeleteClass;
typedef struct _Block42Data Block42Data;
#define _map_model_unref0(var) ((var == NULL) ? NULL : (var = (map_model_unref (var), NULL)))

#define TYPE_UNDO_NODE_SORT (undo_node_sort_get_type ())
#define UNDO_NODE_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_NODE_SORT, UndoNodeSort))
#define UNDO_NODE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_NODE_SORT, UndoNodeSortClass))
#define IS_UNDO_NODE_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_NODE_SORT))
#define IS_UNDO_NODE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_NODE_SORT))
#define UNDO_NODE_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_NODE_SORT, UndoNodeSortClass))

typedef struct _UndoNodeSort UndoNodeSort;
typedef struct _UndoNodeSortClass UndoNodeSortClass;
typedef struct _ParamSpecMapModel ParamSpecMapModel;
enum  {
	MAP_MODEL_CHANGED_SIGNAL,
	MAP_MODEL_CURRENT_CHANGED_SIGNAL,
	MAP_MODEL_THEME_CHANGED_SIGNAL,
	MAP_MODEL_LOADED_SIGNAL,
	MAP_MODEL_QUEUE_DRAW_SIGNAL,
	MAP_MODEL_SEE_SIGNAL,
	MAP_MODEL_NUM_SIGNALS
};
static guint map_model_signals[MAP_MODEL_NUM_SIGNALS] = {0};
#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);

struct _MapModel {
	GTypeInstance parent_instance;
	volatile int ref_count;
	MapModelPrivate * priv;
};

struct _MapModelClass {
	GTypeClass parent_class;
	void (*finalize) (MapModel *self);
};

struct _MapModelPrivate {
	MindMap* _map;
	Node* _last_node;
	GArray* _nodes;
	Connections* _connections;
	Stickers* _stickers;
	Theme* _theme;
	Node* _last_match;
	Node* _attach_node;
	SummaryNode* _attach_summary;
	Connection* _attach_conn;
	Sticker* _attach_sticker;
	guint* _auto_save_id;
	gboolean _debug;
	NodeGroups* _groups;
	gint _next_node_id;
	NodeLinks* _node_links;
	gboolean _hide_callouts;
	GArray* _braindump;
	gboolean _modifiable;
	Tags* _tags;
	Layouts* _layouts;
	ImageManager* _image_manager;
	gboolean _is_loaded;
	gboolean _braindump_shown;
};

struct _NodeTaskInfo {
	gboolean enabled;
	gboolean done;
	Node* node;
};

struct _NodeInfo {
	gdouble posx;
	gdouble posy;
	NodeSide side;
	GdkRGBA color;
};

struct _UndoNodeGroups {
	Node* node;
	GArray* groups;
};

struct _Block42Data {
	int _ref_count_;
	MapModel* self;
	Node* parent;
};

struct _ParamSpecMapModel {
	GParamSpec parent_instance;
};

static gint MapModel_private_offset;
static gpointer map_model_parent_class = NULL;
VALA_EXTERN Styles* style_inspector_styles;

VALA_EXTERN GType map_item_component_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean map_item_component_is_connection_handle (MapItemComponent self);
VALA_EXTERN gpointer map_model_ref (gpointer instance);
VALA_EXTERN void map_model_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_map_model (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_map_model (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_map_model (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_map_model (const GValue* value);
VALA_EXTERN GType map_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MapModel, map_model_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)
VALA_EXTERN gpointer connections_ref (gpointer instance);
VALA_EXTERN void connections_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_connections (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_connections (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_connections (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_connections (const GValue* value);
VALA_EXTERN GType connections_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Connections, connections_unref)
VALA_EXTERN gpointer stickers_ref (gpointer instance);
VALA_EXTERN void stickers_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_stickers (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_stickers (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_stickers (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_stickers (const GValue* value);
VALA_EXTERN GType stickers_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Stickers, stickers_unref)
VALA_EXTERN GType theme_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Theme, g_object_unref)
VALA_EXTERN GType summary_node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SummaryNode, g_object_unref)
VALA_EXTERN GType connection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Connection, g_object_unref)
VALA_EXTERN GType sticker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Sticker, g_object_unref)
VALA_EXTERN gpointer node_groups_ref (gpointer instance);
VALA_EXTERN void node_groups_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_groups (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_node_groups (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_node_groups (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_node_groups (const GValue* value);
VALA_EXTERN GType node_groups_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeGroups, node_groups_unref)
VALA_EXTERN gpointer node_links_ref (gpointer instance);
VALA_EXTERN void node_links_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_links (const gchar* name,
                                   const gchar* nick,
                                   const gchar* blurb,
                                   GType object_type,
                                   GParamFlags flags);
VALA_EXTERN void value_set_node_links (GValue* value,
                           gpointer v_object);
VALA_EXTERN void value_take_node_links (GValue* value,
                            gpointer v_object);
VALA_EXTERN gpointer value_get_node_links (const GValue* value);
VALA_EXTERN GType node_links_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeLinks, node_links_unref)
VALA_EXTERN gpointer tags_ref (gpointer instance);
VALA_EXTERN void tags_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_tags (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags);
VALA_EXTERN void value_set_tags (GValue* value,
                     gpointer v_object);
VALA_EXTERN void value_take_tags (GValue* value,
                      gpointer v_object);
VALA_EXTERN gpointer value_get_tags (const GValue* value);
VALA_EXTERN GType tags_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Tags, tags_unref)
VALA_EXTERN GType layouts_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Layouts, g_object_unref)
VALA_EXTERN gpointer image_manager_ref (gpointer instance);
VALA_EXTERN void image_manager_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_image_manager (const gchar* name,
                                      const gchar* nick,
                                      const gchar* blurb,
                                      GType object_type,
                                      GParamFlags flags);
VALA_EXTERN void value_set_image_manager (GValue* value,
                              gpointer v_object);
VALA_EXTERN void value_take_image_manager (GValue* value,
                               gpointer v_object);
VALA_EXTERN gpointer value_get_image_manager (const GValue* value);
VALA_EXTERN GType image_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ImageManager, image_manager_unref)
VALA_EXTERN Layouts* layouts_new (void);
VALA_EXTERN Layouts* layouts_construct (GType object_type);
VALA_EXTERN ImageManager* image_manager_new (void);
VALA_EXTERN ImageManager* image_manager_construct (GType object_type);
VALA_EXTERN MapModel* map_model_new (MindMap* map);
VALA_EXTERN MapModel* map_model_construct (GType object_type,
                               MindMap* map);
static void _g_object_unref0_ (gpointer var);
static void _vala_Node_free_function_content_of (gpointer data);
VALA_EXTERN Connections* connections_new (void);
VALA_EXTERN Connections* connections_construct (GType object_type);
VALA_EXTERN Stickers* stickers_new (void);
VALA_EXTERN Stickers* stickers_construct (GType object_type);
VALA_EXTERN NodeGroups* node_groups_new (void);
VALA_EXTERN NodeGroups* node_groups_construct (GType object_type);
VALA_EXTERN NodeLinks* node_links_new (void);
VALA_EXTERN NodeLinks* node_links_construct (GType object_type);
static void _g_free0_ (gpointer var);
static void _vala_gchar_free_function_content_of (gpointer data);
VALA_EXTERN Tags* tags_new (void);
VALA_EXTERN Tags* tags_construct (GType object_type);
VALA_EXTERN Theme* theme_new (void);
VALA_EXTERN Theme* theme_construct (GType object_type);
VALA_EXTERN void map_model_set_theme (MapModel* self,
                          Theme* theme,
                          gboolean save);
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN MainWindow* mind_map_get_win (MindMap* self);
VALA_EXTERN GType themes_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Themes, g_object_unref)
VALA_EXTERN Themes* main_window_get_themes (MainWindow* self);
VALA_EXTERN Theme* themes_get_theme (Themes* self,
                         const gchar* name);
VALA_EXTERN GSettings* mind_map_get_settings (MindMap* self);
VALA_EXTERN Theme* map_model_get_theme (MapModel* self);
VALA_EXTERN void formatted_text_set_theme (Theme* theme);
static void map_model_update_theme_colors (MapModel* self,
                                    Theme* new_theme);
VALA_EXTERN void map_model_update_css (MapModel* self);
VALA_EXTERN void map_model_auto_save (MapModel* self);
VALA_EXTERN GtkCssProvider* theme_get_css_provider (Theme* self,
                                        gint text_size);
VALA_EXTERN gint main_window_get_text_size (MainWindow* self);
VALA_EXTERN void node_update_theme_colors (Node* self,
                               Theme* old_theme,
                               Theme* new_theme);
VALA_EXTERN void map_model_set_layout (MapModel* self,
                           const gchar* name,
                           Node* root_node,
                           gboolean undoable);
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 Layouts* map_model_get_layouts (MapModel* self);
VALA_EXTERN Layout* layouts_get_layout (Layouts* self,
                            const gchar* name);
VALA_EXTERN GType undo_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoItem, g_object_unref)
VALA_EXTERN void mind_map_add_undo (MindMap* self,
                        UndoItem* item);
VALA_EXTERN UndoNodeLayout* undo_node_layout_new (Layout* old_layout,
                                      Layout* new_layout,
                                      Node* root_node);
VALA_EXTERN UndoNodeLayout* undo_node_layout_construct (GType object_type,
                                            Layout* old_layout,
                                            Layout* new_layout,
                                            Node* root_node);
VALA_EXTERN GType undo_node_layout_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeLayout, g_object_unref)
VALA_EXTERN gboolean layout_get_balanceable (Layout* self);
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 void node_set_layout (Node* self,
                      Layout* value);
VALA_EXTERN void layout_initialize (Layout* self,
                        Node* parent);
VALA_EXTERN void map_model_balance_nodes (MapModel* self,
                              gboolean undoable,
                              gboolean animate);
VALA_EXTERN void animator_animate (Animator* self);
VALA_EXTERN void map_model_update_node_sizes (MapModel* self);
VALA_EXTERN void node_update_tree (Node* self);
VALA_EXTERN GArray* map_model_get_nodes (MapModel* self);
VALA_EXTERN Node* map_model_get_node (MapModel* self,
                          GArray* nodes,
                          gint id);
VALA_EXTERN Node* node_get_node (Node* self,
                     gint id);
static void map_model_load_theme (MapModel* self,
                           xmlNode* n);
VALA_EXTERN void theme_load (Theme* self,
                 xmlNode* n);
VALA_EXTERN gboolean themes_exists (Themes* self,
                        Theme* theme);
VALA_EXTERN gboolean theme_get_custom (Theme* self);
VALA_EXTERN gchar* themes_uniquify_name (Themes* self,
                             const gchar* name);
VALA_EXTERN const gchar* theme_get_name (Theme* self);
VALA_EXTERN void theme_set_name (Theme* self,
                     const gchar* value);
VALA_EXTERN void themes_add_theme (Themes* self,
                       Theme* theme);
VALA_EXTERN MindMap* main_window_get_current_map (MainWindow* self,
                                      const gchar* caller);
static void map_model_load_layout (MapModel* self,
                            xmlNode* n,
                            Layout** layout);
static void map_model_load_global_style (MapModel* self,
                                  xmlNode* n);
VALA_EXTERN gpointer style_ref (gpointer instance);
VALA_EXTERN void style_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_style (const gchar* name,
                              const gchar* nick,
                              const gchar* blurb,
                              GType object_type,
                              GParamFlags flags);
VALA_EXTERN void value_set_style (GValue* value,
                      gpointer v_object);
VALA_EXTERN void value_take_style (GValue* value,
                       gpointer v_object);
VALA_EXTERN gpointer value_get_style (const GValue* value);
VALA_EXTERN GType style_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Style, style_unref)
VALA_EXTERN Style* mind_map_get_global_style (MindMap* self);
VALA_EXTERN void style_load_node (Style* self,
                      xmlNode* node);
VALA_EXTERN void style_load_connection (Style* self,
                            xmlNode* node);
VALA_EXTERN void style_load_callout (Style* self,
                         xmlNode* node);
VALA_EXTERN gboolean map_model_xml_find (xmlNode* n,
                             gint id,
                             gchar** name);
VALA_EXTERN gboolean node_xml_find (xmlNode* n,
                        gint id,
                        gchar** name);
VALA_EXTERN void map_model_load (MapModel* self,
                     xmlNode* n);
VALA_EXTERN gboolean animator_get_enable (Animator* self);
VALA_EXTERN void animator_set_enable (Animator* self,
                          gboolean value);
VALA_EXTERN gpointer styles_ref (gpointer instance);
VALA_EXTERN void styles_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_styles (const gchar* name,
                               const gchar* nick,
                               const gchar* blurb,
                               GType object_type,
                               GParamFlags flags);
VALA_EXTERN void value_set_styles (GValue* value,
                       gpointer v_object);
VALA_EXTERN void value_take_styles (GValue* value,
                        gpointer v_object);
VALA_EXTERN gpointer value_get_styles (const GValue* value);
VALA_EXTERN GType styles_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Styles, styles_unref)
VALA_EXTERN void styles_load (Styles* self,
                  xmlNode* n);
VALA_EXTERN gboolean style_copy (Style* self,
                     Style* s);
VALA_EXTERN Style* styles_get_global_style (Styles* self);
VALA_EXTERN void tags_load (Tags* self,
                xmlNode* node);
VALA_EXTERN ImageManager* map_model_get_image_manager (MapModel* self);
VALA_EXTERN void image_manager_load (ImageManager* self,
                         xmlNode* n);
VALA_EXTERN void connections_load (Connections* self,
                       MindMap* map,
                       xmlNode* node,
                       GArray* conns,
                       GArray* nodes);
VALA_EXTERN NodeGroups* map_model_get_groups (MapModel* self);
VALA_EXTERN GType node_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeGroup, g_object_unref)
VALA_EXTERN void node_groups_load (NodeGroups* self,
                       MindMap* map,
                       xmlNode* g,
                       GArray* groups,
                       GArray* nodes);
VALA_EXTERN void stickers_load (Stickers* self,
                    MindMap* map,
                    xmlNode* n);
VALA_EXTERN void node_links_load (NodeLinks* self,
                      xmlNode* node);
VALA_EXTERN Node* node_new_from_xml (MindMap* map,
                         Layout* layout,
                         xmlNode* n,
                         gboolean isroot,
                         Node* sibling_parent,
                         GArray** siblings);
VALA_EXTERN Node* node_construct_from_xml (GType object_type,
                               MindMap* map,
                               Layout* layout,
                               xmlNode* n,
                               gboolean isroot,
                               Node* sibling_parent,
                               GArray** siblings);
static void map_model_set_is_loaded (MapModel* self,
                              gboolean value);
VALA_EXTERN gboolean map_model_save (MapModel* self,
                         xmlNode* parent);
VALA_EXTERN xmlNode* theme_save (Theme* self);
VALA_EXTERN void style_save_node_in_node (Style* self,
                              xmlNode* n);
VALA_EXTERN void style_save_connection_in_node (Style* self,
                                    xmlNode* n);
VALA_EXTERN void style_save_callout_in_node (Style* self,
                                 xmlNode* n);
VALA_EXTERN void image_manager_save (ImageManager* self,
                         xmlNode* n);
VALA_EXTERN xmlNode* tags_save (Tags* self);
VALA_EXTERN void node_save (Node* self,
                xmlNode* parent);
VALA_EXTERN xmlNode* node_groups_save (NodeGroups* self);
VALA_EXTERN void connections_save (Connections* self,
                       xmlNode* parent);
VALA_EXTERN xmlNode* stickers_save (Stickers* self);
VALA_EXTERN xmlNode* node_links_save (NodeLinks* self);
VALA_EXTERN void map_model_document_rectangle (MapModel* self,
                                   gdouble* x,
                                   gdouble* y,
                                   gdouble* width,
                                   gdouble* height);
VALA_EXTERN gpointer node_bounds_ref (gpointer instance);
VALA_EXTERN void node_bounds_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_bounds (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_node_bounds (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_node_bounds (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_node_bounds (const GValue* value);
VALA_EXTERN GType node_bounds_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeBounds, node_bounds_unref)
VALA_EXTERN NodeBounds* node_get_tree_bbox (Node* self);
VALA_EXTERN gdouble node_bounds_get_x (NodeBounds* self);
VALA_EXTERN gdouble node_bounds_get_y (NodeBounds* self);
VALA_EXTERN gdouble node_bounds_get_width (NodeBounds* self);
VALA_EXTERN gdouble node_bounds_get_height (NodeBounds* self);
VALA_EXTERN void connections_add_extents (Connections* self,
                              gdouble* x1,
                              gdouble* y1,
                              gdouble* x2,
                              gdouble* y2);
VALA_EXTERN void stickers_add_extents (Stickers* self,
                           gdouble* x1,
                           gdouble* y1,
                           gdouble* x2,
                           gdouble* y2);
VALA_EXTERN void map_model_initialize (MapModel* self);
VALA_EXTERN void connections_clear_all_connections (Connections* self);
VALA_EXTERN void stickers_clear (Stickers* self);
VALA_EXTERN void node_groups_clear (NodeGroups* self);
VALA_EXTERN void map_model_get_match_items (MapModel* self,
                                const gchar* tabname,
                                const gchar* pattern,
                                gboolean* search_opts,
                                gint search_opts_length1,
                                GtkListStore** matches);
VALA_EXTERN GType search_options_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void node_get_match_items (Node* self,
                           const gchar* tabname,
                           const gchar* pattern,
                           gboolean* search_opts,
                           gint search_opts_length1,
                           GtkListStore** matches);
VALA_EXTERN void connections_get_match_items (Connections* self,
                                  const gchar* tabname,
                                  const gchar* pattern,
                                  gboolean* search_opts,
                                  gint search_opts_length1,
                                  GtkListStore** matches);
VALA_EXTERN void node_groups_get_match_items (NodeGroups* self,
                                  const gchar* tabname,
                                  const gchar* pattern,
                                  gboolean* search_opts,
                                  gint search_opts_length1,
                                  GtkListStore** matches);
VALA_EXTERN GType node_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void map_model_set_node_mode (MapModel* self,
                              Node* node,
                              NodeMode mode,
                              gboolean undoable);
VALA_EXTERN NodeMode node_get_mode (Node* self);
VALA_EXTERN GType draw_area_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DrawArea, g_object_unref)
VALA_EXTERN DrawArea* mind_map_get_canvas (MindMap* self);
VALA_EXTERN GType canvas_text_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CanvasText, g_object_unref)
VALA_EXTERN void draw_area_update_im_cursor (DrawArea* self,
                                 CanvasText* ct);
VALA_EXTERN CanvasText* node_get_name (Node* self);
VALA_EXTERN GtkIMContext* draw_area_get_im_context (DrawArea* self);
VALA_EXTERN gboolean canvas_text_is_within (CanvasText* self,
                                gdouble x,
                                gdouble y);
VALA_EXTERN gdouble draw_area_get_scaled_x (DrawArea* self);
VALA_EXTERN gdouble draw_area_get_scaled_y (DrawArea* self);
VALA_EXTERN void draw_area_set_text_cursor (DrawArea* self);
VALA_EXTERN GType undo_buffer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoBuffer, g_object_unref)
VALA_EXTERN GType undo_text_buffer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoTextBuffer, g_object_unref)
VALA_EXTERN UndoTextBuffer* mind_map_get_undo_text (MindMap* self);
VALA_EXTERN CanvasText* undo_text_buffer_get_orig (UndoTextBuffer* self);
VALA_EXTERN void canvas_text_copy (CanvasText* self,
                       CanvasText* ct);
VALA_EXTERN void undo_text_buffer_set_ct (UndoTextBuffer* self,
                              CanvasText* value);
VALA_EXTERN void undo_text_buffer_set_do_undo (UndoTextBuffer* self,
                                   gboolean value);
VALA_EXTERN void node_set_mode (Node* self,
                    NodeMode value);
VALA_EXTERN void draw_area_reset_cursor (DrawArea* self);
VALA_EXTERN void undo_buffer_clear (UndoBuffer* self);
VALA_EXTERN gboolean undo_text_buffer_get_do_undo (UndoTextBuffer* self);
VALA_EXTERN UndoNodeName* undo_node_name_new (MindMap* map,
                                  Node* node,
                                  CanvasText* orig_text);
VALA_EXTERN UndoNodeName* undo_node_name_construct (GType object_type,
                                        MindMap* map,
                                        Node* node,
                                        CanvasText* orig_text);
VALA_EXTERN GType undo_node_name_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeName, g_object_unref)
VALA_EXTERN GType conn_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void map_model_set_connection_mode (MapModel* self,
                                    Connection* conn,
                                    ConnMode mode,
                                    gboolean undoable);
VALA_EXTERN ConnMode connection_get_mode (Connection* self);
VALA_EXTERN CanvasText* connection_get_title (Connection* self);
VALA_EXTERN UndoConnectionTitle* undo_connection_title_new (MindMap* map,
                                                Connection* conn,
                                                CanvasText* orig_text);
VALA_EXTERN UndoConnectionTitle* undo_connection_title_construct (GType object_type,
                                                      MindMap* map,
                                                      Connection* conn,
                                                      CanvasText* orig_text);
VALA_EXTERN GType undo_connection_title_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectionTitle, g_object_unref)
VALA_EXTERN void connection_set_mode (Connection* self,
                          ConnMode value);
VALA_EXTERN GType callout_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Callout, g_object_unref)
VALA_EXTERN GType callout_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void map_model_set_callout_mode (MapModel* self,
                                 Callout* callout,
                                 CalloutMode mode,
                                 gboolean undoable);
VALA_EXTERN CalloutMode callout_get_mode (Callout* self);
VALA_EXTERN CanvasText* callout_get_text (Callout* self);
VALA_EXTERN void callout_set_mode (Callout* self,
                       CalloutMode value);
VALA_EXTERN UndoCalloutText* undo_callout_text_new (MindMap* map,
                                        Callout* callout,
                                        CanvasText* orig_text);
VALA_EXTERN UndoCalloutText* undo_callout_text_construct (GType object_type,
                                              MindMap* map,
                                              Callout* callout,
                                              CanvasText* orig_text);
VALA_EXTERN GType undo_callout_text_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoCalloutText, g_object_unref)
VALA_EXTERN void map_model_toggle_task (MapModel* self,
                            Node* n);
VALA_EXTERN GType node_task_info_get_type (void) G_GNUC_CONST ;
VALA_EXTERN NodeTaskInfo* node_task_info_dup (const NodeTaskInfo* self);
VALA_EXTERN void node_task_info_free (NodeTaskInfo* self);
VALA_EXTERN void node_task_info_copy (const NodeTaskInfo* self,
                          NodeTaskInfo* dest);
VALA_EXTERN void node_task_info_destroy (NodeTaskInfo* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (NodeTaskInfo, node_task_info_destroy)
static void _node_task_info_free0_ (gpointer var);
static void _vala_NodeTaskInfo_free_function_content_of (gpointer data);
VALA_EXTERN void node_toggle_task_done (Node* self,
                            GArray** changed);
VALA_EXTERN UndoNodeTasks* undo_node_tasks_new (GArray* task_info);
VALA_EXTERN UndoNodeTasks* undo_node_tasks_construct (GType object_type,
                                          GArray* task_info);
VALA_EXTERN GType undo_node_tasks_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeTasks, g_object_unref)
VALA_EXTERN void map_model_toggle_folds (MapModel* self,
                             gboolean deep);
VALA_EXTERN gpointer selection_ref (gpointer instance);
VALA_EXTERN void selection_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_selection (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_selection (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_selection (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_selection (const GValue* value);
VALA_EXTERN GType selection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Selection, selection_unref)
VALA_EXTERN Selection* mind_map_get_selected (MindMap* self);
VALA_EXTERN void selection_get_parents (Selection* self,
                            GArray** parents);
VALA_EXTERN void animator_add_nodes_fold (Animator* self,
                              GArray* n,
                              GArray* nodes,
                              const gchar* name);
VALA_EXTERN void node_set_fold (Node* self,
                    gboolean value,
                    gboolean deep,
                    GArray* changed);
VALA_EXTERN gboolean node_get_folded (Node* self);
VALA_EXTERN UndoNodeFolds* undo_node_folds_new (GArray* nodes);
VALA_EXTERN UndoNodeFolds* undo_node_folds_construct (GType object_type,
                                          GArray* nodes);
VALA_EXTERN GType undo_node_folds_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeFolds, g_object_unref)
VALA_EXTERN GType tag_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Tag, g_object_unref)
VALA_EXTERN void map_model_remove_tag (MapModel* self,
                           Tag* tag,
                           GArray* nodes);
VALA_EXTERN gboolean node_remove_tag (Node* self,
                          Tag* tag,
                          GArray* nodes);
VALA_EXTERN GType tag_combo_type_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void map_model_highlight_tags (MapModel* self,
                               Tags* tags,
                               TagComboType combo_type);
VALA_EXTERN void node_highlight_tags (Node* self,
                          Tags* tags,
                          TagComboType combo_type);
VALA_EXTERN void connections_update_alpha (Connections* self);
VALA_EXTERN void map_model_add_group (MapModel* self);
VALA_EXTERN gint selection_num_groups (Selection* self);
VALA_EXTERN GArray* selection_groups (Selection* self);
VALA_EXTERN NodeGroup* node_groups_merge_groups (NodeGroups* self,
                                     GArray* groups);
VALA_EXTERN UndoGroupsMerge* undo_groups_merge_new (GArray* groups,
                                        NodeGroup* merged);
VALA_EXTERN UndoGroupsMerge* undo_groups_merge_construct (GType object_type,
                                              GArray* groups,
                                              NodeGroup* merged);
VALA_EXTERN GType undo_groups_merge_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoGroupsMerge, g_object_unref)
VALA_EXTERN void mind_map_set_current_group (MindMap* self,
                                 NodeGroup* g);
VALA_EXTERN gint selection_num_nodes (Selection* self);
VALA_EXTERN GArray* selection_nodes (Selection* self);
VALA_EXTERN NodeGroup* node_group_new_array (MindMap* map,
                                 GArray* nodes);
VALA_EXTERN NodeGroup* node_group_construct_array (GType object_type,
                                       MindMap* map,
                                       GArray* nodes);
VALA_EXTERN void node_groups_add_group (NodeGroups* self,
                            NodeGroup* group);
VALA_EXTERN UndoGroupAdd* undo_group_add_new (NodeGroup* group);
VALA_EXTERN UndoGroupAdd* undo_group_add_construct (GType object_type,
                                        NodeGroup* group);
VALA_EXTERN GType undo_group_add_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoGroupAdd, g_object_unref)
VALA_EXTERN void map_model_remove_groups (MapModel* self);
VALA_EXTERN void node_groups_remove_group (NodeGroups* self,
                               NodeGroup* group);
VALA_EXTERN UndoGroupsRemove* undo_groups_remove_new (GArray* groups);
VALA_EXTERN UndoGroupsRemove* undo_groups_remove_construct (GType object_type,
                                                GArray* groups);
VALA_EXTERN GType undo_groups_remove_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoGroupsRemove, g_object_unref)
VALA_EXTERN gboolean selection_clear (Selection* self,
                          gboolean signal_change,
                          gdouble alpha);
VALA_EXTERN void map_model_change_group_color (MapModel* self,
                                   GdkRGBA* color);
VALA_EXTERN UndoGroupsColor* undo_groups_color_new (GArray* groups,
                                        GdkRGBA* new_color);
VALA_EXTERN UndoGroupsColor* undo_groups_color_construct (GType object_type,
                                              GArray* groups,
                                              GdkRGBA* new_color);
VALA_EXTERN GType undo_groups_color_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoGroupsColor, g_object_unref)
VALA_EXTERN void node_group_set_color (NodeGroup* self,
                           GdkRGBA * value);
VALA_EXTERN gboolean map_model_node_has_callout (MapModel* self);
VALA_EXTERN Node* mind_map_get_current_node (MindMap* self);
VALA_EXTERN Callout* node_get_callout (Node* self);
VALA_EXTERN void map_model_add_callout (MapModel* self);
VALA_EXTERN Node* selection_current_node (Selection* self);
VALA_EXTERN UndoNodeCallout* undo_node_callout_new (Node* node);
VALA_EXTERN UndoNodeCallout* undo_node_callout_construct (GType object_type,
                                              Node* node);
VALA_EXTERN GType undo_node_callout_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeCallout, g_object_unref)
VALA_EXTERN Callout* callout_new (Node* node);
VALA_EXTERN Callout* callout_construct (GType object_type,
                            Node* node);
VALA_EXTERN void node_set_callout (Node* self,
                       Callout* value);
VALA_EXTERN void callout_set_style (Callout* self,
                        Style* value);
VALA_EXTERN gboolean mind_map_get_focus_mode (MindMap* self);
VALA_EXTERN gdouble mind_map_get_focus_alpha (MindMap* self);
VALA_EXTERN void selection_set_current_callout (Selection* self,
                                    Callout* callout,
                                    gdouble clear_alpha);
VALA_EXTERN void map_model_remove_callout (MapModel* self);
VALA_EXTERN gboolean mind_map_is_node_selected (MindMap* self);
VALA_EXTERN gboolean mind_map_is_callout_selected (MindMap* self);
VALA_EXTERN Callout* selection_current_callout (Selection* self);
VALA_EXTERN Node* callout_get_node (Callout* self);
VALA_EXTERN void map_model_change_current_connection_title (MapModel* self,
                                                const gchar* title);
VALA_EXTERN GArray* selection_connections (Selection* self);
VALA_EXTERN gpointer formatted_text_ref (gpointer instance);
VALA_EXTERN void formatted_text_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_formatted_text (const gchar* name,
                                       const gchar* nick,
                                       const gchar* blurb,
                                       GType object_type,
                                       GParamFlags flags);
VALA_EXTERN void value_set_formatted_text (GValue* value,
                               gpointer v_object);
VALA_EXTERN void value_take_formatted_text (GValue* value,
                                gpointer v_object);
VALA_EXTERN gpointer value_get_formatted_text (const GValue* value);
VALA_EXTERN GType formatted_text_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FormattedText, formatted_text_unref)
VALA_EXTERN FormattedText* canvas_text_get_text (CanvasText* self);
VALA_EXTERN const gchar* formatted_text_get_text (FormattedText* self);
VALA_EXTERN CanvasText* canvas_text_new (MindMap* map);
VALA_EXTERN CanvasText* canvas_text_construct (GType object_type,
                                   MindMap* map);
VALA_EXTERN void connection_change_title (Connection* self,
                              MindMap* map,
                              const gchar* title,
                              gboolean allow_empty);
static void map_model_change_task (MapModel* self,
                            Node* node,
                            gboolean enable,
                            gboolean done,
                            GArray* changes);
VALA_EXTERN gboolean node_task_enabled (Node* self);
VALA_EXTERN gboolean node_task_done (Node* self);
VALA_EXTERN void node_task_info_init (NodeTaskInfo *self,
                          gboolean e,
                          gboolean d,
                          Node* n);
VALA_EXTERN void node_enable_task (Node* self,
                       gboolean task);
VALA_EXTERN void node_set_task_done (Node* self,
                         gboolean done);
VALA_EXTERN void map_model_change_current_task (MapModel* self,
                                    gboolean enable,
                                    gboolean done);
VALA_EXTERN void animator_cancel_last_add (Animator* self);
VALA_EXTERN void map_model_change_selected_tasks (MapModel* self);
VALA_EXTERN void map_model_change_current_node_note (MapModel* self,
                                         const gchar* note);
VALA_EXTERN void node_set_note (Node* self,
                    const gchar* value);
VALA_EXTERN gpointer node_link_ref (gpointer instance);
VALA_EXTERN void node_link_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_link (const gchar* name,
                                  const gchar* nick,
                                  const gchar* blurb,
                                  GType object_type,
                                  GParamFlags flags);
VALA_EXTERN void value_set_node_link (GValue* value,
                          gpointer v_object);
VALA_EXTERN void value_take_node_link (GValue* value,
                           gpointer v_object);
VALA_EXTERN gpointer value_get_node_link (const GValue* value);
VALA_EXTERN GType node_link_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeLink, node_link_unref)
VALA_EXTERN gint map_model_add_note_node_link (MapModel* self,
                                   NodeLink* link,
                                   gchar** text);
VALA_EXTERN void node_link_normalize (NodeLink* self,
                          MindMap* map);
VALA_EXTERN gchar* node_link_get_markdown_text (NodeLink* self,
                                    MindMap* map);
VALA_EXTERN gint node_links_add_link (NodeLinks* self,
                          NodeLink* link);
VALA_EXTERN void map_model_note_node_link_clicked (MapModel* self,
                                       gint id);
VALA_EXTERN NodeLink* node_links_get_node_link (NodeLinks* self,
                                    gint id);
VALA_EXTERN void node_link_select (NodeLink* self,
                       MindMap* map);
VALA_EXTERN gboolean map_model_add_link_possible (MapModel* self,
                                      CanvasText* ct);
VALA_EXTERN gboolean canvas_text_is_selected (CanvasText* self);
VALA_EXTERN void canvas_text_get_cursor_info (CanvasText* self,
                                  gint* cursor,
                                  gint* start,
                                  gint* end);
VALA_EXTERN GType format_tag_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean formatted_text_is_tag_applied_in_range (FormattedText* self,
                                                 FormatTag tag,
                                                 gint start,
                                                 gint end);
VALA_EXTERN void map_model_change_current_connection_note (MapModel* self,
                                               const gchar* note);
VALA_EXTERN void connection_set_note (Connection* self,
                          const gchar* value);
VALA_EXTERN void map_model_add_current_image (MapModel* self);
VALA_EXTERN gpointer node_image_ref (gpointer instance);
VALA_EXTERN void node_image_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_node_image (const gchar* name,
                                   const gchar* nick,
                                   const gchar* blurb,
                                   GType object_type,
                                   GParamFlags flags);
VALA_EXTERN void value_set_node_image (GValue* value,
                           gpointer v_object);
VALA_EXTERN void value_take_node_image (GValue* value,
                            gpointer v_object);
VALA_EXTERN gpointer value_get_node_image (const GValue* value);
VALA_EXTERN GType node_image_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeImage, node_image_unref)
VALA_EXTERN NodeImage* node_get_image (Node* self);
VALA_EXTERN void image_manager_choose_image (ImageManager* self,
                                 GtkWindow* parent,
                                 ImageIdFunc func,
                                 gpointer func_target);
static void ___lambda107_ (MapModel* self,
                    gint id);
VALA_EXTERN void node_set_image (Node* self,
                     ImageManager* im,
                     NodeImage* ni);
VALA_EXTERN Style* node_get_style (Node* self);
VALA_EXTERN gint* style_get_node_width (Style* self);
VALA_EXTERN NodeImage* node_image_new (ImageManager* im,
                           gint id,
                           gint width);
VALA_EXTERN NodeImage* node_image_construct (GType object_type,
                                 ImageManager* im,
                                 gint id,
                                 gint width);
VALA_EXTERN UndoNodeImage* undo_node_image_new (Node* n,
                                    NodeImage* old_image);
VALA_EXTERN UndoNodeImage* undo_node_image_construct (GType object_type,
                                          Node* n,
                                          NodeImage* old_image);
VALA_EXTERN GType undo_node_image_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeImage, g_object_unref)
static void ____lambda107__image_id_func (gint id,
                                   gpointer self);
VALA_EXTERN void map_model_delete_current_image (MapModel* self);
VALA_EXTERN void map_model_edit_current_image (MapModel* self);
VALA_EXTERN gpointer image_editor_ref (gpointer instance);
VALA_EXTERN void image_editor_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_image_editor (const gchar* name,
                                     const gchar* nick,
                                     const gchar* blurb,
                                     GType object_type,
                                     GParamFlags flags);
VALA_EXTERN void value_set_image_editor (GValue* value,
                             gpointer v_object);
VALA_EXTERN void value_take_image_editor (GValue* value,
                              gpointer v_object);
VALA_EXTERN gpointer value_get_image_editor (const GValue* value);
VALA_EXTERN GType image_editor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ImageEditor, image_editor_unref)
VALA_EXTERN ImageEditor* draw_area_get_image_editor (DrawArea* self);
VALA_EXTERN void image_editor_edit_image (ImageEditor* self,
                              ImageManager* im,
                              Node* node,
                              gdouble x,
                              gdouble y);
VALA_EXTERN gdouble node_get_posx (Node* self);
VALA_EXTERN gdouble node_get_posy (Node* self);
VALA_EXTERN void map_model_current_image_edited (MapModel* self,
                                     NodeImage* orig_image);
VALA_EXTERN void map_model_end_link (MapModel* self,
                         Node* node);
VALA_EXTERN Connection* mind_map_get_current_connection (MindMap* self);
VALA_EXTERN void connection_disconnect_node (Connection* self,
                                 Node* node);
VALA_EXTERN gboolean selection_clear_connections (Selection* self,
                                      gboolean signal_change,
                                      gdouble alpha);
VALA_EXTERN NodeLink* node_link_new (Node* node);
VALA_EXTERN NodeLink* node_link_construct (GType object_type,
                               Node* node);
VALA_EXTERN void node_set_linked_node (Node* self,
                           NodeLink* value);
VALA_EXTERN UndoNodeLink* undo_node_link_new (Node* n,
                                  NodeLink* old_link);
VALA_EXTERN UndoNodeLink* undo_node_link_construct (GType object_type,
                                        Node* n,
                                        NodeLink* old_link);
VALA_EXTERN GType undo_node_link_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeLink, g_object_unref)
VALA_EXTERN void draw_area_set_last_connection (DrawArea* self,
                                    Connection* value);
VALA_EXTERN void map_model_set_attach_node (MapModel* self,
                                Node* n,
                                NodeMode mode);
VALA_EXTERN gboolean map_model_any_selected_nodes_linked (MapModel* self);
VALA_EXTERN NodeLink* node_get_linked_node (Node* self);
VALA_EXTERN void map_model_create_links (MapModel* self);
VALA_EXTERN UndoNodesLink* undo_nodes_link_new (GArray* nodes);
VALA_EXTERN UndoNodesLink* undo_nodes_link_construct (GType object_type,
                                          GArray* nodes);
VALA_EXTERN GType undo_nodes_link_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesLink, g_object_unref)
VALA_EXTERN void map_model_delete_links (MapModel* self);
VALA_EXTERN void map_model_toggle_links (MapModel* self);
VALA_EXTERN void map_model_start_connection (MapModel* self,
                                 gboolean key,
                                 gboolean link);
VALA_EXTERN void map_model_change_current_link_color (MapModel* self,
                                          GdkRGBA* color);
VALA_EXTERN GdkRGBA* node_get_link_color (Node* self);
static GdkRGBA* _vala_GdkRGBA_copy (GdkRGBA* self);
static gboolean _gdk_rgba_equal (const GdkRGBA * s1,
                          const GdkRGBA * s2);
VALA_EXTERN void node_set_link_color (Node* self,
                          GdkRGBA* value);
VALA_EXTERN UndoNodeLinkColor* undo_node_link_color_new (Node* n,
                                             GdkRGBA* old_color);
VALA_EXTERN UndoNodeLinkColor* undo_node_link_color_construct (GType object_type,
                                                   Node* n,
                                                   GdkRGBA* old_color);
VALA_EXTERN GType undo_node_link_color_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeLinkColor, g_object_unref)
static void _vala_GdkRGBA_free (GdkRGBA* self);
VALA_EXTERN void map_model_change_link_colors (MapModel* self,
                                   GdkRGBA* color);
VALA_EXTERN UndoNodesLinkColor* undo_nodes_link_color_new (GArray* nodes,
                                               GdkRGBA* new_color);
VALA_EXTERN UndoNodesLinkColor* undo_nodes_link_color_construct (GType object_type,
                                                     GArray* nodes,
                                                     GdkRGBA* new_color);
VALA_EXTERN GType undo_nodes_link_color_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesLinkColor, g_object_unref)
VALA_EXTERN void map_model_randomize_current_link_color (MapModel* self);
VALA_EXTERN void theme_random_link_color (Theme* self,
                              GdkRGBA* result);
VALA_EXTERN void map_model_randomize_link_colors (MapModel* self);
static void __vala_GdkRGBA_free0_ (gpointer var);
static void _vala_GdkRGBA_free_function_content_of (gpointer data);
VALA_EXTERN UndoNodesRandLinkColor* undo_nodes_rand_link_color_new (GArray* nodes,
                                                        GArray* old_colors);
VALA_EXTERN UndoNodesRandLinkColor* undo_nodes_rand_link_color_construct (GType object_type,
                                                              GArray* nodes,
                                                              GArray* old_colors);
VALA_EXTERN GType undo_nodes_rand_link_color_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesRandLinkColor, g_object_unref)
VALA_EXTERN void map_model_reparent_current_link_color (MapModel* self);
VALA_EXTERN UndoNodeReparentLinkColor* undo_node_reparent_link_color_new (Node* node);
VALA_EXTERN UndoNodeReparentLinkColor* undo_node_reparent_link_color_construct (GType object_type,
                                                                    Node* node);
VALA_EXTERN GType undo_node_reparent_link_color_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeReparentLinkColor, g_object_unref)
VALA_EXTERN void node_set_link_color_root (Node* self,
                               gboolean value);
VALA_EXTERN void map_model_reparent_link_colors (MapModel* self);
VALA_EXTERN UndoNodesReparentLinkColor* undo_nodes_reparent_link_color_new (GArray* nodes);
VALA_EXTERN UndoNodesReparentLinkColor* undo_nodes_reparent_link_color_construct (GType object_type,
                                                                      GArray* nodes);
VALA_EXTERN GType undo_nodes_reparent_link_color_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesReparentLinkColor, g_object_unref)
VALA_EXTERN void map_model_change_current_connection_color (MapModel* self,
                                                GdkRGBA* color);
VALA_EXTERN Connection* selection_current_connection (Selection* self);
VALA_EXTERN GdkRGBA* connection_get_color (Connection* self);
VALA_EXTERN void connection_set_color (Connection* self,
                           GdkRGBA* value);
VALA_EXTERN UndoConnectionColor* undo_connection_color_new (Connection* c,
                                                GdkRGBA* old_color);
VALA_EXTERN UndoConnectionColor* undo_connection_color_construct (GType object_type,
                                                      Connection* c,
                                                      GdkRGBA* old_color);
VALA_EXTERN GType undo_connection_color_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectionColor, g_object_unref)
VALA_EXTERN gboolean map_model_select_connection_if_unselected (MapModel* self,
                                                    gdouble x,
                                                    gdouble y);
VALA_EXTERN Connection* connections_within_title (Connections* self,
                                      gdouble x,
                                      gdouble y);
VALA_EXTERN Connection* connections_on_curve (Connections* self,
                                  gdouble x,
                                  gdouble y);
VALA_EXTERN gboolean selection_is_connection_selected (Selection* self,
                                           Connection* conn);
VALA_EXTERN void mind_map_set_current_connection (MindMap* self,
                                      Connection* c);
VALA_EXTERN gboolean map_model_select_node_if_unselected (MapModel* self,
                                              gdouble x,
                                              gdouble y);
VALA_EXTERN Node* node_contains (Node* self,
                     gdouble x,
                     gdouble y,
                     gboolean allow_selected);
VALA_EXTERN gboolean selection_is_node_selected (Selection* self,
                                     Node* node);
VALA_EXTERN void mind_map_set_current_node (MindMap* self,
                                Node* n);
VALA_EXTERN Node* map_model_sibling_node (MapModel* self,
                              Node* node,
                              const gchar* dir,
                              gboolean wrap);
VALA_EXTERN gboolean node_is_root (Node* self);
VALA_EXTERN Node* node_get_parent (Node* self);
VALA_EXTERN GType node_side_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Node* node_first_child (Node* self,
                        NodeSide* side);
VALA_EXTERN Node* node_last_child (Node* self,
                       NodeSide* side);
VALA_EXTERN Node* node_next_child (Node* self,
                       Node* n,
                       gboolean wrap);
VALA_EXTERN Node* node_prev_child (Node* self,
                       Node* n,
                       gboolean wrap);
VALA_EXTERN Node* map_model_get_node_at_position (MapModel* self,
                                      gdouble x,
                                      gdouble y,
                                      MapItemComponent* component);
VALA_EXTERN gboolean node_is_within_title (Node* self,
                               gdouble x,
                               gdouble y);
VALA_EXTERN gboolean node_is_within_task (Node* self,
                              gdouble x,
                              gdouble y);
VALA_EXTERN gboolean node_is_within_note (Node* self,
                              gdouble x,
                              gdouble y);
VALA_EXTERN gboolean node_is_within_linked_node (Node* self,
                                     gdouble x,
                                     gdouble y);
VALA_EXTERN gboolean node_is_within_fold (Node* self,
                              gdouble x,
                              gdouble y);
VALA_EXTERN gboolean node_is_within_image (Node* self,
                               gdouble x,
                               gdouble y);
VALA_EXTERN gboolean node_is_within_resizer (Node* self,
                                 gdouble x,
                                 gdouble y);
VALA_EXTERN gboolean node_is_within_tags (Node* self,
                              gdouble x,
                              gdouble y);
VALA_EXTERN Callout* map_model_get_callout_at_position (MapModel* self,
                                            gdouble x,
                                            gdouble y,
                                            MapItemComponent* component);
VALA_EXTERN Callout* node_contains_callout (Node* self,
                                gdouble x,
                                gdouble y);
VALA_EXTERN gboolean callout_is_within_title (Callout* self,
                                  gdouble x,
                                  gdouble y);
VALA_EXTERN gboolean callout_is_within_resizer (Callout* self,
                                    gdouble x,
                                    gdouble y);
VALA_EXTERN Connection* map_model_get_connection_at_position (MapModel* self,
                                                  gdouble x,
                                                  gdouble y,
                                                  MapItemComponent* component);
VALA_EXTERN Connection* connections_within (Connections* self,
                                gdouble x,
                                gdouble y,
                                MapItemComponent* component);
VALA_EXTERN Sticker* map_model_get_sticker_at_position (MapModel* self,
                                            gdouble x,
                                            gdouble y);
VALA_EXTERN Sticker* stickers_is_within (Stickers* self,
                             gdouble x,
                             gdouble y);
VALA_EXTERN NodeGroup* map_model_get_group_at_position (MapModel* self,
                                            gdouble x,
                                            gdouble y);
VALA_EXTERN NodeGroup* node_groups_node_group_containing (NodeGroups* self,
                                              gdouble x,
                                              gdouble y);
VALA_EXTERN void map_model_set_attach_summary (MapModel* self,
                                   SummaryNode* n);
VALA_EXTERN void summary_node_set_attachable (SummaryNode* self,
                                  gboolean value);
VALA_EXTERN void map_model_set_attach_connection (MapModel* self,
                                      Connection* c,
                                      ConnMode mode);
VALA_EXTERN GType sticker_mode_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void map_model_set_attach_sticker (MapModel* self,
                                   Sticker* s,
                                   StickerMode mode);
VALA_EXTERN void sticker_set_mode (Sticker* self,
                       StickerMode value);
VALA_EXTERN Node* map_model_attachable_node (MapModel* self,
                                 gdouble x,
                                 gdouble y);
VALA_EXTERN gboolean node_contains_node (Node* self,
                             Node* node);
VALA_EXTERN gboolean node_is_summarized (Node* self);
VALA_EXTERN SummaryNode* map_model_attachable_summary_node (MapModel* self,
                                                gdouble x,
                                                gdouble y);
VALA_EXTERN GArray* node_children (Node* self);
VALA_EXTERN SummaryNode* node_summary_node (Node* self);
VALA_EXTERN gint summary_node_summarized_count (SummaryNode* self);
VALA_EXTERN gboolean node_is_leaf (Node* self);
VALA_EXTERN gboolean node_last_summarized (Node* self);
VALA_EXTERN gboolean summary_node_is_within_summarized (SummaryNode* self,
                                            gdouble x,
                                            gdouble y);
VALA_EXTERN void map_model_draw_all (MapModel* self,
                         cairo_t* ctx,
                         gboolean exporting,
                         gboolean moving_node);
VALA_EXTERN void node_draw_links (Node* self,
                      cairo_t* ctx,
                      Theme* theme);
VALA_EXTERN void node_groups_draw_all (NodeGroups* self,
                           cairo_t* ctx,
                           Theme* theme,
                           gboolean exporting);
VALA_EXTERN void node_draw_all (Node* self,
                    cairo_t* ctx,
                    Theme* theme,
                    Node* current,
                    gboolean motion,
                    gboolean exporting);
VALA_EXTERN Node* node_folded_ancestor (Node* self);
VALA_EXTERN gboolean mind_map_is_node_editable (MindMap* self);
VALA_EXTERN void connections_draw_all (Connections* self,
                           cairo_t* ctx,
                           Theme* theme,
                           gboolean exporting);
VALA_EXTERN void connection_draw (Connection* self,
                      cairo_t* ctx,
                      Theme* theme,
                      gboolean exporting);
VALA_EXTERN void stickers_draw_all (Stickers* self,
                        cairo_t* ctx,
                        Theme* theme,
                        gdouble opacity,
                        gboolean exporting);
VALA_EXTERN void map_model_get_nodes_within_rectangle (MapModel* self,
                                           GdkRectangle* box,
                                           GArray* nodes);
VALA_EXTERN void node_get_nodes_within_box (Node* self,
                                GdkRectangle* box,
                                GArray* nodes);
VALA_EXTERN gboolean map_model_update_last_match (MapModel* self,
                                      Node* match);
VALA_EXTERN void node_set_show_fold (Node* self,
                         gboolean value);
VALA_EXTERN void map_model_attach_current_node (MapModel* self);
VALA_EXTERN Style* style_new (void);
VALA_EXTERN Style* style_construct (GType object_type);
VALA_EXTERN gint node_index (Node* self);
VALA_EXTERN gint summary_node_node_index (SummaryNode* self,
                              Node* node);
VALA_EXTERN void node_detach (Node* self,
                  NodeSide side);
VALA_EXTERN NodeSide draw_area_get_orig_side (DrawArea* self);
VALA_EXTERN void summary_node_remove_node (SummaryNode* self,
                               Node* node);
VALA_EXTERN gboolean node_first_summarized (Node* self);
VALA_EXTERN void node_attach (Node* self,
                  Node* parent,
                  gint idx,
                  Theme* theme,
                  gboolean set_side);
VALA_EXTERN void summary_node_add_node (SummaryNode* self,
                            Node* node);
VALA_EXTERN void map_model_set_style_after_parent_attach (MapModel* self,
                                              Node* node);
VALA_EXTERN GType node_info_get_type (void) G_GNUC_CONST ;
VALA_EXTERN NodeInfo* node_info_dup (const NodeInfo* self);
VALA_EXTERN void node_info_free (NodeInfo* self);
VALA_EXTERN GArray* draw_area_get_orig_info (DrawArea* self);
VALA_EXTERN UndoNodeAttach* undo_node_attach_new_for_root (Node* n,
                                               gint old_index,
                                               GArray* old_info,
                                               Style* old_style);
VALA_EXTERN UndoNodeAttach* undo_node_attach_construct_for_root (GType object_type,
                                                     Node* n,
                                                     gint old_index,
                                                     GArray* old_info,
                                                     Style* old_style);
VALA_EXTERN GType undo_node_attach_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeAttach, g_object_unref)
VALA_EXTERN UndoNodeAttach* undo_node_attach_new (Node* n,
                                      Node* old_parent,
                                      NodeSide old_side,
                                      gint old_index,
                                      GArray* old_info,
                                      SummaryNode* old_summary,
                                      gint old_summary_index,
                                      Style* old_style);
VALA_EXTERN UndoNodeAttach* undo_node_attach_construct (GType object_type,
                                            Node* n,
                                            Node* old_parent,
                                            NodeSide old_side,
                                            gint old_index,
                                            GArray* old_info,
                                            SummaryNode* old_summary,
                                            gint old_summary_index,
                                            Style* old_style);
VALA_EXTERN void map_model_attach_nodes (MapModel* self,
                             GArray* nodes,
                             Node* parent);
VALA_EXTERN void node_return_to_position (Node* self);
VALA_EXTERN void node_make_children_siblings (Node* self);
VALA_EXTERN NodeSide node_get_side (Node* self);
VALA_EXTERN Node* node_previous_sibling (Node* self,
                             gboolean wrap);
VALA_EXTERN gboolean node_main_branch (Node* self);
VALA_EXTERN void node_set_style (Node* self,
                     Style* value);
VALA_EXTERN gboolean map_model_sibling_exists (MapModel* self,
                                   Node* node);
VALA_EXTERN gboolean map_model_sequences_togglable (MapModel* self);
VALA_EXTERN void map_model_toggle_sequence (MapModel* self);
VALA_EXTERN gboolean node_get_sequence (Node* self);
VALA_EXTERN void node_set_sequence (Node* self,
                        gboolean value);
VALA_EXTERN UndoNodeSequences* undo_node_sequences_new (GArray* nodes);
VALA_EXTERN UndoNodeSequences* undo_node_sequences_construct (GType object_type,
                                                  GArray* nodes);
VALA_EXTERN GType undo_node_sequences_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeSequences, g_object_unref)
VALA_EXTERN void map_model_delete_node (MapModel* self);
VALA_EXTERN Node* mind_map_next_node_to_select (MindMap* self);
static void _vala_Connection_free_function_content_of (gpointer data);
VALA_EXTERN GType undo_node_groups_get_type (void) G_GNUC_CONST ;
VALA_EXTERN UndoNodeGroups* undo_node_groups_dup (const UndoNodeGroups* self);
VALA_EXTERN void undo_node_groups_free (UndoNodeGroups* self);
VALA_EXTERN void undo_node_groups_copy (const UndoNodeGroups* self,
                            UndoNodeGroups* dest);
VALA_EXTERN void undo_node_groups_destroy (UndoNodeGroups* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (UndoNodeGroups, undo_node_groups_destroy)
VALA_EXTERN void connections_node_deleted (Connections* self,
                               Node* node,
                               GArray* conns);
VALA_EXTERN void node_groups_remove_node (NodeGroups* self,
                              Node* node,
                              UndoNodeGroups** affected);
VALA_EXTERN UndoNodeDelete* undo_node_delete_new (Node* n,
                                      gint index,
                                      GArray* conns,
                                      UndoNodeGroups* groups);
VALA_EXTERN UndoNodeDelete* undo_node_delete_construct (GType object_type,
                                            Node* n,
                                            gint index,
                                            GArray* conns,
                                            UndoNodeGroups* groups);
VALA_EXTERN GType undo_node_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeDelete, g_object_unref)
VALA_EXTERN gboolean node_is_summary (Node* self);
VALA_EXTERN UndoNodeSummaryDelete* undo_node_summary_delete_new (SummaryNode* n,
                                                     GArray* conns,
                                                     UndoNodeGroups* groups);
VALA_EXTERN UndoNodeSummaryDelete* undo_node_summary_delete_construct (GType object_type,
                                                           SummaryNode* n,
                                                           GArray* conns,
                                                           UndoNodeGroups* groups);
VALA_EXTERN GType undo_node_summary_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeSummaryDelete, g_object_unref)
VALA_EXTERN void node_delete (Node* self);
VALA_EXTERN gboolean selection_remove_node (Selection* self,
                                Node* node,
                                gdouble alpha,
                                gboolean signal_change);
VALA_EXTERN gboolean mind_map_select_node (MindMap* self,
                               Node* n,
                               gboolean animate);
VALA_EXTERN void map_model_delete_nodes (MapModel* self);
VALA_EXTERN MindMap* map_model_get_map (MapModel* self);
VALA_EXTERN MapModel* mind_map_get_model (MindMap* self);
VALA_EXTERN GArray* selection_ordered_nodes (Selection* self);
VALA_EXTERN void connections_node_only_deleted (Connections* self,
                                    Node* node,
                                    GArray* conns);
VALA_EXTERN void node_groups_remove_nodes (NodeGroups* self,
                               GArray* nodes,
                               GArray** affected);
VALA_EXTERN UndoNodesDelete* undo_nodes_delete_new (GArray* nodes,
                                        GArray* conns,
                                        GArray* groups,
                                        const gchar* label);
VALA_EXTERN UndoNodesDelete* undo_nodes_delete_construct (GType object_type,
                                              GArray* nodes,
                                              GArray* conns,
                                              GArray* groups,
                                              const gchar* label);
VALA_EXTERN GType undo_nodes_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesDelete, g_object_unref)
VALA_EXTERN void node_delete_only (Node* self);
VALA_EXTERN gboolean selection_clear_nodes (Selection* self,
                                gboolean signal_change,
                                gdouble alpha);
VALA_EXTERN void map_model_remove_sticker (MapModel* self);
VALA_EXTERN Sticker* selection_current_sticker (Selection* self);
VALA_EXTERN UndoStickerRemove* undo_sticker_remove_new (Sticker* sticker);
VALA_EXTERN UndoStickerRemove* undo_sticker_remove_construct (GType object_type,
                                                  Sticker* sticker);
VALA_EXTERN GType undo_sticker_remove_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoStickerRemove, g_object_unref)
VALA_EXTERN void stickers_remove_sticker (Stickers* self,
                              Sticker* sticker);
VALA_EXTERN gboolean selection_remove_sticker (Selection* self,
                                   Sticker* sticker,
                                   gdouble alpha);
VALA_EXTERN UndoNodeStickerRemove* undo_node_sticker_remove_new (Node* node);
VALA_EXTERN UndoNodeStickerRemove* undo_node_sticker_remove_construct (GType object_type,
                                                           Node* node);
VALA_EXTERN GType undo_node_sticker_remove_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeStickerRemove, g_object_unref)
VALA_EXTERN void node_set_sticker (Node* self,
                       const gchar* value);
VALA_EXTERN UndoConnectionStickerRemove* undo_connection_sticker_remove_new (Connection* conn);
VALA_EXTERN UndoConnectionStickerRemove* undo_connection_sticker_remove_construct (GType object_type,
                                                                       Connection* conn);
VALA_EXTERN GType undo_connection_sticker_remove_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectionStickerRemove, g_object_unref)
VALA_EXTERN void connection_set_sticker (Connection* self,
                             const gchar* value);
VALA_EXTERN void map_model_position_root_node (MapModel* self,
                                   Node* node);
VALA_EXTERN void node_set_posx (Node* self,
                    gdouble value);
VALA_EXTERN void node_set_posy (Node* self,
                    gdouble value);
VALA_EXTERN void layout_position_root (Layout* self,
                           Node* last,
                           Node* n);
VALA_EXTERN Node* map_model_create_root_node (MapModel* self,
                                  const gchar* name);
VALA_EXTERN Layout* layouts_get_default (Layouts* self);
VALA_EXTERN Node* node_new_with_name (MindMap* map,
                          const gchar* n,
                          Layout* layout);
VALA_EXTERN Node* node_construct_with_name (GType object_type,
                                MindMap* map,
                                const gchar* n,
                                Layout* layout);
VALA_EXTERN void style_set_node_padding (Style* self,
                             gint value);
VALA_EXTERN Node* map_model_create_main_node (MapModel* self,
                                  Node* root,
                                  NodeSide side,
                                  const gchar* name);
VALA_EXTERN void node_set_side (Node* self,
                    NodeSide value);
VALA_EXTERN gint node_side_count (Node* self,
                      NodeSide side);
VALA_EXTERN Node* map_model_create_sibling_node (MapModel* self,
                                     Node* sibling,
                                     gboolean below,
                                     const gchar* name);
VALA_EXTERN Node* map_model_create_parent_node (MapModel* self,
                                    Node* child,
                                    const gchar* name);
VALA_EXTERN Node* map_model_create_child_node (MapModel* self,
                                   Node* parent,
                                   const gchar* name);
VALA_EXTERN void node_set_folded (Node* self,
                      gboolean value);
VALA_EXTERN Node* map_model_create_summary_node (MapModel* self,
                                     GArray* nodes);
VALA_EXTERN SummaryNode* summary_node_new (MindMap* map,
                               Layout* layout);
VALA_EXTERN SummaryNode* summary_node_construct (GType object_type,
                                     MindMap* map,
                                     Layout* layout);
VALA_EXTERN void summary_node_attach_nodes (SummaryNode* self,
                                Node* p,
                                GArray* nodes,
                                gboolean sort,
                                Theme* theme);
VALA_EXTERN Node* map_model_create_summary_node_from_node (MapModel* self,
                                               Node* node);
VALA_EXTERN SummaryNode* summary_node_new_from_node (MindMap* map,
                                         Node* node,
                                         ImageManager* im);
VALA_EXTERN SummaryNode* summary_node_construct_from_node (GType object_type,
                                               MindMap* map,
                                               Node* node,
                                               ImageManager* im);
VALA_EXTERN void summary_node_attach_siblings (SummaryNode* self,
                                   Node* node,
                                   Theme* theme);
VALA_EXTERN void map_model_add_root_node (MapModel* self);
VALA_EXTERN UndoNodeInsert* undo_node_insert_new (Node* n,
                                      gint index);
VALA_EXTERN UndoNodeInsert* undo_node_insert_construct (GType object_type,
                                            Node* n,
                                            gint index);
VALA_EXTERN GType undo_node_insert_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeInsert, g_object_unref)
VALA_EXTERN void map_model_add_connected_node (MapModel* self);
VALA_EXTERN Connection* connection_new (MindMap* map,
                            Node* from_node);
VALA_EXTERN Connection* connection_construct (GType object_type,
                                  MindMap* map,
                                  Node* from_node);
VALA_EXTERN void connection_connect_to (Connection* self,
                            Node* node);
VALA_EXTERN void connections_add_connection (Connections* self,
                                 Connection* conn);
VALA_EXTERN UndoConnectedNode* undo_connected_node_new (Node* node,
                                            gint index,
                                            Connection* conn);
VALA_EXTERN UndoConnectedNode* undo_connected_node_construct (GType object_type,
                                                  Node* node,
                                                  gint index,
                                                  Connection* conn);
VALA_EXTERN GType undo_connected_node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectedNode, g_object_unref)
VALA_EXTERN void map_model_add_sibling_node (MapModel* self,
                                 gboolean shift);
VALA_EXTERN void map_model_add_parent_node (MapModel* self);
VALA_EXTERN UndoNodeAddParent* undo_node_add_parent_new (Node* parent,
                                             Node* child);
VALA_EXTERN UndoNodeAddParent* undo_node_add_parent_construct (GType object_type,
                                                   Node* parent,
                                                   Node* child);
VALA_EXTERN GType undo_node_add_parent_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeAddParent, g_object_unref)
VALA_EXTERN void map_model_add_child_node (MapModel* self);
VALA_EXTERN gboolean map_model_nodes_summarizable (MapModel* self);
VALA_EXTERN gboolean map_model_node_summarizable (MapModel* self);
VALA_EXTERN void map_model_add_summary_node_from_selected (MapModel* self);
VALA_EXTERN UndoNodeSummary* undo_node_summary_new (SummaryNode* n);
VALA_EXTERN UndoNodeSummary* undo_node_summary_construct (GType object_type,
                                              SummaryNode* n);
VALA_EXTERN GType undo_node_summary_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeSummary, g_object_unref)
VALA_EXTERN void map_model_add_summary_node_from_current (MapModel* self);
VALA_EXTERN UndoNodeSummaryFromNode* undo_node_summary_from_node_new (Node* n,
                                                          SummaryNode* sn);
VALA_EXTERN UndoNodeSummaryFromNode* undo_node_summary_from_node_construct (GType object_type,
                                                                Node* n,
                                                                SummaryNode* sn);
VALA_EXTERN GType undo_node_summary_from_node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeSummaryFromNode, g_object_unref)
VALA_EXTERN void map_model_replace_node (MapModel* self,
                             Node* orig_node,
                             Node* new_node);
VALA_EXTERN gint map_model_root_index (MapModel* self,
                           Node* root);
VALA_EXTERN void map_model_remove_root_node (MapModel* self,
                                 Node* node);
VALA_EXTERN void map_model_add_root (MapModel* self,
                         Node* n,
                         gint index);
VALA_EXTERN void map_model_remove_root (MapModel* self,
                            gint index);
VALA_EXTERN gboolean map_model_detachable (MapModel* self);
VALA_EXTERN void map_model_detach (MapModel* self);
VALA_EXTERN UndoNodeDetach* undo_node_detach_new (Node* n,
                                      gint root_index,
                                      Node* old_parent,
                                      NodeSide old_side,
                                      gint old_index);
VALA_EXTERN UndoNodeDetach* undo_node_detach_construct (GType object_type,
                                            Node* n,
                                            gint root_index,
                                            Node* old_parent,
                                            NodeSide old_side,
                                            gint old_index);
VALA_EXTERN GType undo_node_detach_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeDetach, g_object_unref)
VALA_EXTERN Node* node_get_root (Node* self);
VALA_EXTERN UndoNodeBalance* undo_node_balance_new (MindMap* map,
                                        Node* root_node);
VALA_EXTERN UndoNodeBalance* undo_node_balance_construct (GType object_type,
                                              MindMap* map,
                                              Node* root_node);
VALA_EXTERN GType undo_node_balance_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeBalance, g_object_unref)
VALA_EXTERN GType partitioner_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Partitioner, g_object_unref)
VALA_EXTERN Partitioner* partitioner_new (void);
VALA_EXTERN Partitioner* partitioner_construct (GType object_type);
VALA_EXTERN void partitioner_partition_node (Partitioner* self,
                                 Node* root);
VALA_EXTERN void animator_add_node (Animator* self,
                        Node* n,
                        const gchar* name);
VALA_EXTERN gboolean map_model_completed_tasks_foldable (MapModel* self);
VALA_EXTERN gboolean node_completed_tasks_foldable (Node* self);
VALA_EXTERN void map_model_fold_completed_tasks (MapModel* self);
VALA_EXTERN void node_fold_completed_tasks (Node* self,
                                GArray* changed);
VALA_EXTERN gboolean map_model_unfoldable (MapModel* self);
VALA_EXTERN gboolean node_unfoldable (Node* self);
VALA_EXTERN void map_model_unfold_all_nodes (MapModel* self);
VALA_EXTERN Node* map_model_get_select_parent (MapModel* self,
                                   Node* node);
VALA_EXTERN Node* summary_node_get_last_selected_node (SummaryNode* self);
VALA_EXTERN Node* summary_node_first_node (SummaryNode* self);
VALA_EXTERN Node* map_model_get_node_right (MapModel* self,
                                Node* node);
VALA_EXTERN gboolean node_side_horizontal (NodeSide self);
VALA_EXTERN Node* node_get_last_selected_child (Node* self);
VALA_EXTERN Node* map_model_get_node_left (MapModel* self,
                               Node* node);
VALA_EXTERN Node* map_model_get_node_up (MapModel* self,
                             Node* node);
VALA_EXTERN gboolean node_side_vertical (NodeSide self);
VALA_EXTERN Node* map_model_get_node_down (MapModel* self,
                               Node* node);
VALA_EXTERN Node* map_model_get_node_pageup (MapModel* self,
                                 Node* node);
VALA_EXTERN Node* map_model_get_node_pagedn (MapModel* self,
                                 Node* node);
VALA_EXTERN gboolean map_model_node_copyable (MapModel* self);
VALA_EXTERN gboolean map_model_node_cuttable (MapModel* self);
VALA_EXTERN gboolean map_model_node_pasteable (MapModel* self);
VALA_EXTERN gboolean minder_clipboard_node_pasteable (void);
VALA_EXTERN gboolean map_model_nodes_alignable (MapModel* self);
VALA_EXTERN const gchar* layout_get_name (Layout* self);
VALA_EXTERN gchar* map_model_serialize_for_copy (MapModel* self,
                                     GArray* nodes,
                                     Connections* conns,
                                     NodeGroups* groups);
VALA_EXTERN void node_links_get_links_from_node (NodeLinks* self,
                                     Node* node,
                                     NodeLinks* doc_links);
VALA_EXTERN void connections_save_if_in_node (Connections* self,
                                  xmlNode* parent,
                                  Node* node,
                                  NodeLinks* save_links,
                                  NodeLinks* doc_links);
VALA_EXTERN void node_groups_save_if_in_node (NodeGroups* self,
                                  xmlNode* parent,
                                  Node* node);
VALA_EXTERN xmlNode* node_link_save (NodeLink* self);
VALA_EXTERN gint node_links_num_links (NodeLinks* self);
VALA_EXTERN void map_model_deserialize_for_paste (MapModel* self,
                                      const gchar* str,
                                      GArray* nodes,
                                      GArray* conns,
                                      GArray* groups);
VALA_EXTERN void node_links_set_links_in_node (NodeLinks* self,
                                   Node* node,
                                   NodeLinks* doc_links);
VALA_EXTERN void connections_set_links_in_notes (Connections* self,
                                     Node* node,
                                     NodeLinks* links,
                                     NodeLinks* doc_links);
VALA_EXTERN void node_reassign_ids (Node* self);
VALA_EXTERN NodeLink* map_model_deserialize_for_node_link (const gchar* str);
VALA_EXTERN NodeLink* node_link_new_from_xml (xmlNode* node);
VALA_EXTERN NodeLink* node_link_construct_from_xml (GType object_type,
                                        xmlNode* node);
VALA_EXTERN void map_model_get_nodes_for_clipboard (MapModel* self,
                                        GArray** nodes,
                                        Connections** conns,
                                        NodeGroups** groups);
VALA_EXTERN void selection_get_subtrees (Selection* self,
                             GArray** subtrees,
                             ImageManager* im);
VALA_EXTERN void map_model_copy_selected_text (MapModel* self);
VALA_EXTERN CanvasText* mind_map_get_current_text (MindMap* self);
VALA_EXTERN void minder_clipboard_copy_text (const gchar* txt);
VALA_EXTERN gchar* canvas_text_get_selected_text (CanvasText* self);
VALA_EXTERN void map_model_do_copy (MapModel* self);
VALA_EXTERN void minder_clipboard_copy_nodes (MindMap* map);
VALA_EXTERN gboolean mind_map_is_connection_editable (MindMap* self);
VALA_EXTERN gboolean mind_map_is_callout_editable (MindMap* self);
VALA_EXTERN void map_model_cut_node_to_clipboard (MapModel* self);
VALA_EXTERN UndoNodeCut* undo_node_cut_new (Node* n,
                                gint index,
                                GArray* conns,
                                UndoNodeGroups* groups);
VALA_EXTERN UndoNodeCut* undo_node_cut_construct (GType object_type,
                                      Node* n,
                                      gint index,
                                      GArray* conns,
                                      UndoNodeGroups* groups);
VALA_EXTERN GType undo_node_cut_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeCut, g_object_unref)
VALA_EXTERN void map_model_cut_selected_nodes_to_clipboard (MapModel* self);
VALA_EXTERN UndoNodesCut* undo_nodes_cut_new (GArray* nodes,
                                  GArray* conns,
                                  GArray* groups);
VALA_EXTERN UndoNodesCut* undo_nodes_cut_construct (GType object_type,
                                        GArray* nodes,
                                        GArray* conns,
                                        GArray* groups);
VALA_EXTERN GType undo_nodes_cut_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesCut, g_object_unref)
VALA_EXTERN void map_model_cut_selected_text (MapModel* self);
VALA_EXTERN void canvas_text_insert (CanvasText* self,
                         const gchar* s,
                         UndoTextBuffer* undo_buffer);
VALA_EXTERN void map_model_do_cut (MapModel* self);
static void map_model_replace_node_text (MapModel* self,
                                  Node* node,
                                  const gchar* text);
VALA_EXTERN void formatted_text_replace_text (FormattedText* self,
                                  gint index,
                                  gint chars,
                                  const gchar* str);
static void map_model_replace_connection_text (MapModel* self,
                                        Connection* conn,
                                        const gchar* text);
static void map_model_replace_callout_text (MapModel* self,
                                     Callout* callout,
                                     const gchar* text);
static void map_model_replace_node_image (MapModel* self,
                                   Node* node,
                                   GdkPixbuf* image);
VALA_EXTERN NodeImage* node_image_new_from_pixbuf (ImageManager* im,
                                       GdkPixbuf* buf,
                                       gint width);
VALA_EXTERN NodeImage* node_image_construct_from_pixbuf (GType object_type,
                                             ImageManager* im,
                                             GdkPixbuf* buf,
                                             gint width);
VALA_EXTERN gboolean node_image_get_valid (NodeImage* self);
static void map_model_replace_node_xml (MapModel* self,
                                 Node* node,
                                 const gchar* text);
static void _vala_NodeGroup_free_function_content_of (gpointer data);
VALA_EXTERN UndoNodesReplace* undo_nodes_replace_new (Node* orig_node,
                                          GArray* new_nodes);
VALA_EXTERN UndoNodesReplace* undo_nodes_replace_construct (GType object_type,
                                                Node* orig_node,
                                                GArray* new_nodes);
VALA_EXTERN GType undo_nodes_replace_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesReplace, g_object_unref)
VALA_EXTERN gboolean map_model_insert_text_as_node (MapModel* self,
                                        Node* node,
                                        const gchar* text);
VALA_EXTERN gpointer export_ref (gpointer instance);
VALA_EXTERN void export_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_export (const gchar* name,
                               const gchar* nick,
                               const gchar* blurb,
                               GType object_type,
                               GParamFlags flags);
VALA_EXTERN void value_set_export (GValue* value,
                       gpointer v_object);
VALA_EXTERN void value_take_export (GValue* value,
                        gpointer v_object);
VALA_EXTERN gpointer value_get_export (const GValue* value);
VALA_EXTERN GType export_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Export, export_unref)
VALA_EXTERN GType export_text_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ExportText, export_unref)
VALA_EXTERN gpointer exports_ref (gpointer instance);
VALA_EXTERN void exports_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_exports (const gchar* name,
                                const gchar* nick,
                                const gchar* blurb,
                                GType object_type,
                                GParamFlags flags);
VALA_EXTERN void value_set_exports (GValue* value,
                        gpointer v_object);
VALA_EXTERN void value_take_exports (GValue* value,
                         gpointer v_object);
VALA_EXTERN gpointer value_get_exports (const GValue* value);
VALA_EXTERN GType exports_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Exports, exports_unref)
VALA_EXTERN Exports* main_window_get_exports (MainWindow* self);
VALA_EXTERN Export* exports_get_by_name (Exports* self,
                             const gchar* name);
VALA_EXTERN void export_text_import_text (ExportText* self,
                              const gchar* txt,
                              gint tab_spaces,
                              MindMap* map,
                              gboolean replace,
                              GArray* nodes);
VALA_EXTERN UndoNodesInsert* undo_nodes_insert_new (MindMap* map,
                                        GArray* nodes);
VALA_EXTERN UndoNodesInsert* undo_nodes_insert_construct (GType object_type,
                                              MindMap* map,
                                              GArray* nodes);
VALA_EXTERN GType undo_nodes_insert_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesInsert, g_object_unref)
VALA_EXTERN gboolean map_model_replace_text_as_node (MapModel* self,
                                         Node* node,
                                         const gchar* text);
static void map_model_paste_image_as_node (MapModel* self,
                                    Node* node,
                                    GdkPixbuf* image);
static void map_model_paste_as_nodes (MapModel* self,
                               Node* node,
                               const gchar* text);
VALA_EXTERN void layout_propagate_side (Layout* self,
                            Node* parent,
                            NodeSide side);
VALA_EXTERN UndoNodePaste* undo_node_paste_new (GArray* nodes,
                                    GArray* conns,
                                    GArray* groups);
VALA_EXTERN UndoNodePaste* undo_node_paste_construct (GType object_type,
                                          GArray* nodes,
                                          GArray* conns,
                                          GArray* groups);
VALA_EXTERN GType undo_node_paste_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodePaste, g_object_unref)
VALA_EXTERN void map_model_paste_text (MapModel* self,
                           const gchar* text,
                           gboolean shift);
VALA_EXTERN Callout* mind_map_get_current_callout (MindMap* self);
VALA_EXTERN void map_model_paste_node_link (MapModel* self,
                                const gchar* text);
VALA_EXTERN void map_model_paste_image (MapModel* self,
                            GdkPixbuf* image,
                            gboolean shift);
VALA_EXTERN void map_model_paste_nodes (MapModel* self,
                            const gchar* text,
                            gboolean shift);
VALA_EXTERN gboolean mind_map_get_editable (MindMap* self);
static gboolean map_model_do_auto_save (MapModel* self);
static gboolean _map_model_do_auto_save_gsource_func (gpointer self);
static guint* _uint_dup (guint* self);
VALA_EXTERN gboolean map_model_update_current_image (MapModel* self,
                                         const gchar* uri);
VALA_EXTERN NodeImage* node_image_new_from_uri (ImageManager* im,
                                    const gchar* uri,
                                    gint width);
VALA_EXTERN NodeImage* node_image_construct_from_uri (GType object_type,
                                          ImageManager* im,
                                          const gchar* uri,
                                          gint width);
VALA_EXTERN gboolean connections_get_hide (Connections* self);
VALA_EXTERN void node_bbox (Node* self,
                gdouble* x,
                gdouble* y,
                gdouble* w,
                gdouble* h);
VALA_EXTERN void connection_draw_to (Connection* self,
                         gdouble x,
                         gdouble y);
VALA_EXTERN gdouble draw_area_get_press_x (DrawArea* self);
VALA_EXTERN gdouble draw_area_get_press_y (DrawArea* self);
VALA_EXTERN void map_model_update_connection_by_node (MapModel* self,
                                          Node* node);
VALA_EXTERN void map_model_end_connection (MapModel* self,
                               Node* n);
VALA_EXTERN UndoConnectionAdd* undo_connection_add_new (Connection* connection);
VALA_EXTERN UndoConnectionAdd* undo_connection_add_construct (GType object_type,
                                                  Connection* connection);
VALA_EXTERN GType undo_connection_add_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectionAdd, g_object_unref)
VALA_EXTERN void map_model_handle_connection_edit_on_creation (MapModel* self,
                                                   Connection* conn);
VALA_EXTERN void map_model_create_connection (MapModel* self);
VALA_EXTERN void map_model_delete_connection (MapModel* self);
VALA_EXTERN UndoConnectionDelete* undo_connection_delete_new (Connection* connection);
VALA_EXTERN UndoConnectionDelete* undo_connection_delete_construct (GType object_type,
                                                        Connection* connection);
VALA_EXTERN GType undo_connection_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectionDelete, g_object_unref)
VALA_EXTERN gboolean connections_remove_connection (Connections* self,
                                        Connection* conn,
                                        gboolean disconnect);
VALA_EXTERN gboolean selection_remove_connection (Selection* self,
                                      Connection* conn,
                                      gdouble alpha);
VALA_EXTERN void map_model_delete_connections (MapModel* self);
VALA_EXTERN gint selection_num_connections (Selection* self);
VALA_EXTERN UndoConnectionsDelete* undo_connections_delete_new (GArray* conns);
VALA_EXTERN UndoConnectionsDelete* undo_connections_delete_construct (GType object_type,
                                                          GArray* conns);
VALA_EXTERN GType undo_connections_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoConnectionsDelete, g_object_unref)
static void map_model_sort_children (MapModel* self,
                              Node* parent,
                              GCompareFunc sort_fn);
static Block42Data* block42_data_ref (Block42Data* _data42_);
static void block42_data_unref (void * _userdata_);
VALA_EXTERN UndoNodeSort* undo_node_sort_new (Node* parent);
VALA_EXTERN UndoNodeSort* undo_node_sort_construct (GType object_type,
                                        Node* parent);
VALA_EXTERN GType undo_node_sort_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodeSort, g_object_unref)
static void __lambda110_ (MapModel* self,
                   Node* child);
static void ___lambda110__gfunc (gconstpointer data,
                          gpointer self);
static void __lambda111_ (Block42Data* _data42_,
                   Node* child);
static void ___lambda111__gfunc (gconstpointer data,
                          gpointer self);
static inline void _g_slist_free__g_object_unref0_ (GSList* self);
VALA_EXTERN void map_model_sort_alphabetically (MapModel* self);
static gint __lambda109_ (Node* a,
                   Node* b);
static gint ___lambda109__gcompare_func (gconstpointer a,
                                  gconstpointer b);
VALA_EXTERN void map_model_sort_randomly (MapModel* self);
static gint __lambda112_ (Node* a,
                   Node* b);
static gint ___lambda112__gcompare_func (gconstpointer a,
                                  gconstpointer b);
VALA_EXTERN void map_model_handle_tree_overlap (MapModel* self,
                                    NodeBounds* prev);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN void map_model_handle_tree_overlap_helper (MapModel* self,
                                           Node* root,
                                           NodeBounds* prev,
                                           GList* visited);
VALA_EXTERN gboolean node_bounds_overlaps (NodeBounds* self,
                               NodeBounds* other);
VALA_EXTERN NodeBounds* node_bounds_new_copy (NodeBounds* nb);
VALA_EXTERN NodeBounds* node_bounds_construct_copy (GType object_type,
                                        NodeBounds* nb);
VALA_EXTERN gboolean node_is_left_of (Node* self,
                          NodeBounds* nb);
VALA_EXTERN gboolean node_is_right_of (Node* self,
                           NodeBounds* nb);
VALA_EXTERN gboolean node_is_above (Node* self,
                        NodeBounds* nb);
VALA_EXTERN gboolean node_is_below (Node* self,
                        NodeBounds* nb);
VALA_EXTERN Node* map_model_get_droppable_node (MapModel* self,
                                    gdouble x,
                                    gdouble y);
VALA_EXTERN void map_model_get_droppable (MapModel* self,
                              gdouble x,
                              gdouble y,
                              Node** node,
                              Connection** conn,
                              Sticker** sticker);
VALA_EXTERN Connection* connections_within_title_box (Connections* self,
                                          gdouble x,
                                          gdouble y);
VALA_EXTERN void map_model_set_layouts (MapModel* self,
                            Layouts* value);
VALA_EXTERN void map_model_set_image_manager (MapModel* self,
                                  ImageManager* value);
VALA_EXTERN gboolean map_model_get_is_loaded (MapModel* self);
VALA_EXTERN gboolean map_model_get_braindump_shown (MapModel* self);
VALA_EXTERN void map_model_set_braindump_shown (MapModel* self,
                                    gboolean value);
VALA_EXTERN Connections* map_model_get_connections (MapModel* self);
VALA_EXTERN Stickers* map_model_get_stickers (MapModel* self);
VALA_EXTERN NodeLinks* map_model_get_node_links (MapModel* self);
VALA_EXTERN gint map_model_get_next_node_id (MapModel* self);
VALA_EXTERN void map_model_set_next_node_id (MapModel* self,
                                 gint value);
VALA_EXTERN gboolean map_model_get_hide_callouts (MapModel* self);
VALA_EXTERN void map_model_set_hide_callouts (MapModel* self,
                                  gboolean value);
VALA_EXTERN gboolean selection_clear_callouts (Selection* self,
                                   gboolean signal_change,
                                   gdouble alpha);
VALA_EXTERN void animator_add_callouts_fade (Animator* self,
                                 GArray* n,
                                 gboolean fade_out,
                                 const gchar* name);
VALA_EXTERN Node* map_model_get_attach_node (MapModel* self);
VALA_EXTERN SummaryNode* map_model_get_attach_summary (MapModel* self);
VALA_EXTERN Connection* map_model_get_attach_conn (MapModel* self);
VALA_EXTERN Sticker* map_model_get_attach_sticker (MapModel* self);
VALA_EXTERN GArray* map_model_get_braindump (MapModel* self);
VALA_EXTERN Node* map_model_get_last_node (MapModel* self);
VALA_EXTERN void map_model_set_last_node (MapModel* self,
                              Node* value);
VALA_EXTERN Tags* map_model_get_tags (MapModel* self);
static void g_cclosure_user_marshal_VOID__BOOLEAN_DOUBLE_DOUBLE (GClosure * closure,
                                                          GValue * return_value,
                                                          guint n_param_values,
                                                          const GValue * param_values,
                                                          gpointer invocation_hint,
                                                          gpointer marshal_data);
static void map_model_finalize (MapModel * obj);
static GType map_model_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

gboolean
map_item_component_is_connection_handle (MapItemComponent self)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	if (self == MAP_ITEM_COMPONENT_DRAG_HANDLE) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = self == MAP_ITEM_COMPONENT_FROM_HANDLE;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self == MAP_ITEM_COMPONENT_TO_HANDLE;
	}
	result = _tmp0_;
	return result;
}

static GType
map_item_component_get_type_once (void)
{
	static const GEnumValue values[] = {{MAP_ITEM_COMPONENT_NONE, "MAP_ITEM_COMPONENT_NONE", "none"}, {MAP_ITEM_COMPONENT_CURVE, "MAP_ITEM_COMPONENT_CURVE", "curve"}, {MAP_ITEM_COMPONENT_TITLE_BOX, "MAP_ITEM_COMPONENT_TITLE_BOX", "title-box"}, {MAP_ITEM_COMPONENT_TITLE, "MAP_ITEM_COMPONENT_TITLE", "title"}, {MAP_ITEM_COMPONENT_NOTE, "MAP_ITEM_COMPONENT_NOTE", "note"}, {MAP_ITEM_COMPONENT_DRAG_HANDLE, "MAP_ITEM_COMPONENT_DRAG_HANDLE", "drag-handle"}, {MAP_ITEM_COMPONENT_FROM_HANDLE, "MAP_ITEM_COMPONENT_FROM_HANDLE", "from-handle"}, {MAP_ITEM_COMPONENT_TO_HANDLE, "MAP_ITEM_COMPONENT_TO_HANDLE", "to-handle"}, {MAP_ITEM_COMPONENT_STICKER, "MAP_ITEM_COMPONENT_STICKER", "sticker"}, {MAP_ITEM_COMPONENT_NODE_LINK, "MAP_ITEM_COMPONENT_NODE_LINK", "node-link"}, {MAP_ITEM_COMPONENT_IMAGE, "MAP_ITEM_COMPONENT_IMAGE", "image"}, {MAP_ITEM_COMPONENT_LINK, "MAP_ITEM_COMPONENT_LINK", "link"}, {MAP_ITEM_COMPONENT_TASK, "MAP_ITEM_COMPONENT_TASK", "task"}, {MAP_ITEM_COMPONENT_FOLD, "MAP_ITEM_COMPONENT_FOLD", "fold"}, {MAP_ITEM_COMPONENT_RESIZER, "MAP_ITEM_COMPONENT_RESIZER", "resizer"}, {MAP_ITEM_COMPONENT_TAGS, "MAP_ITEM_COMPONENT_TAGS", "tags"}, {0, NULL, NULL}};
	GType map_item_component_type_id;
	map_item_component_type_id = g_enum_register_static ("MapItemComponent", values);
	return map_item_component_type_id;
}

GType
map_item_component_get_type (void)
{
	static volatile gsize map_item_component_type_id__once = 0;
	if (g_once_init_enter (&map_item_component_type_id__once)) {
		GType map_item_component_type_id;
		map_item_component_type_id = map_item_component_get_type_once ();
		g_once_init_leave (&map_item_component_type_id__once, map_item_component_type_id);
	}
	return map_item_component_type_id__once;
}

static inline gpointer
map_model_get_instance_private (MapModel* self)
{
	return G_STRUCT_MEMBER_P (self, MapModel_private_offset);
}

static gpointer
_mind_map_ref0 (gpointer self)
{
	return self ? mind_map_ref (self) : NULL;
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static void
_vala_Node_free_function_content_of (gpointer data)
{
	Node* self;
	self = *((Node**) data);
	_g_object_unref0_ (self);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static void
_vala_gchar_free_function_content_of (gpointer data)
{
	gchar* self;
	self = *((gchar**) data);
	_g_free0_ (self);
}

MapModel*
map_model_construct (GType object_type,
                     MindMap* map)
{
	MapModel* self = NULL;
	MindMap* _tmp0_;
	GArray* _tmp1_;
	Connections* _tmp2_;
	Stickers* _tmp3_;
	NodeGroups* _tmp4_;
	NodeLinks* _tmp5_;
	GArray* _tmp6_;
	Tags* _tmp7_;
	Theme* _tmp8_;
	MindMap* _tmp9_;
	MainWindow* _tmp10_;
	MainWindow* _tmp11_;
	Themes* _tmp12_;
	Themes* _tmp13_;
	MindMap* _tmp14_;
	GSettings* _tmp15_;
	GSettings* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	Theme* _tmp19_;
	Theme* _tmp20_;
	g_return_val_if_fail (map != NULL, NULL);
	self = (MapModel*) g_type_create_instance (object_type);
	_tmp0_ = _mind_map_ref0 (map);
	_mind_map_unref0 (self->priv->_map);
	self->priv->_map = _tmp0_;
	_tmp1_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_Node_free_function_content_of);
	_g_array_unref0 (self->priv->_nodes);
	self->priv->_nodes = _tmp1_;
	_tmp2_ = connections_new ();
	_connections_unref0 (self->priv->_connections);
	self->priv->_connections = _tmp2_;
	_tmp3_ = stickers_new ();
	_stickers_unref0 (self->priv->_stickers);
	self->priv->_stickers = _tmp3_;
	_tmp4_ = node_groups_new ();
	_node_groups_unref0 (self->priv->_groups);
	self->priv->_groups = _tmp4_;
	_tmp5_ = node_links_new ();
	_node_links_unref0 (self->priv->_node_links);
	self->priv->_node_links = _tmp5_;
	_tmp6_ = g_array_new (TRUE, TRUE, sizeof (gchar*));
	g_array_set_clear_func (_tmp6_, (GDestroyNotify) _vala_gchar_free_function_content_of);
	_g_array_unref0 (self->priv->_braindump);
	self->priv->_braindump = _tmp6_;
	_tmp7_ = tags_new ();
	_tags_unref0 (self->priv->_tags);
	self->priv->_tags = _tmp7_;
	_tmp8_ = theme_new ();
	_g_object_unref0 (self->priv->_theme);
	self->priv->_theme = _tmp8_;
	_tmp9_ = self->priv->_map;
	_tmp10_ = mind_map_get_win (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = main_window_get_themes (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = self->priv->_map;
	_tmp15_ = mind_map_get_settings (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_settings_get_string (_tmp16_, "default-theme");
	_tmp18_ = _tmp17_;
	_tmp19_ = themes_get_theme (_tmp13_, _tmp18_);
	_tmp20_ = _tmp19_;
	map_model_set_theme (self, _tmp20_, FALSE);
	_g_object_unref0 (_tmp20_);
	_g_free0 (_tmp18_);
	_g_object_unref0 (self->priv->_attach_node);
	self->priv->_attach_node = NULL;
	_g_object_unref0 (self->priv->_attach_summary);
	self->priv->_attach_summary = NULL;
	_g_object_unref0 (self->priv->_attach_conn);
	self->priv->_attach_conn = NULL;
	_g_object_unref0 (self->priv->_attach_sticker);
	self->priv->_attach_sticker = NULL;
	return self;
}

MapModel*
map_model_new (MindMap* map)
{
	return map_model_construct (TYPE_MAP_MODEL, map);
}

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

Theme*
map_model_get_theme (MapModel* self)
{
	Theme* _tmp0_;
	Theme* _tmp1_;
	Theme* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_theme;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

void
map_model_set_theme (MapModel* self,
                     Theme* theme,
                     gboolean save)
{
	Theme* _tmp0_;
	Theme* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (theme != NULL);
	_tmp0_ = self->priv->_theme;
	if (_tmp0_ == theme) {
		return;
	}
	formatted_text_set_theme (theme);
	map_model_update_theme_colors (self, theme);
	_tmp1_ = _g_object_ref0 (theme);
	_g_object_unref0 (self->priv->_theme);
	self->priv->_theme = _tmp1_;
	map_model_update_css (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_THEME_CHANGED_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	if (save) {
		map_model_auto_save (self);
	}
}

void
map_model_update_css (MapModel* self)
{
	GdkDisplay* _tmp0_;
	Theme* _tmp1_;
	MindMap* _tmp2_;
	MainWindow* _tmp3_;
	MainWindow* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	GtkCssProvider* _tmp7_;
	GtkCssProvider* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gdk_display_get_default ();
	_tmp1_ = self->priv->_theme;
	_tmp2_ = self->priv->_map;
	_tmp3_ = mind_map_get_win (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = main_window_get_text_size (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = theme_get_css_provider (_tmp1_, _tmp6_);
	_tmp8_ = _tmp7_;
	gtk_style_context_add_provider_for_display (_tmp0_, (GtkStyleProvider*) _tmp8_, (guint) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
	_g_object_unref0 (_tmp8_);
}

static void
map_model_update_theme_colors (MapModel* self,
                               Theme* new_theme)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (new_theme != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				Theme* _tmp5_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = self->priv->_theme;
				node_update_theme_colors (_tmp4_, _tmp5_, new_theme);
			}
		}
	}
}

void
map_model_set_layout (MapModel* self,
                      const gchar* name,
                      Node* root_node,
                      gboolean undoable)
{
	Layout* _tmp0_ = NULL;
	Layout* old_layout = NULL;
	Layout* _tmp7_;
	Layout* new_layout = NULL;
	Layouts* _tmp8_;
	Layout* _tmp9_;
	gboolean old_balanceable = FALSE;
	Layout* _tmp15_;
	gboolean _tmp16_;
	gboolean _tmp17_;
	MindMap* _tmp18_;
	Animator* _tmp19_;
	Animator* _tmp20_;
	GArray* _tmp21_;
	gboolean _tmp33_ = FALSE;
	MindMap* _tmp37_;
	Animator* _tmp38_;
	Animator* _tmp39_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	if (root_node == NULL) {
		GArray* _tmp1_;
		Node* _tmp2_;
		Layout* _tmp3_;
		Layout* _tmp4_;
		_tmp1_ = self->priv->_nodes;
		_tmp2_ = g_array_index (_tmp1_, Node*, (guint) 0);
		_tmp3_ = node_get_layout (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		Layout* _tmp5_;
		Layout* _tmp6_;
		_tmp5_ = node_get_layout (root_node);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_;
	}
	_tmp7_ = _g_object_ref0 (_tmp0_);
	old_layout = _tmp7_;
	_tmp8_ = self->priv->_layouts;
	_tmp9_ = layouts_get_layout (_tmp8_, name);
	new_layout = _tmp9_;
	if (undoable) {
		MindMap* _tmp10_;
		Layout* _tmp11_;
		Layout* _tmp12_;
		UndoNodeLayout* _tmp13_;
		UndoNodeLayout* _tmp14_;
		_tmp10_ = self->priv->_map;
		_tmp11_ = old_layout;
		_tmp12_ = new_layout;
		_tmp13_ = undo_node_layout_new (_tmp11_, _tmp12_, root_node);
		_tmp14_ = _tmp13_;
		mind_map_add_undo (_tmp10_, (UndoItem*) _tmp14_);
		_g_object_unref0 (_tmp14_);
	}
	_tmp15_ = old_layout;
	_tmp16_ = layout_get_balanceable (_tmp15_);
	_tmp17_ = _tmp16_;
	old_balanceable = _tmp17_;
	_tmp18_ = self->priv->_map;
	_tmp19_ = mind_map_get_animator (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = self->priv->_nodes;
	animator_add_nodes (_tmp20_, _tmp21_, FALSE, "set layout");
	if (root_node == NULL) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp22_ = FALSE;
				_tmp22_ = TRUE;
				while (TRUE) {
					GArray* _tmp24_;
					GArray* _tmp25_;
					Node* _tmp26_;
					Layout* _tmp27_;
					Layout* _tmp28_;
					GArray* _tmp29_;
					Node* _tmp30_;
					if (!_tmp22_) {
						gint _tmp23_;
						_tmp23_ = i;
						i = _tmp23_ + 1;
					}
					_tmp22_ = FALSE;
					_tmp24_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp24_->len)) {
						break;
					}
					_tmp25_ = self->priv->_nodes;
					_tmp26_ = g_array_index (_tmp25_, Node*, (guint) i);
					_tmp27_ = new_layout;
					node_set_layout (_tmp26_, _tmp27_);
					_tmp28_ = new_layout;
					_tmp29_ = self->priv->_nodes;
					_tmp30_ = g_array_index (_tmp29_, Node*, (guint) i);
					layout_initialize (_tmp28_, _tmp30_);
				}
			}
		}
	} else {
		Layout* _tmp31_;
		Layout* _tmp32_;
		_tmp31_ = new_layout;
		node_set_layout (root_node, _tmp31_);
		_tmp32_ = new_layout;
		layout_initialize (_tmp32_, root_node);
	}
	if (!old_balanceable) {
		Layout* _tmp34_;
		gboolean _tmp35_;
		gboolean _tmp36_;
		_tmp34_ = new_layout;
		_tmp35_ = layout_get_balanceable (_tmp34_);
		_tmp36_ = _tmp35_;
		_tmp33_ = _tmp36_;
	} else {
		_tmp33_ = FALSE;
	}
	if (_tmp33_) {
		map_model_balance_nodes (self, FALSE, FALSE);
	}
	_tmp37_ = self->priv->_map;
	_tmp38_ = mind_map_get_animator (_tmp37_);
	_tmp39_ = _tmp38_;
	animator_animate (_tmp39_);
	_g_object_unref0 (new_layout);
	_g_object_unref0 (old_layout);
}

void
map_model_update_node_sizes (MapModel* self)
{
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				node_update_tree (_tmp4_);
			}
		}
	}
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
}

static gpointer
_g_array_ref0 (gpointer self)
{
	return self ? g_array_ref (self) : NULL;
}

GArray*
map_model_get_nodes (MapModel* self)
{
	GArray* _tmp0_;
	GArray* _tmp1_;
	GArray* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_nodes;
	_tmp1_ = _g_array_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

Node*
map_model_get_node (MapModel* self,
                    GArray* nodes,
                    gint id)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (nodes != NULL, NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				Node* node = NULL;
				Node* _tmp2_;
				Node* _tmp3_;
				Node* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(((guint) i) < nodes->len)) {
					break;
				}
				_tmp2_ = g_array_index (nodes, Node*, (guint) i);
				_tmp3_ = node_get_node (_tmp2_, id);
				node = _tmp3_;
				_tmp4_ = node;
				if (_tmp4_ != NULL) {
					result = node;
					return result;
				}
				_g_object_unref0 (node);
			}
		}
	}
	result = NULL;
	return result;
}

static void
map_model_load_theme (MapModel* self,
                      xmlNode* n)
{
	Theme* theme = NULL;
	Theme* _tmp0_;
	Theme* _tmp1_;
	MindMap* _tmp2_;
	MainWindow* _tmp3_;
	MainWindow* _tmp4_;
	Themes* _tmp5_;
	Themes* _tmp6_;
	Theme* _tmp7_;
	MindMap* _tmp29_;
	MainWindow* _tmp30_;
	MainWindow* _tmp31_;
	Themes* _tmp32_;
	Themes* _tmp33_;
	Theme* _tmp34_;
	const gchar* _tmp35_;
	const gchar* _tmp36_;
	Theme* _tmp37_;
	MindMap* _tmp38_;
	MainWindow* _tmp39_;
	MainWindow* _tmp40_;
	MindMap* _tmp41_;
	MindMap* _tmp42_;
	MindMap* _tmp43_;
	gboolean _tmp44_;
	g_return_if_fail (self != NULL);
	_tmp0_ = theme_new ();
	theme = _tmp0_;
	_tmp1_ = theme;
	theme_load (_tmp1_, n);
	_tmp2_ = self->priv->_map;
	_tmp3_ = mind_map_get_win (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = main_window_get_themes (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = theme;
	if (!themes_exists (_tmp6_, _tmp7_)) {
		Theme* _tmp8_;
		gboolean _tmp9_;
		gboolean _tmp10_;
		_tmp8_ = theme;
		_tmp9_ = theme_get_custom (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_) {
			Theme* _tmp11_;
			MindMap* _tmp12_;
			MainWindow* _tmp13_;
			MainWindow* _tmp14_;
			Themes* _tmp15_;
			Themes* _tmp16_;
			Theme* _tmp17_;
			const gchar* _tmp18_;
			const gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			MindMap* _tmp22_;
			MainWindow* _tmp23_;
			MainWindow* _tmp24_;
			Themes* _tmp25_;
			Themes* _tmp26_;
			Theme* _tmp27_;
			_tmp11_ = theme;
			_tmp12_ = self->priv->_map;
			_tmp13_ = mind_map_get_win (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = main_window_get_themes (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = theme;
			_tmp18_ = theme_get_name (_tmp17_);
			_tmp19_ = _tmp18_;
			_tmp20_ = themes_uniquify_name (_tmp16_, _tmp19_);
			_tmp21_ = _tmp20_;
			theme_set_name (_tmp11_, _tmp21_);
			_g_free0 (_tmp21_);
			_tmp22_ = self->priv->_map;
			_tmp23_ = mind_map_get_win (_tmp22_);
			_tmp24_ = _tmp23_;
			_tmp25_ = main_window_get_themes (_tmp24_);
			_tmp26_ = _tmp25_;
			_tmp27_ = theme;
			themes_add_theme (_tmp26_, _tmp27_);
		} else {
			Theme* _tmp28_;
			_tmp28_ = theme;
			theme_set_name (_tmp28_, "default");
		}
	}
	_tmp29_ = self->priv->_map;
	_tmp30_ = mind_map_get_win (_tmp29_);
	_tmp31_ = _tmp30_;
	_tmp32_ = main_window_get_themes (_tmp31_);
	_tmp33_ = _tmp32_;
	_tmp34_ = theme;
	_tmp35_ = theme_get_name (_tmp34_);
	_tmp36_ = _tmp35_;
	_tmp37_ = themes_get_theme (_tmp33_, _tmp36_);
	_g_object_unref0 (self->priv->_theme);
	self->priv->_theme = _tmp37_;
	_tmp38_ = self->priv->_map;
	_tmp39_ = mind_map_get_win (_tmp38_);
	_tmp40_ = _tmp39_;
	_tmp41_ = main_window_get_current_map (_tmp40_, NULL);
	_tmp42_ = _tmp41_;
	_tmp43_ = self->priv->_map;
	_tmp44_ = _tmp42_ == _tmp43_;
	_mind_map_unref0 (_tmp42_);
	if (_tmp44_) {
		map_model_update_css (self);
		g_signal_emit (self, map_model_signals[MAP_MODEL_THEME_CHANGED_SIGNAL], 0);
	}
	_g_object_unref0 (theme);
}

static void
map_model_load_layout (MapModel* self,
                       xmlNode* n,
                       Layout** layout)
{
	gchar* name = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = (gchar*) xmlGetProp (n, (xmlChar*) "name");
	name = _tmp0_;
	_tmp1_ = name;
	if (_tmp1_ != NULL) {
		Layouts* _tmp2_;
		const gchar* _tmp3_;
		Layout* _tmp4_;
		_tmp2_ = self->priv->_layouts;
		_tmp3_ = name;
		_tmp4_ = layouts_get_layout (_tmp2_, _tmp3_);
		_g_object_unref0 (*layout);
		*layout = _tmp4_;
	}
	_g_free0 (name);
}

static void
map_model_load_global_style (MapModel* self,
                             xmlNode* n)
{
	MindMap* _tmp0_;
	Style* _tmp1_;
	Style* _tmp2_;
	MindMap* _tmp3_;
	Style* _tmp4_;
	Style* _tmp5_;
	MindMap* _tmp6_;
	Style* _tmp7_;
	Style* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_global_style (_tmp0_);
	_tmp2_ = _tmp1_;
	style_load_node (_tmp2_, n);
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_global_style (_tmp3_);
	_tmp5_ = _tmp4_;
	style_load_connection (_tmp5_, n);
	_tmp6_ = self->priv->_map;
	_tmp7_ = mind_map_get_global_style (_tmp6_);
	_tmp8_ = _tmp7_;
	style_load_callout (_tmp8_, n);
}

gboolean
map_model_xml_find (xmlNode* n,
                    gint id,
                    gchar** name)
{
	gboolean result;
	g_return_val_if_fail (*name != NULL, FALSE);
	{
		xmlNode* it = NULL;
		xmlNode* _tmp0_;
		_tmp0_ = n->children;
		it = _tmp0_;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp4_;
				gboolean _tmp5_ = FALSE;
				xmlNode* _tmp6_;
				if (!_tmp1_) {
					xmlNode* _tmp2_;
					xmlNode* _tmp3_;
					_tmp2_ = it;
					_tmp3_ = _tmp2_->next;
					it = _tmp3_;
				}
				_tmp1_ = FALSE;
				_tmp4_ = it;
				if (!(_tmp4_ != NULL)) {
					break;
				}
				_tmp6_ = it;
				if (_tmp6_->type == XML_ELEMENT_NODE) {
					xmlNode* _tmp7_;
					const gchar* _tmp8_;
					_tmp7_ = it;
					_tmp8_ = _tmp7_->name;
					_tmp5_ = g_strcmp0 (_tmp8_, "nodes") == 0;
				} else {
					_tmp5_ = FALSE;
				}
				if (_tmp5_) {
					{
						xmlNode* it2 = NULL;
						xmlNode* _tmp9_;
						xmlNode* _tmp10_;
						_tmp9_ = it;
						_tmp10_ = _tmp9_->children;
						it2 = _tmp10_;
						{
							gboolean _tmp11_ = FALSE;
							_tmp11_ = TRUE;
							while (TRUE) {
								xmlNode* _tmp14_;
								gboolean _tmp15_ = FALSE;
								xmlNode* _tmp16_;
								if (!_tmp11_) {
									xmlNode* _tmp12_;
									xmlNode* _tmp13_;
									_tmp12_ = it2;
									_tmp13_ = _tmp12_->next;
									it2 = _tmp13_;
								}
								_tmp11_ = FALSE;
								_tmp14_ = it2;
								if (!(_tmp14_ != NULL)) {
									break;
								}
								_tmp16_ = it2;
								if (_tmp16_->type == XML_ELEMENT_NODE) {
									xmlNode* _tmp17_;
									const gchar* _tmp18_;
									_tmp17_ = it2;
									_tmp18_ = _tmp17_->name;
									_tmp15_ = g_strcmp0 (_tmp18_, "node") == 0;
								} else {
									_tmp15_ = FALSE;
								}
								if (_tmp15_) {
									xmlNode* _tmp19_;
									gboolean _tmp20_;
									_tmp19_ = it2;
									_tmp20_ = node_xml_find (_tmp19_, id, name);
									if (_tmp20_) {
										result = TRUE;
										return result;
									}
								}
							}
						}
					}
				}
			}
		}
	}
	result = FALSE;
	return result;
}

static gpointer*
vala_g_array_remove_range (GArray* self,
                           guint index,
                           guint length,
                           gint* result_length1)
{
	gpointer* ga = NULL;
	gpointer* _tmp0_;
	gint ga_length1;
	gint _ga_size_;
	gpointer* _tmp6_;
	gint _tmp6__length1;
	gpointer* result;
	g_return_val_if_fail (self != NULL, NULL);
	_vala_assert (self->len >= (index + length), "this.length >= index + length");
	_tmp0_ = g_new0 (gpointer, length);
	ga = _tmp0_;
	ga_length1 = length;
	_ga_size_ = ga_length1;
	{
		guint i = 0U;
		i = (guint) 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				gpointer* _tmp3_;
				gint _tmp3__length1;
				gpointer* _tmp4_;
				gint _tmp4__length1;
				gpointer _tmp5_;
				if (!_tmp1_) {
					guint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				if (!(i < length)) {
					break;
				}
				_tmp3_ = ga;
				_tmp3__length1 = ga_length1;
				_tmp4_ = self->data;
				_tmp4__length1 = self->len;
				_tmp5_ = _tmp4_[i + index];
				_tmp4_[i + index] = NULL;
				_tmp3_[i] = _tmp5_;
			}
		}
	}
	g_array_remove_range (self, index, length);
	_tmp6_ = ga;
	_tmp6__length1 = ga_length1;
	if (result_length1) {
		*result_length1 = _tmp6__length1;
	}
	result = _tmp6_;
	return result;
}

void
map_model_load (MapModel* self,
                xmlNode* n)
{
	Layout* use_layout = NULL;
	gboolean animate = FALSE;
	MindMap* _tmp0_;
	Animator* _tmp1_;
	Animator* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	MindMap* _tmp5_;
	Animator* _tmp6_;
	Animator* _tmp7_;
	GArray* _tmp8_;
	GArray* _tmp9_;
	gint _tmp10_ = 0;
	gpointer* _tmp11_;
	Node** _tmp12_;
	gint _tmp12__length1;
	MindMap* _tmp98_;
	Animator* _tmp99_;
	Animator* _tmp100_;
	g_return_if_fail (self != NULL);
	use_layout = NULL;
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_animator (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = animator_get_enable (_tmp2_);
	_tmp4_ = _tmp3_;
	animate = _tmp4_;
	_tmp5_ = self->priv->_map;
	_tmp6_ = mind_map_get_animator (_tmp5_);
	_tmp7_ = _tmp6_;
	animator_set_enable (_tmp7_, FALSE);
	_tmp8_ = self->priv->_nodes;
	_tmp9_ = self->priv->_nodes;
	_tmp11_ = vala_g_array_remove_range (_tmp8_, (guint) 0, _tmp9_->len, &_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp12__length1 = _tmp10_;
	_tmp12_ = (_vala_array_free (_tmp12_, _tmp12__length1, (GDestroyNotify) g_object_unref), NULL);
	{
		xmlNode* it = NULL;
		xmlNode* _tmp13_;
		_tmp13_ = n->children;
		it = _tmp13_;
		{
			gboolean _tmp14_ = FALSE;
			_tmp14_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp17_;
				xmlNode* _tmp18_;
				if (!_tmp14_) {
					xmlNode* _tmp15_;
					xmlNode* _tmp16_;
					_tmp15_ = it;
					_tmp16_ = _tmp15_->next;
					it = _tmp16_;
				}
				_tmp14_ = FALSE;
				_tmp17_ = it;
				if (!(_tmp17_ != NULL)) {
					break;
				}
				_tmp18_ = it;
				if (_tmp18_->type == XML_ELEMENT_NODE) {
					xmlNode* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp21_;
					GQuark _tmp23_ = 0U;
					static GQuark _tmp22_label0 = 0;
					static GQuark _tmp22_label1 = 0;
					static GQuark _tmp22_label2 = 0;
					static GQuark _tmp22_label3 = 0;
					static GQuark _tmp22_label4 = 0;
					static GQuark _tmp22_label5 = 0;
					static GQuark _tmp22_label6 = 0;
					static GQuark _tmp22_label7 = 0;
					static GQuark _tmp22_label8 = 0;
					static GQuark _tmp22_label9 = 0;
					static GQuark _tmp22_label10 = 0;
					static GQuark _tmp22_label11 = 0;
					_tmp19_ = it;
					_tmp20_ = _tmp19_->name;
					_tmp21_ = _tmp20_;
					_tmp23_ = (NULL == _tmp21_) ? 0 : g_quark_from_string (_tmp21_);
					if (_tmp23_ == ((0 != _tmp22_label0) ? _tmp22_label0 : (_tmp22_label0 = g_quark_from_static_string ("theme")))) {
						switch (0) {
							default:
							{
								xmlNode* _tmp24_;
								_tmp24_ = it;
								map_model_load_theme (self, _tmp24_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label1) ? _tmp22_label1 : (_tmp22_label1 = g_quark_from_static_string ("layout")))) {
						switch (0) {
							default:
							{
								xmlNode* _tmp25_;
								_tmp25_ = it;
								map_model_load_layout (self, _tmp25_, &use_layout);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label2) ? _tmp22_label2 : (_tmp22_label2 = g_quark_from_static_string ("styles")))) {
						switch (0) {
							default:
							{
								Styles* _tmp26_;
								xmlNode* _tmp27_;
								MindMap* _tmp28_;
								Style* _tmp29_;
								Style* _tmp30_;
								Styles* _tmp31_;
								Style* _tmp32_;
								Style* _tmp33_;
								_tmp26_ = style_inspector_styles;
								_tmp27_ = it;
								styles_load (_tmp26_, _tmp27_);
								_tmp28_ = self->priv->_map;
								_tmp29_ = mind_map_get_global_style (_tmp28_);
								_tmp30_ = _tmp29_;
								_tmp31_ = style_inspector_styles;
								_tmp32_ = styles_get_global_style (_tmp31_);
								_tmp33_ = _tmp32_;
								style_copy (_tmp30_, _tmp33_);
								_style_unref0 (_tmp33_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label3) ? _tmp22_label3 : (_tmp22_label3 = g_quark_from_static_string ("global-style")))) {
						switch (0) {
							default:
							{
								xmlNode* _tmp34_;
								_tmp34_ = it;
								map_model_load_global_style (self, _tmp34_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label4) ? _tmp22_label4 : (_tmp22_label4 = g_quark_from_static_string ("tags")))) {
						switch (0) {
							default:
							{
								Tags* _tmp35_;
								xmlNode* _tmp36_;
								_tmp35_ = self->priv->_tags;
								_tmp36_ = it;
								tags_load (_tmp35_, _tmp36_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label5) ? _tmp22_label5 : (_tmp22_label5 = g_quark_from_static_string ("images")))) {
						switch (0) {
							default:
							{
								ImageManager* _tmp37_;
								xmlNode* _tmp38_;
								_tmp37_ = self->priv->_image_manager;
								_tmp38_ = it;
								image_manager_load (_tmp37_, _tmp38_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label6) ? _tmp22_label6 : (_tmp22_label6 = g_quark_from_static_string ("connections")))) {
						switch (0) {
							default:
							{
								Connections* _tmp39_;
								MindMap* _tmp40_;
								xmlNode* _tmp41_;
								GArray* _tmp42_;
								_tmp39_ = self->priv->_connections;
								_tmp40_ = self->priv->_map;
								_tmp41_ = it;
								_tmp42_ = self->priv->_nodes;
								connections_load (_tmp39_, _tmp40_, _tmp41_, NULL, _tmp42_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label7) ? _tmp22_label7 : (_tmp22_label7 = g_quark_from_static_string ("groups")))) {
						switch (0) {
							default:
							{
								NodeGroups* _tmp43_;
								NodeGroups* _tmp44_;
								MindMap* _tmp45_;
								xmlNode* _tmp46_;
								GArray* _tmp47_;
								_tmp43_ = map_model_get_groups (self);
								_tmp44_ = _tmp43_;
								_tmp45_ = self->priv->_map;
								_tmp46_ = it;
								_tmp47_ = self->priv->_nodes;
								node_groups_load (_tmp44_, _tmp45_, _tmp46_, NULL, _tmp47_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label8) ? _tmp22_label8 : (_tmp22_label8 = g_quark_from_static_string ("stickers")))) {
						switch (0) {
							default:
							{
								Stickers* _tmp48_;
								MindMap* _tmp49_;
								xmlNode* _tmp50_;
								_tmp48_ = self->priv->_stickers;
								_tmp49_ = self->priv->_map;
								_tmp50_ = it;
								stickers_load (_tmp48_, _tmp49_, _tmp50_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label9) ? _tmp22_label9 : (_tmp22_label9 = g_quark_from_static_string ("nodelinks")))) {
						switch (0) {
							default:
							{
								NodeLinks* _tmp51_;
								xmlNode* _tmp52_;
								_tmp51_ = self->priv->_node_links;
								_tmp52_ = it;
								node_links_load (_tmp51_, _tmp52_);
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label10) ? _tmp22_label10 : (_tmp22_label10 = g_quark_from_static_string ("nodes")))) {
						switch (0) {
							default:
							{
								{
									xmlNode* it2 = NULL;
									xmlNode* _tmp53_;
									xmlNode* _tmp54_;
									_tmp53_ = it;
									_tmp54_ = _tmp53_->children;
									it2 = _tmp54_;
									{
										gboolean _tmp55_ = FALSE;
										_tmp55_ = TRUE;
										while (TRUE) {
											xmlNode* _tmp58_;
											gboolean _tmp59_ = FALSE;
											xmlNode* _tmp60_;
											if (!_tmp55_) {
												xmlNode* _tmp56_;
												xmlNode* _tmp57_;
												_tmp56_ = it2;
												_tmp57_ = _tmp56_->next;
												it2 = _tmp57_;
											}
											_tmp55_ = FALSE;
											_tmp58_ = it2;
											if (!(_tmp58_ != NULL)) {
												break;
											}
											_tmp60_ = it2;
											if (_tmp60_->type == XML_ELEMENT_NODE) {
												xmlNode* _tmp61_;
												const gchar* _tmp62_;
												_tmp61_ = it2;
												_tmp62_ = _tmp61_->name;
												_tmp59_ = g_strcmp0 (_tmp62_, "node") == 0;
											} else {
												_tmp59_ = FALSE;
											}
											if (_tmp59_) {
												GArray* siblings = NULL;
												GArray* _tmp63_;
												Node* node = NULL;
												MindMap* _tmp64_;
												xmlNode* _tmp65_;
												Node* _tmp66_;
												Layout* _tmp67_;
												GArray* _tmp70_;
												Node* _tmp71_;
												Node* _tmp72_;
												_tmp63_ = g_array_new (TRUE, TRUE, sizeof (Node*));
												g_array_set_clear_func (_tmp63_, (GDestroyNotify) _vala_Node_free_function_content_of);
												siblings = _tmp63_;
												_tmp64_ = self->priv->_map;
												_tmp65_ = it2;
												_tmp66_ = node_new_from_xml (_tmp64_, NULL, _tmp65_, TRUE, NULL, &siblings);
												node = _tmp66_;
												_tmp67_ = use_layout;
												if (_tmp67_ != NULL) {
													Node* _tmp68_;
													Layout* _tmp69_;
													_tmp68_ = node;
													_tmp69_ = use_layout;
													node_set_layout (_tmp68_, _tmp69_);
												}
												_tmp70_ = self->priv->_nodes;
												_tmp71_ = node;
												_tmp72_ = _g_object_ref0 (_tmp71_);
												g_array_append_val (_tmp70_, _tmp72_);
												_g_object_unref0 (node);
												_g_array_unref0 (siblings);
											}
										}
									}
								}
								break;
							}
						}
					} else if (_tmp23_ == ((0 != _tmp22_label11) ? _tmp22_label11 : (_tmp22_label11 = g_quark_from_static_string ("ideas")))) {
						switch (0) {
							default:
							{
								{
									xmlNode* it2 = NULL;
									xmlNode* _tmp73_;
									xmlNode* _tmp74_;
									_tmp73_ = it;
									_tmp74_ = _tmp73_->children;
									it2 = _tmp74_;
									{
										gboolean _tmp75_ = FALSE;
										_tmp75_ = TRUE;
										while (TRUE) {
											xmlNode* _tmp78_;
											gboolean _tmp79_ = FALSE;
											xmlNode* _tmp80_;
											if (!_tmp75_) {
												xmlNode* _tmp76_;
												xmlNode* _tmp77_;
												_tmp76_ = it2;
												_tmp77_ = _tmp76_->next;
												it2 = _tmp77_;
											}
											_tmp75_ = FALSE;
											_tmp78_ = it2;
											if (!(_tmp78_ != NULL)) {
												break;
											}
											_tmp80_ = it2;
											if (_tmp80_->type == XML_ELEMENT_NODE) {
												xmlNode* _tmp81_;
												const gchar* _tmp82_;
												_tmp81_ = it2;
												_tmp82_ = _tmp81_->name;
												_tmp79_ = g_strcmp0 (_tmp82_, "idea") == 0;
											} else {
												_tmp79_ = FALSE;
											}
											if (_tmp79_) {
												gchar* idea = NULL;
												xmlNode* _tmp83_;
												gchar* _tmp84_;
												const gchar* _tmp85_;
												_tmp83_ = it2;
												_tmp84_ = (gchar*) xmlGetProp (_tmp83_, (xmlChar*) "text");
												idea = _tmp84_;
												_tmp85_ = idea;
												if (_tmp85_ != NULL) {
													GArray* _tmp86_;
													const gchar* _tmp87_;
													gchar* _tmp88_;
													_tmp86_ = self->priv->_braindump;
													_tmp87_ = idea;
													_tmp88_ = g_strdup (_tmp87_);
													g_array_append_val (_tmp86_, _tmp88_);
												}
												_g_free0 (idea);
											}
										}
									}
								}
								break;
							}
						}
					}
				}
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp89_ = FALSE;
			_tmp89_ = TRUE;
			while (TRUE) {
				GArray* _tmp91_;
				GArray* _tmp92_;
				Node* _tmp93_;
				Layout* _tmp94_;
				Layout* _tmp95_;
				GArray* _tmp96_;
				Node* _tmp97_;
				if (!_tmp89_) {
					gint _tmp90_;
					_tmp90_ = i;
					i = _tmp90_ + 1;
				}
				_tmp89_ = FALSE;
				_tmp91_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp91_->len)) {
					break;
				}
				_tmp92_ = self->priv->_nodes;
				_tmp93_ = g_array_index (_tmp92_, Node*, (guint) i);
				_tmp94_ = node_get_layout (_tmp93_);
				_tmp95_ = _tmp94_;
				_tmp96_ = self->priv->_nodes;
				_tmp97_ = g_array_index (_tmp96_, Node*, (guint) i);
				layout_initialize (_tmp95_, _tmp97_);
			}
		}
	}
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_set_is_loaded (self, TRUE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_LOADED_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	_tmp98_ = self->priv->_map;
	_tmp99_ = mind_map_get_animator (_tmp98_);
	_tmp100_ = _tmp99_;
	animator_set_enable (_tmp100_, animate);
	_g_object_unref0 (use_layout);
}

gboolean
map_model_save (MapModel* self,
                xmlNode* parent)
{
	Theme* _tmp0_;
	xmlNode* _tmp1_;
	xmlNode* style = NULL;
	xmlNode* _tmp2_;
	MindMap* _tmp3_;
	Style* _tmp4_;
	Style* _tmp5_;
	xmlNode* _tmp6_;
	MindMap* _tmp7_;
	Style* _tmp8_;
	Style* _tmp9_;
	xmlNode* _tmp10_;
	MindMap* _tmp11_;
	Style* _tmp12_;
	Style* _tmp13_;
	xmlNode* _tmp14_;
	xmlNode* _tmp15_;
	xmlNode* images = NULL;
	xmlNode* _tmp16_;
	ImageManager* _tmp17_;
	xmlNode* _tmp18_;
	xmlNode* _tmp19_;
	Tags* _tmp20_;
	xmlNode* _tmp21_;
	xmlNode* nodes = NULL;
	xmlNode* _tmp22_;
	xmlNode* _tmp29_;
	NodeGroups* _tmp30_;
	NodeGroups* _tmp31_;
	xmlNode* _tmp32_;
	Connections* _tmp33_;
	Stickers* _tmp34_;
	xmlNode* _tmp35_;
	NodeLinks* _tmp36_;
	xmlNode* _tmp37_;
	xmlNode* ideas = NULL;
	xmlNode* _tmp38_;
	xmlNode* _tmp48_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_theme;
	_tmp1_ = theme_save (_tmp0_);
	xmlAddChild (parent, _tmp1_);
	_tmp2_ = xmlNewNode (NULL, (xmlChar*) "global-style");
	style = _tmp2_;
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_global_style (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = style;
	style_save_node_in_node (_tmp5_, _tmp6_);
	_tmp7_ = self->priv->_map;
	_tmp8_ = mind_map_get_global_style (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = style;
	style_save_connection_in_node (_tmp9_, _tmp10_);
	_tmp11_ = self->priv->_map;
	_tmp12_ = mind_map_get_global_style (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = style;
	style_save_callout_in_node (_tmp13_, _tmp14_);
	_tmp15_ = style;
	xmlAddChild (parent, _tmp15_);
	_tmp16_ = xmlNewNode (NULL, (xmlChar*) "images");
	images = _tmp16_;
	_tmp17_ = self->priv->_image_manager;
	_tmp18_ = images;
	image_manager_save (_tmp17_, _tmp18_);
	_tmp19_ = images;
	xmlAddChild (parent, _tmp19_);
	_tmp20_ = self->priv->_tags;
	_tmp21_ = tags_save (_tmp20_);
	xmlAddChild (parent, _tmp21_);
	_tmp22_ = xmlNewNode (NULL, (xmlChar*) "nodes");
	nodes = _tmp22_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp23_ = FALSE;
			_tmp23_ = TRUE;
			while (TRUE) {
				GArray* _tmp25_;
				GArray* _tmp26_;
				Node* _tmp27_;
				xmlNode* _tmp28_;
				if (!_tmp23_) {
					gint _tmp24_;
					_tmp24_ = i;
					i = _tmp24_ + 1;
				}
				_tmp23_ = FALSE;
				_tmp25_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp25_->len)) {
					break;
				}
				_tmp26_ = self->priv->_nodes;
				_tmp27_ = g_array_index (_tmp26_, Node*, (guint) i);
				_tmp28_ = nodes;
				node_save (_tmp27_, _tmp28_);
			}
		}
	}
	_tmp29_ = nodes;
	xmlAddChild (parent, _tmp29_);
	_tmp30_ = map_model_get_groups (self);
	_tmp31_ = _tmp30_;
	_tmp32_ = node_groups_save (_tmp31_);
	xmlAddChild (parent, _tmp32_);
	_tmp33_ = self->priv->_connections;
	connections_save (_tmp33_, parent);
	_tmp34_ = self->priv->_stickers;
	_tmp35_ = stickers_save (_tmp34_);
	xmlAddChild (parent, _tmp35_);
	_tmp36_ = self->priv->_node_links;
	_tmp37_ = node_links_save (_tmp36_);
	xmlAddChild (parent, _tmp37_);
	_tmp38_ = xmlNewNode (NULL, (xmlChar*) "ideas");
	ideas = _tmp38_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp39_ = FALSE;
			_tmp39_ = TRUE;
			while (TRUE) {
				GArray* _tmp41_;
				xmlNode* idea = NULL;
				xmlNode* _tmp42_;
				xmlNode* _tmp43_;
				GArray* _tmp44_;
				const gchar* _tmp45_;
				xmlNode* _tmp46_;
				xmlNode* _tmp47_;
				if (!_tmp39_) {
					gint _tmp40_;
					_tmp40_ = i;
					i = _tmp40_ + 1;
				}
				_tmp39_ = FALSE;
				_tmp41_ = self->priv->_braindump;
				if (!(((guint) i) < _tmp41_->len)) {
					break;
				}
				_tmp42_ = xmlNewNode (NULL, (xmlChar*) "idea");
				idea = _tmp42_;
				_tmp43_ = idea;
				_tmp44_ = self->priv->_braindump;
				_tmp45_ = g_array_index (_tmp44_, gchar*, (guint) i);
				xmlSetProp (_tmp43_, (xmlChar*) "text", (xmlChar*) _tmp45_);
				_tmp46_ = ideas;
				_tmp47_ = idea;
				xmlAddChild (_tmp46_, _tmp47_);
			}
		}
	}
	_tmp48_ = ideas;
	xmlAddChild (parent, _tmp48_);
	result = TRUE;
	return result;
}

static gpointer
_node_bounds_ref0 (gpointer self)
{
	return self ? node_bounds_ref (self) : NULL;
}

void
map_model_document_rectangle (MapModel* self,
                              gdouble* x,
                              gdouble* y,
                              gdouble* width,
                              gdouble* height)
{
	gdouble _vala_x = 0.0;
	gdouble _vala_y = 0.0;
	gdouble _vala_width = 0.0;
	gdouble _vala_height = 0.0;
	gdouble x1 = 0.0;
	gdouble y1 = 0.0;
	gdouble x2 = 0.0;
	gdouble y2 = 0.0;
	Connections* _tmp48_;
	Stickers* _tmp49_;
	g_return_if_fail (self != NULL);
	x1 = (gdouble) 10000000;
	y1 = (gdouble) 10000000;
	x2 = (gdouble) -10000000;
	y2 = (gdouble) -10000000;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				NodeBounds* nb = NULL;
				GArray* _tmp3_;
				Node* _tmp4_;
				NodeBounds* _tmp5_;
				NodeBounds* _tmp6_;
				NodeBounds* _tmp7_;
				gdouble _tmp8_ = 0.0;
				NodeBounds* _tmp9_;
				gdouble _tmp10_;
				gdouble _tmp11_;
				gdouble _tmp15_ = 0.0;
				NodeBounds* _tmp16_;
				gdouble _tmp17_;
				gdouble _tmp18_;
				gdouble _tmp22_ = 0.0;
				NodeBounds* _tmp23_;
				gdouble _tmp24_;
				gdouble _tmp25_;
				NodeBounds* _tmp26_;
				gdouble _tmp27_;
				gdouble _tmp28_;
				gdouble _tmp35_ = 0.0;
				NodeBounds* _tmp36_;
				gdouble _tmp37_;
				gdouble _tmp38_;
				NodeBounds* _tmp39_;
				gdouble _tmp40_;
				gdouble _tmp41_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = node_get_tree_bbox (_tmp4_);
				_tmp6_ = _tmp5_;
				_tmp7_ = _node_bounds_ref0 (_tmp6_);
				nb = _tmp7_;
				_tmp9_ = nb;
				_tmp10_ = node_bounds_get_x (_tmp9_);
				_tmp11_ = _tmp10_;
				if (x1 < _tmp11_) {
					_tmp8_ = x1;
				} else {
					NodeBounds* _tmp12_;
					gdouble _tmp13_;
					gdouble _tmp14_;
					_tmp12_ = nb;
					_tmp13_ = node_bounds_get_x (_tmp12_);
					_tmp14_ = _tmp13_;
					_tmp8_ = _tmp14_;
				}
				x1 = _tmp8_;
				_tmp16_ = nb;
				_tmp17_ = node_bounds_get_y (_tmp16_);
				_tmp18_ = _tmp17_;
				if (y1 < _tmp18_) {
					_tmp15_ = y1;
				} else {
					NodeBounds* _tmp19_;
					gdouble _tmp20_;
					gdouble _tmp21_;
					_tmp19_ = nb;
					_tmp20_ = node_bounds_get_y (_tmp19_);
					_tmp21_ = _tmp20_;
					_tmp15_ = _tmp21_;
				}
				y1 = _tmp15_;
				_tmp23_ = nb;
				_tmp24_ = node_bounds_get_x (_tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = nb;
				_tmp27_ = node_bounds_get_width (_tmp26_);
				_tmp28_ = _tmp27_;
				if (x2 < (_tmp25_ + _tmp28_)) {
					NodeBounds* _tmp29_;
					gdouble _tmp30_;
					gdouble _tmp31_;
					NodeBounds* _tmp32_;
					gdouble _tmp33_;
					gdouble _tmp34_;
					_tmp29_ = nb;
					_tmp30_ = node_bounds_get_x (_tmp29_);
					_tmp31_ = _tmp30_;
					_tmp32_ = nb;
					_tmp33_ = node_bounds_get_width (_tmp32_);
					_tmp34_ = _tmp33_;
					_tmp22_ = _tmp31_ + _tmp34_;
				} else {
					_tmp22_ = x2;
				}
				x2 = _tmp22_;
				_tmp36_ = nb;
				_tmp37_ = node_bounds_get_y (_tmp36_);
				_tmp38_ = _tmp37_;
				_tmp39_ = nb;
				_tmp40_ = node_bounds_get_height (_tmp39_);
				_tmp41_ = _tmp40_;
				if (y2 < (_tmp38_ + _tmp41_)) {
					NodeBounds* _tmp42_;
					gdouble _tmp43_;
					gdouble _tmp44_;
					NodeBounds* _tmp45_;
					gdouble _tmp46_;
					gdouble _tmp47_;
					_tmp42_ = nb;
					_tmp43_ = node_bounds_get_y (_tmp42_);
					_tmp44_ = _tmp43_;
					_tmp45_ = nb;
					_tmp46_ = node_bounds_get_height (_tmp45_);
					_tmp47_ = _tmp46_;
					_tmp35_ = _tmp44_ + _tmp47_;
				} else {
					_tmp35_ = y2;
				}
				y2 = _tmp35_;
				_node_bounds_unref0 (nb);
			}
		}
	}
	_tmp48_ = self->priv->_connections;
	connections_add_extents (_tmp48_, &x1, &y1, &x2, &y2);
	_tmp49_ = self->priv->_stickers;
	stickers_add_extents (_tmp49_, &x1, &y1, &x2, &y2);
	_vala_x = x1;
	_vala_y = y1;
	_vala_width = x2 - x1;
	_vala_height = y2 - y1;
	if (x) {
		*x = _vala_x;
	}
	if (y) {
		*y = _vala_y;
	}
	if (width) {
		*width = _vala_width;
	}
	if (height) {
		*height = _vala_height;
	}
}

void
map_model_initialize (MapModel* self)
{
	GArray* _tmp0_;
	GArray* _tmp1_;
	gint _tmp2_ = 0;
	gpointer* _tmp3_;
	Node** _tmp4_;
	gint _tmp4__length1;
	Connections* _tmp5_;
	Stickers* _tmp6_;
	NodeGroups* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_nodes;
	_tmp1_ = self->priv->_nodes;
	_tmp3_ = vala_g_array_remove_range (_tmp0_, (guint) 0, _tmp1_->len, &_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp2_;
	_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_object_unref), NULL);
	_tmp5_ = self->priv->_connections;
	connections_clear_all_connections (_tmp5_);
	_tmp6_ = self->priv->_stickers;
	stickers_clear (_tmp6_);
	_tmp7_ = self->priv->_groups;
	node_groups_clear (_tmp7_);
}

void
map_model_get_match_items (MapModel* self,
                           const gchar* tabname,
                           const gchar* pattern,
                           gboolean* search_opts,
                           gint search_opts_length1,
                           GtkListStore** matches)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp8_;
	gboolean _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tabname != NULL);
	g_return_if_fail (pattern != NULL);
	g_return_if_fail (*matches != NULL);
	_tmp1_ = search_opts[SEARCH_OPTIONS_NODES];
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp2_;
		_tmp2_ = search_opts[SEARCH_OPTIONS_CALLOUTS];
		_tmp0_ = _tmp2_;
	}
	if (_tmp0_) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					GArray* _tmp5_;
					GArray* _tmp6_;
					Node* _tmp7_;
					if (!_tmp3_) {
						gint _tmp4_;
						_tmp4_ = i;
						i = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					_tmp5_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp5_->len)) {
						break;
					}
					_tmp6_ = self->priv->_nodes;
					_tmp7_ = g_array_index (_tmp6_, Node*, (guint) i);
					node_get_match_items (_tmp7_, tabname, pattern, search_opts, (gint) search_opts_length1, matches);
				}
			}
		}
	}
	_tmp8_ = search_opts[SEARCH_OPTIONS_CONNECTIONS];
	if (_tmp8_) {
		Connections* _tmp9_;
		_tmp9_ = self->priv->_connections;
		connections_get_match_items (_tmp9_, tabname, pattern, search_opts, (gint) search_opts_length1, matches);
	}
	_tmp10_ = search_opts[SEARCH_OPTIONS_GROUPS];
	if (_tmp10_) {
		NodeGroups* _tmp11_;
		_tmp11_ = self->priv->_groups;
		node_groups_get_match_items (_tmp11_, tabname, pattern, search_opts, (gint) search_opts_length1, matches);
	}
}

void
map_model_set_node_mode (MapModel* self,
                         Node* node,
                         NodeMode mode,
                         gboolean undoable)
{
	gboolean _tmp0_ = FALSE;
	NodeMode _tmp1_;
	NodeMode _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp1_ = node_get_mode (node);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != NODE_MODE_EDITABLE) {
		_tmp0_ = mode == NODE_MODE_EDITABLE;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		MindMap* _tmp3_;
		DrawArea* _tmp4_;
		DrawArea* _tmp5_;
		CanvasText* _tmp6_;
		CanvasText* _tmp7_;
		MindMap* _tmp8_;
		DrawArea* _tmp9_;
		DrawArea* _tmp10_;
		GtkIMContext* _tmp11_;
		GtkIMContext* _tmp12_;
		CanvasText* _tmp13_;
		CanvasText* _tmp14_;
		MindMap* _tmp15_;
		DrawArea* _tmp16_;
		DrawArea* _tmp17_;
		gdouble _tmp18_;
		gdouble _tmp19_;
		MindMap* _tmp20_;
		DrawArea* _tmp21_;
		DrawArea* _tmp22_;
		gdouble _tmp23_;
		gdouble _tmp24_;
		MindMap* _tmp28_;
		UndoTextBuffer* _tmp29_;
		UndoTextBuffer* _tmp30_;
		CanvasText* _tmp31_;
		CanvasText* _tmp32_;
		CanvasText* _tmp33_;
		CanvasText* _tmp34_;
		MindMap* _tmp35_;
		UndoTextBuffer* _tmp36_;
		UndoTextBuffer* _tmp37_;
		CanvasText* _tmp38_;
		CanvasText* _tmp39_;
		MindMap* _tmp40_;
		UndoTextBuffer* _tmp41_;
		UndoTextBuffer* _tmp42_;
		_tmp3_ = self->priv->_map;
		_tmp4_ = mind_map_get_canvas (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = node_get_name (node);
		_tmp7_ = _tmp6_;
		draw_area_update_im_cursor (_tmp5_, _tmp7_);
		_tmp8_ = self->priv->_map;
		_tmp9_ = mind_map_get_canvas (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = draw_area_get_im_context (_tmp10_);
		_tmp12_ = _tmp11_;
		gtk_im_context_focus_in (_tmp12_);
		_tmp13_ = node_get_name (node);
		_tmp14_ = _tmp13_;
		_tmp15_ = self->priv->_map;
		_tmp16_ = mind_map_get_canvas (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = draw_area_get_scaled_x (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = self->priv->_map;
		_tmp21_ = mind_map_get_canvas (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = draw_area_get_scaled_y (_tmp22_);
		_tmp24_ = _tmp23_;
		if (canvas_text_is_within (_tmp14_, _tmp19_, _tmp24_)) {
			MindMap* _tmp25_;
			DrawArea* _tmp26_;
			DrawArea* _tmp27_;
			_tmp25_ = self->priv->_map;
			_tmp26_ = mind_map_get_canvas (_tmp25_);
			_tmp27_ = _tmp26_;
			draw_area_set_text_cursor (_tmp27_);
		}
		_tmp28_ = self->priv->_map;
		_tmp29_ = mind_map_get_undo_text (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = undo_text_buffer_get_orig (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = node_get_name (node);
		_tmp34_ = _tmp33_;
		canvas_text_copy (_tmp32_, _tmp34_);
		_tmp35_ = self->priv->_map;
		_tmp36_ = mind_map_get_undo_text (_tmp35_);
		_tmp37_ = _tmp36_;
		_tmp38_ = node_get_name (node);
		_tmp39_ = _tmp38_;
		undo_text_buffer_set_ct (_tmp37_, _tmp39_);
		_tmp40_ = self->priv->_map;
		_tmp41_ = mind_map_get_undo_text (_tmp40_);
		_tmp42_ = _tmp41_;
		undo_text_buffer_set_do_undo (_tmp42_, undoable);
		node_set_mode (node, mode);
	} else {
		gboolean _tmp43_ = FALSE;
		NodeMode _tmp44_;
		NodeMode _tmp45_;
		_tmp44_ = node_get_mode (node);
		_tmp45_ = _tmp44_;
		if (_tmp45_ == NODE_MODE_EDITABLE) {
			_tmp43_ = mode != NODE_MODE_EDITABLE;
		} else {
			_tmp43_ = FALSE;
		}
		if (_tmp43_) {
			MindMap* _tmp46_;
			DrawArea* _tmp47_;
			DrawArea* _tmp48_;
			GtkIMContext* _tmp49_;
			GtkIMContext* _tmp50_;
			MindMap* _tmp51_;
			DrawArea* _tmp52_;
			DrawArea* _tmp53_;
			GtkIMContext* _tmp54_;
			GtkIMContext* _tmp55_;
			CanvasText* _tmp56_;
			CanvasText* _tmp57_;
			MindMap* _tmp58_;
			DrawArea* _tmp59_;
			DrawArea* _tmp60_;
			gdouble _tmp61_;
			gdouble _tmp62_;
			MindMap* _tmp63_;
			DrawArea* _tmp64_;
			DrawArea* _tmp65_;
			gdouble _tmp66_;
			gdouble _tmp67_;
			MindMap* _tmp71_;
			UndoTextBuffer* _tmp72_;
			UndoTextBuffer* _tmp73_;
			MindMap* _tmp74_;
			UndoTextBuffer* _tmp75_;
			UndoTextBuffer* _tmp76_;
			gboolean _tmp77_;
			gboolean _tmp78_;
			MindMap* _tmp88_;
			UndoTextBuffer* _tmp89_;
			UndoTextBuffer* _tmp90_;
			MindMap* _tmp91_;
			UndoTextBuffer* _tmp92_;
			UndoTextBuffer* _tmp93_;
			_tmp46_ = self->priv->_map;
			_tmp47_ = mind_map_get_canvas (_tmp46_);
			_tmp48_ = _tmp47_;
			_tmp49_ = draw_area_get_im_context (_tmp48_);
			_tmp50_ = _tmp49_;
			gtk_im_context_reset (_tmp50_);
			_tmp51_ = self->priv->_map;
			_tmp52_ = mind_map_get_canvas (_tmp51_);
			_tmp53_ = _tmp52_;
			_tmp54_ = draw_area_get_im_context (_tmp53_);
			_tmp55_ = _tmp54_;
			gtk_im_context_focus_out (_tmp55_);
			_tmp56_ = node_get_name (node);
			_tmp57_ = _tmp56_;
			_tmp58_ = self->priv->_map;
			_tmp59_ = mind_map_get_canvas (_tmp58_);
			_tmp60_ = _tmp59_;
			_tmp61_ = draw_area_get_scaled_x (_tmp60_);
			_tmp62_ = _tmp61_;
			_tmp63_ = self->priv->_map;
			_tmp64_ = mind_map_get_canvas (_tmp63_);
			_tmp65_ = _tmp64_;
			_tmp66_ = draw_area_get_scaled_y (_tmp65_);
			_tmp67_ = _tmp66_;
			if (canvas_text_is_within (_tmp57_, _tmp62_, _tmp67_)) {
				MindMap* _tmp68_;
				DrawArea* _tmp69_;
				DrawArea* _tmp70_;
				_tmp68_ = self->priv->_map;
				_tmp69_ = mind_map_get_canvas (_tmp68_);
				_tmp70_ = _tmp69_;
				draw_area_reset_cursor (_tmp70_);
			}
			_tmp71_ = self->priv->_map;
			_tmp72_ = mind_map_get_undo_text (_tmp71_);
			_tmp73_ = _tmp72_;
			undo_buffer_clear ((UndoBuffer*) _tmp73_);
			_tmp74_ = self->priv->_map;
			_tmp75_ = mind_map_get_undo_text (_tmp74_);
			_tmp76_ = _tmp75_;
			_tmp77_ = undo_text_buffer_get_do_undo (_tmp76_);
			_tmp78_ = _tmp77_;
			if (_tmp78_) {
				MindMap* _tmp79_;
				MindMap* _tmp80_;
				MindMap* _tmp81_;
				UndoTextBuffer* _tmp82_;
				UndoTextBuffer* _tmp83_;
				CanvasText* _tmp84_;
				CanvasText* _tmp85_;
				UndoNodeName* _tmp86_;
				UndoNodeName* _tmp87_;
				_tmp79_ = self->priv->_map;
				_tmp80_ = self->priv->_map;
				_tmp81_ = self->priv->_map;
				_tmp82_ = mind_map_get_undo_text (_tmp81_);
				_tmp83_ = _tmp82_;
				_tmp84_ = undo_text_buffer_get_orig (_tmp83_);
				_tmp85_ = _tmp84_;
				_tmp86_ = undo_node_name_new (_tmp80_, node, _tmp85_);
				_tmp87_ = _tmp86_;
				mind_map_add_undo (_tmp79_, (UndoItem*) _tmp87_);
				_g_object_unref0 (_tmp87_);
			}
			_tmp88_ = self->priv->_map;
			_tmp89_ = mind_map_get_undo_text (_tmp88_);
			_tmp90_ = _tmp89_;
			undo_text_buffer_set_ct (_tmp90_, NULL);
			_tmp91_ = self->priv->_map;
			_tmp92_ = mind_map_get_undo_text (_tmp91_);
			_tmp93_ = _tmp92_;
			undo_text_buffer_set_do_undo (_tmp93_, FALSE);
			node_set_mode (node, mode);
			map_model_auto_save (self);
		} else {
			node_set_mode (node, mode);
		}
	}
}

void
map_model_set_connection_mode (MapModel* self,
                               Connection* conn,
                               ConnMode mode,
                               gboolean undoable)
{
	gboolean _tmp0_ = FALSE;
	ConnMode _tmp1_;
	ConnMode _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conn != NULL);
	_tmp1_ = connection_get_mode (conn);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != CONN_MODE_EDITABLE) {
		_tmp0_ = mode == CONN_MODE_EDITABLE;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		MindMap* _tmp3_;
		DrawArea* _tmp4_;
		DrawArea* _tmp5_;
		CanvasText* _tmp6_;
		CanvasText* _tmp7_;
		MindMap* _tmp8_;
		DrawArea* _tmp9_;
		DrawArea* _tmp10_;
		GtkIMContext* _tmp11_;
		GtkIMContext* _tmp12_;
		gboolean _tmp13_ = FALSE;
		CanvasText* _tmp14_;
		CanvasText* _tmp15_;
		MindMap* _tmp31_;
		UndoTextBuffer* _tmp32_;
		UndoTextBuffer* _tmp33_;
		CanvasText* _tmp34_;
		CanvasText* _tmp35_;
		CanvasText* _tmp36_;
		CanvasText* _tmp37_;
		MindMap* _tmp38_;
		UndoTextBuffer* _tmp39_;
		UndoTextBuffer* _tmp40_;
		CanvasText* _tmp41_;
		CanvasText* _tmp42_;
		MindMap* _tmp43_;
		UndoTextBuffer* _tmp44_;
		UndoTextBuffer* _tmp45_;
		_tmp3_ = self->priv->_map;
		_tmp4_ = mind_map_get_canvas (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = connection_get_title (conn);
		_tmp7_ = _tmp6_;
		draw_area_update_im_cursor (_tmp5_, _tmp7_);
		_tmp8_ = self->priv->_map;
		_tmp9_ = mind_map_get_canvas (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = draw_area_get_im_context (_tmp10_);
		_tmp12_ = _tmp11_;
		gtk_im_context_focus_in (_tmp12_);
		_tmp14_ = connection_get_title (conn);
		_tmp15_ = _tmp14_;
		if (_tmp15_ != NULL) {
			CanvasText* _tmp16_;
			CanvasText* _tmp17_;
			MindMap* _tmp18_;
			DrawArea* _tmp19_;
			DrawArea* _tmp20_;
			gdouble _tmp21_;
			gdouble _tmp22_;
			MindMap* _tmp23_;
			DrawArea* _tmp24_;
			DrawArea* _tmp25_;
			gdouble _tmp26_;
			gdouble _tmp27_;
			_tmp16_ = connection_get_title (conn);
			_tmp17_ = _tmp16_;
			_tmp18_ = self->priv->_map;
			_tmp19_ = mind_map_get_canvas (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = draw_area_get_scaled_x (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp23_ = self->priv->_map;
			_tmp24_ = mind_map_get_canvas (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = draw_area_get_scaled_y (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp13_ = canvas_text_is_within (_tmp17_, _tmp22_, _tmp27_);
		} else {
			_tmp13_ = FALSE;
		}
		if (_tmp13_) {
			MindMap* _tmp28_;
			DrawArea* _tmp29_;
			DrawArea* _tmp30_;
			_tmp28_ = self->priv->_map;
			_tmp29_ = mind_map_get_canvas (_tmp28_);
			_tmp30_ = _tmp29_;
			draw_area_set_text_cursor (_tmp30_);
		}
		_tmp31_ = self->priv->_map;
		_tmp32_ = mind_map_get_undo_text (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = undo_text_buffer_get_orig (_tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = connection_get_title (conn);
		_tmp37_ = _tmp36_;
		canvas_text_copy (_tmp35_, _tmp37_);
		_tmp38_ = self->priv->_map;
		_tmp39_ = mind_map_get_undo_text (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp41_ = connection_get_title (conn);
		_tmp42_ = _tmp41_;
		undo_text_buffer_set_ct (_tmp40_, _tmp42_);
		_tmp43_ = self->priv->_map;
		_tmp44_ = mind_map_get_undo_text (_tmp43_);
		_tmp45_ = _tmp44_;
		undo_text_buffer_set_do_undo (_tmp45_, undoable);
	} else {
		gboolean _tmp46_ = FALSE;
		ConnMode _tmp47_;
		ConnMode _tmp48_;
		_tmp47_ = connection_get_mode (conn);
		_tmp48_ = _tmp47_;
		if (_tmp48_ == CONN_MODE_EDITABLE) {
			_tmp46_ = mode != CONN_MODE_EDITABLE;
		} else {
			_tmp46_ = FALSE;
		}
		if (_tmp46_) {
			MindMap* _tmp49_;
			DrawArea* _tmp50_;
			DrawArea* _tmp51_;
			GtkIMContext* _tmp52_;
			GtkIMContext* _tmp53_;
			MindMap* _tmp54_;
			DrawArea* _tmp55_;
			DrawArea* _tmp56_;
			GtkIMContext* _tmp57_;
			GtkIMContext* _tmp58_;
			gboolean _tmp59_ = FALSE;
			CanvasText* _tmp60_;
			CanvasText* _tmp61_;
			MindMap* _tmp77_;
			UndoTextBuffer* _tmp78_;
			UndoTextBuffer* _tmp79_;
			MindMap* _tmp80_;
			UndoTextBuffer* _tmp81_;
			UndoTextBuffer* _tmp82_;
			gboolean _tmp83_;
			gboolean _tmp84_;
			MindMap* _tmp94_;
			UndoTextBuffer* _tmp95_;
			UndoTextBuffer* _tmp96_;
			MindMap* _tmp97_;
			UndoTextBuffer* _tmp98_;
			UndoTextBuffer* _tmp99_;
			_tmp49_ = self->priv->_map;
			_tmp50_ = mind_map_get_canvas (_tmp49_);
			_tmp51_ = _tmp50_;
			_tmp52_ = draw_area_get_im_context (_tmp51_);
			_tmp53_ = _tmp52_;
			gtk_im_context_reset (_tmp53_);
			_tmp54_ = self->priv->_map;
			_tmp55_ = mind_map_get_canvas (_tmp54_);
			_tmp56_ = _tmp55_;
			_tmp57_ = draw_area_get_im_context (_tmp56_);
			_tmp58_ = _tmp57_;
			gtk_im_context_focus_out (_tmp58_);
			_tmp60_ = connection_get_title (conn);
			_tmp61_ = _tmp60_;
			if (_tmp61_ != NULL) {
				CanvasText* _tmp62_;
				CanvasText* _tmp63_;
				MindMap* _tmp64_;
				DrawArea* _tmp65_;
				DrawArea* _tmp66_;
				gdouble _tmp67_;
				gdouble _tmp68_;
				MindMap* _tmp69_;
				DrawArea* _tmp70_;
				DrawArea* _tmp71_;
				gdouble _tmp72_;
				gdouble _tmp73_;
				_tmp62_ = connection_get_title (conn);
				_tmp63_ = _tmp62_;
				_tmp64_ = self->priv->_map;
				_tmp65_ = mind_map_get_canvas (_tmp64_);
				_tmp66_ = _tmp65_;
				_tmp67_ = draw_area_get_scaled_x (_tmp66_);
				_tmp68_ = _tmp67_;
				_tmp69_ = self->priv->_map;
				_tmp70_ = mind_map_get_canvas (_tmp69_);
				_tmp71_ = _tmp70_;
				_tmp72_ = draw_area_get_scaled_y (_tmp71_);
				_tmp73_ = _tmp72_;
				_tmp59_ = canvas_text_is_within (_tmp63_, _tmp68_, _tmp73_);
			} else {
				_tmp59_ = FALSE;
			}
			if (_tmp59_) {
				MindMap* _tmp74_;
				DrawArea* _tmp75_;
				DrawArea* _tmp76_;
				_tmp74_ = self->priv->_map;
				_tmp75_ = mind_map_get_canvas (_tmp74_);
				_tmp76_ = _tmp75_;
				draw_area_reset_cursor (_tmp76_);
			}
			_tmp77_ = self->priv->_map;
			_tmp78_ = mind_map_get_undo_text (_tmp77_);
			_tmp79_ = _tmp78_;
			undo_buffer_clear ((UndoBuffer*) _tmp79_);
			_tmp80_ = self->priv->_map;
			_tmp81_ = mind_map_get_undo_text (_tmp80_);
			_tmp82_ = _tmp81_;
			_tmp83_ = undo_text_buffer_get_do_undo (_tmp82_);
			_tmp84_ = _tmp83_;
			if (_tmp84_) {
				MindMap* _tmp85_;
				MindMap* _tmp86_;
				MindMap* _tmp87_;
				UndoTextBuffer* _tmp88_;
				UndoTextBuffer* _tmp89_;
				CanvasText* _tmp90_;
				CanvasText* _tmp91_;
				UndoConnectionTitle* _tmp92_;
				UndoConnectionTitle* _tmp93_;
				_tmp85_ = self->priv->_map;
				_tmp86_ = self->priv->_map;
				_tmp87_ = self->priv->_map;
				_tmp88_ = mind_map_get_undo_text (_tmp87_);
				_tmp89_ = _tmp88_;
				_tmp90_ = undo_text_buffer_get_orig (_tmp89_);
				_tmp91_ = _tmp90_;
				_tmp92_ = undo_connection_title_new (_tmp86_, conn, _tmp91_);
				_tmp93_ = _tmp92_;
				mind_map_add_undo (_tmp85_, (UndoItem*) _tmp93_);
				_g_object_unref0 (_tmp93_);
			}
			_tmp94_ = self->priv->_map;
			_tmp95_ = mind_map_get_undo_text (_tmp94_);
			_tmp96_ = _tmp95_;
			undo_text_buffer_set_ct (_tmp96_, NULL);
			_tmp97_ = self->priv->_map;
			_tmp98_ = mind_map_get_undo_text (_tmp97_);
			_tmp99_ = _tmp98_;
			undo_text_buffer_set_do_undo (_tmp99_, FALSE);
		}
	}
	connection_set_mode (conn, mode);
}

void
map_model_set_callout_mode (MapModel* self,
                            Callout* callout,
                            CalloutMode mode,
                            gboolean undoable)
{
	gboolean _tmp0_ = FALSE;
	CalloutMode _tmp1_;
	CalloutMode _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (callout != NULL);
	_tmp1_ = callout_get_mode (callout);
	_tmp2_ = _tmp1_;
	if (_tmp2_ != CALLOUT_MODE_EDITABLE) {
		_tmp0_ = mode == CALLOUT_MODE_EDITABLE;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		MindMap* _tmp3_;
		DrawArea* _tmp4_;
		DrawArea* _tmp5_;
		CanvasText* _tmp6_;
		CanvasText* _tmp7_;
		MindMap* _tmp8_;
		DrawArea* _tmp9_;
		DrawArea* _tmp10_;
		GtkIMContext* _tmp11_;
		GtkIMContext* _tmp12_;
		gboolean _tmp13_ = FALSE;
		CanvasText* _tmp14_;
		CanvasText* _tmp15_;
		MindMap* _tmp31_;
		UndoTextBuffer* _tmp32_;
		UndoTextBuffer* _tmp33_;
		CanvasText* _tmp34_;
		CanvasText* _tmp35_;
		CanvasText* _tmp36_;
		CanvasText* _tmp37_;
		MindMap* _tmp38_;
		UndoTextBuffer* _tmp39_;
		UndoTextBuffer* _tmp40_;
		CanvasText* _tmp41_;
		CanvasText* _tmp42_;
		MindMap* _tmp43_;
		UndoTextBuffer* _tmp44_;
		UndoTextBuffer* _tmp45_;
		_tmp3_ = self->priv->_map;
		_tmp4_ = mind_map_get_canvas (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = callout_get_text (callout);
		_tmp7_ = _tmp6_;
		draw_area_update_im_cursor (_tmp5_, _tmp7_);
		_tmp8_ = self->priv->_map;
		_tmp9_ = mind_map_get_canvas (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = draw_area_get_im_context (_tmp10_);
		_tmp12_ = _tmp11_;
		gtk_im_context_focus_in (_tmp12_);
		_tmp14_ = callout_get_text (callout);
		_tmp15_ = _tmp14_;
		if (_tmp15_ != NULL) {
			CanvasText* _tmp16_;
			CanvasText* _tmp17_;
			MindMap* _tmp18_;
			DrawArea* _tmp19_;
			DrawArea* _tmp20_;
			gdouble _tmp21_;
			gdouble _tmp22_;
			MindMap* _tmp23_;
			DrawArea* _tmp24_;
			DrawArea* _tmp25_;
			gdouble _tmp26_;
			gdouble _tmp27_;
			_tmp16_ = callout_get_text (callout);
			_tmp17_ = _tmp16_;
			_tmp18_ = self->priv->_map;
			_tmp19_ = mind_map_get_canvas (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = draw_area_get_scaled_x (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp23_ = self->priv->_map;
			_tmp24_ = mind_map_get_canvas (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = draw_area_get_scaled_y (_tmp25_);
			_tmp27_ = _tmp26_;
			_tmp13_ = canvas_text_is_within (_tmp17_, _tmp22_, _tmp27_);
		} else {
			_tmp13_ = FALSE;
		}
		if (_tmp13_) {
			MindMap* _tmp28_;
			DrawArea* _tmp29_;
			DrawArea* _tmp30_;
			_tmp28_ = self->priv->_map;
			_tmp29_ = mind_map_get_canvas (_tmp28_);
			_tmp30_ = _tmp29_;
			draw_area_set_text_cursor (_tmp30_);
		}
		_tmp31_ = self->priv->_map;
		_tmp32_ = mind_map_get_undo_text (_tmp31_);
		_tmp33_ = _tmp32_;
		_tmp34_ = undo_text_buffer_get_orig (_tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = callout_get_text (callout);
		_tmp37_ = _tmp36_;
		canvas_text_copy (_tmp35_, _tmp37_);
		_tmp38_ = self->priv->_map;
		_tmp39_ = mind_map_get_undo_text (_tmp38_);
		_tmp40_ = _tmp39_;
		_tmp41_ = callout_get_text (callout);
		_tmp42_ = _tmp41_;
		undo_text_buffer_set_ct (_tmp40_, _tmp42_);
		_tmp43_ = self->priv->_map;
		_tmp44_ = mind_map_get_undo_text (_tmp43_);
		_tmp45_ = _tmp44_;
		undo_text_buffer_set_do_undo (_tmp45_, undoable);
		callout_set_mode (callout, mode);
	} else {
		gboolean _tmp46_ = FALSE;
		CalloutMode _tmp47_;
		CalloutMode _tmp48_;
		_tmp47_ = callout_get_mode (callout);
		_tmp48_ = _tmp47_;
		if (_tmp48_ == CALLOUT_MODE_EDITABLE) {
			_tmp46_ = mode != CALLOUT_MODE_EDITABLE;
		} else {
			_tmp46_ = FALSE;
		}
		if (_tmp46_) {
			MindMap* _tmp49_;
			DrawArea* _tmp50_;
			DrawArea* _tmp51_;
			GtkIMContext* _tmp52_;
			GtkIMContext* _tmp53_;
			MindMap* _tmp54_;
			DrawArea* _tmp55_;
			DrawArea* _tmp56_;
			GtkIMContext* _tmp57_;
			GtkIMContext* _tmp58_;
			gboolean _tmp59_ = FALSE;
			CanvasText* _tmp60_;
			CanvasText* _tmp61_;
			MindMap* _tmp77_;
			UndoTextBuffer* _tmp78_;
			UndoTextBuffer* _tmp79_;
			MindMap* _tmp80_;
			UndoTextBuffer* _tmp81_;
			UndoTextBuffer* _tmp82_;
			gboolean _tmp83_;
			gboolean _tmp84_;
			MindMap* _tmp94_;
			UndoTextBuffer* _tmp95_;
			UndoTextBuffer* _tmp96_;
			MindMap* _tmp97_;
			UndoTextBuffer* _tmp98_;
			UndoTextBuffer* _tmp99_;
			_tmp49_ = self->priv->_map;
			_tmp50_ = mind_map_get_canvas (_tmp49_);
			_tmp51_ = _tmp50_;
			_tmp52_ = draw_area_get_im_context (_tmp51_);
			_tmp53_ = _tmp52_;
			gtk_im_context_reset (_tmp53_);
			_tmp54_ = self->priv->_map;
			_tmp55_ = mind_map_get_canvas (_tmp54_);
			_tmp56_ = _tmp55_;
			_tmp57_ = draw_area_get_im_context (_tmp56_);
			_tmp58_ = _tmp57_;
			gtk_im_context_focus_out (_tmp58_);
			_tmp60_ = callout_get_text (callout);
			_tmp61_ = _tmp60_;
			if (_tmp61_ != NULL) {
				CanvasText* _tmp62_;
				CanvasText* _tmp63_;
				MindMap* _tmp64_;
				DrawArea* _tmp65_;
				DrawArea* _tmp66_;
				gdouble _tmp67_;
				gdouble _tmp68_;
				MindMap* _tmp69_;
				DrawArea* _tmp70_;
				DrawArea* _tmp71_;
				gdouble _tmp72_;
				gdouble _tmp73_;
				_tmp62_ = callout_get_text (callout);
				_tmp63_ = _tmp62_;
				_tmp64_ = self->priv->_map;
				_tmp65_ = mind_map_get_canvas (_tmp64_);
				_tmp66_ = _tmp65_;
				_tmp67_ = draw_area_get_scaled_x (_tmp66_);
				_tmp68_ = _tmp67_;
				_tmp69_ = self->priv->_map;
				_tmp70_ = mind_map_get_canvas (_tmp69_);
				_tmp71_ = _tmp70_;
				_tmp72_ = draw_area_get_scaled_y (_tmp71_);
				_tmp73_ = _tmp72_;
				_tmp59_ = canvas_text_is_within (_tmp63_, _tmp68_, _tmp73_);
			} else {
				_tmp59_ = FALSE;
			}
			if (_tmp59_) {
				MindMap* _tmp74_;
				DrawArea* _tmp75_;
				DrawArea* _tmp76_;
				_tmp74_ = self->priv->_map;
				_tmp75_ = mind_map_get_canvas (_tmp74_);
				_tmp76_ = _tmp75_;
				draw_area_reset_cursor (_tmp76_);
			}
			_tmp77_ = self->priv->_map;
			_tmp78_ = mind_map_get_undo_text (_tmp77_);
			_tmp79_ = _tmp78_;
			undo_buffer_clear ((UndoBuffer*) _tmp79_);
			_tmp80_ = self->priv->_map;
			_tmp81_ = mind_map_get_undo_text (_tmp80_);
			_tmp82_ = _tmp81_;
			_tmp83_ = undo_text_buffer_get_do_undo (_tmp82_);
			_tmp84_ = _tmp83_;
			if (_tmp84_) {
				MindMap* _tmp85_;
				MindMap* _tmp86_;
				MindMap* _tmp87_;
				UndoTextBuffer* _tmp88_;
				UndoTextBuffer* _tmp89_;
				CanvasText* _tmp90_;
				CanvasText* _tmp91_;
				UndoCalloutText* _tmp92_;
				UndoCalloutText* _tmp93_;
				_tmp85_ = self->priv->_map;
				_tmp86_ = self->priv->_map;
				_tmp87_ = self->priv->_map;
				_tmp88_ = mind_map_get_undo_text (_tmp87_);
				_tmp89_ = _tmp88_;
				_tmp90_ = undo_text_buffer_get_orig (_tmp89_);
				_tmp91_ = _tmp90_;
				_tmp92_ = undo_callout_text_new (_tmp86_, callout, _tmp91_);
				_tmp93_ = _tmp92_;
				mind_map_add_undo (_tmp85_, (UndoItem*) _tmp93_);
				_g_object_unref0 (_tmp93_);
			}
			_tmp94_ = self->priv->_map;
			_tmp95_ = mind_map_get_undo_text (_tmp94_);
			_tmp96_ = _tmp95_;
			undo_text_buffer_set_ct (_tmp96_, NULL);
			_tmp97_ = self->priv->_map;
			_tmp98_ = mind_map_get_undo_text (_tmp97_);
			_tmp99_ = _tmp98_;
			undo_text_buffer_set_do_undo (_tmp99_, FALSE);
			callout_set_mode (callout, mode);
			map_model_auto_save (self);
		} else {
			callout_set_mode (callout, mode);
		}
	}
}

static void
_node_task_info_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (node_task_info_free (var), NULL));
}

static void
_vala_NodeTaskInfo_free_function_content_of (gpointer data)
{
	NodeTaskInfo* self;
	self = *((NodeTaskInfo**) data);
	_node_task_info_free0_ (self);
}

void
map_model_toggle_task (MapModel* self,
                       Node* n)
{
	GArray* changes = NULL;
	GArray* _tmp0_;
	MindMap* _tmp1_;
	GArray* _tmp2_;
	UndoNodeTasks* _tmp3_;
	UndoNodeTasks* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (n != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (NodeTaskInfo*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_NodeTaskInfo_free_function_content_of);
	changes = _tmp0_;
	node_toggle_task_done (n, &changes);
	_tmp1_ = self->priv->_map;
	_tmp2_ = changes;
	_tmp3_ = undo_node_tasks_new (_tmp2_);
	_tmp4_ = _tmp3_;
	mind_map_add_undo (_tmp1_, (UndoItem*) _tmp4_);
	_g_object_unref0 (_tmp4_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (changes);
}

void
map_model_toggle_folds (MapModel* self,
                        gboolean deep)
{
	GArray* parents = NULL;
	GArray* _tmp0_;
	MindMap* _tmp1_;
	Selection* _tmp2_;
	Selection* _tmp3_;
	GArray* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	parents = _tmp0_;
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_selected (_tmp1_);
	_tmp3_ = _tmp2_;
	selection_get_parents (_tmp3_, &parents);
	_tmp4_ = parents;
	if (_tmp4_->len > ((guint) 0)) {
		GArray* changes = NULL;
		GArray* _tmp5_;
		MindMap* _tmp6_;
		Animator* _tmp7_;
		Animator* _tmp8_;
		GArray* _tmp9_;
		GArray* _tmp10_;
		MindMap* _tmp22_;
		GArray* _tmp23_;
		UndoNodeFolds* _tmp24_;
		UndoNodeFolds* _tmp25_;
		MindMap* _tmp26_;
		Animator* _tmp27_;
		Animator* _tmp28_;
		_tmp5_ = g_array_new (TRUE, TRUE, sizeof (Node*));
		g_array_set_clear_func (_tmp5_, (GDestroyNotify) _vala_Node_free_function_content_of);
		changes = _tmp5_;
		_tmp6_ = self->priv->_map;
		_tmp7_ = mind_map_get_animator (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = self->priv->_nodes;
		_tmp10_ = parents;
		animator_add_nodes_fold (_tmp8_, _tmp9_, _tmp10_, "nodes fold");
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					GArray* _tmp13_;
					Node* node = NULL;
					GArray* _tmp14_;
					Node* _tmp15_;
					Node* _tmp16_;
					Node* _tmp17_;
					Node* _tmp18_;
					gboolean _tmp19_;
					gboolean _tmp20_;
					GArray* _tmp21_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ + 1;
					}
					_tmp11_ = FALSE;
					_tmp13_ = parents;
					if (!(((guint) i) < _tmp13_->len)) {
						break;
					}
					_tmp14_ = parents;
					_tmp15_ = g_array_index (_tmp14_, Node*, (guint) i);
					_tmp16_ = _g_object_ref0 (_tmp15_);
					node = _tmp16_;
					_tmp17_ = node;
					_tmp18_ = node;
					_tmp19_ = node_get_folded (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp21_ = changes;
					node_set_fold (_tmp17_, !_tmp20_, deep, _tmp21_);
					_g_object_unref0 (node);
				}
			}
		}
		_tmp22_ = self->priv->_map;
		_tmp23_ = changes;
		_tmp24_ = undo_node_folds_new (_tmp23_);
		_tmp25_ = _tmp24_;
		mind_map_add_undo (_tmp22_, (UndoItem*) _tmp25_);
		_g_object_unref0 (_tmp25_);
		_tmp26_ = self->priv->_map;
		_tmp27_ = mind_map_get_animator (_tmp26_);
		_tmp28_ = _tmp27_;
		animator_animate (_tmp28_);
		map_model_auto_save (self);
		_g_array_unref0 (changes);
	}
	_g_array_unref0 (parents);
}

void
map_model_remove_tag (MapModel* self,
                      Tag* tag,
                      GArray* nodes)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (tag != NULL);
	g_return_if_fail (nodes != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				node_remove_tag (_tmp4_, tag, nodes);
			}
		}
	}
}

void
map_model_highlight_tags (MapModel* self,
                          Tags* tags,
                          TagComboType combo_type)
{
	Connections* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (tags != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				node_highlight_tags (_tmp4_, tags, combo_type);
			}
		}
	}
	_tmp5_ = self->priv->_connections;
	connections_update_alpha (_tmp5_);
}

void
map_model_add_group (MapModel* self)
{
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	if (selection_num_groups (_tmp2_) > 1) {
		GArray* selgroups = NULL;
		MindMap* _tmp3_;
		Selection* _tmp4_;
		Selection* _tmp5_;
		GArray* _tmp6_;
		NodeGroup* merged = NULL;
		NodeGroups* _tmp7_;
		NodeGroups* _tmp8_;
		GArray* _tmp9_;
		NodeGroup* _tmp10_;
		NodeGroup* _tmp11_;
		_tmp3_ = self->priv->_map;
		_tmp4_ = mind_map_get_selected (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = selection_groups (_tmp5_);
		selgroups = _tmp6_;
		_tmp7_ = map_model_get_groups (self);
		_tmp8_ = _tmp7_;
		_tmp9_ = selgroups;
		_tmp10_ = node_groups_merge_groups (_tmp8_, _tmp9_);
		merged = _tmp10_;
		_tmp11_ = merged;
		if (_tmp11_ != NULL) {
			MindMap* _tmp12_;
			GArray* _tmp13_;
			NodeGroup* _tmp14_;
			UndoGroupsMerge* _tmp15_;
			UndoGroupsMerge* _tmp16_;
			MindMap* _tmp17_;
			NodeGroup* _tmp18_;
			_tmp12_ = self->priv->_map;
			_tmp13_ = selgroups;
			_tmp14_ = merged;
			_tmp15_ = undo_groups_merge_new (_tmp13_, _tmp14_);
			_tmp16_ = _tmp15_;
			mind_map_add_undo (_tmp12_, (UndoItem*) _tmp16_);
			_g_object_unref0 (_tmp16_);
			_tmp17_ = self->priv->_map;
			_tmp18_ = merged;
			mind_map_set_current_group (_tmp17_, _tmp18_);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
			map_model_auto_save (self);
		}
		_g_object_unref0 (merged);
		_g_array_unref0 (selgroups);
	} else {
		MindMap* _tmp19_;
		Selection* _tmp20_;
		Selection* _tmp21_;
		_tmp19_ = self->priv->_map;
		_tmp20_ = mind_map_get_selected (_tmp19_);
		_tmp21_ = _tmp20_;
		if (selection_num_nodes (_tmp21_) > 0) {
			GArray* nodes = NULL;
			MindMap* _tmp22_;
			Selection* _tmp23_;
			Selection* _tmp24_;
			GArray* _tmp25_;
			NodeGroup* group = NULL;
			MindMap* _tmp26_;
			GArray* _tmp27_;
			NodeGroup* _tmp28_;
			NodeGroups* _tmp29_;
			NodeGroups* _tmp30_;
			NodeGroup* _tmp31_;
			MindMap* _tmp32_;
			NodeGroup* _tmp33_;
			UndoGroupAdd* _tmp34_;
			UndoGroupAdd* _tmp35_;
			_tmp22_ = self->priv->_map;
			_tmp23_ = mind_map_get_selected (_tmp22_);
			_tmp24_ = _tmp23_;
			_tmp25_ = selection_nodes (_tmp24_);
			nodes = _tmp25_;
			_tmp26_ = self->priv->_map;
			_tmp27_ = nodes;
			_tmp28_ = node_group_new_array (_tmp26_, _tmp27_);
			group = _tmp28_;
			_tmp29_ = map_model_get_groups (self);
			_tmp30_ = _tmp29_;
			_tmp31_ = group;
			node_groups_add_group (_tmp30_, _tmp31_);
			_tmp32_ = self->priv->_map;
			_tmp33_ = group;
			_tmp34_ = undo_group_add_new (_tmp33_);
			_tmp35_ = _tmp34_;
			mind_map_add_undo (_tmp32_, (UndoItem*) _tmp35_);
			_g_object_unref0 (_tmp35_);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
			map_model_auto_save (self);
			_g_object_unref0 (group);
			_g_array_unref0 (nodes);
		}
	}
}

void
map_model_remove_groups (MapModel* self)
{
	GArray* selgroups = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	MindMap* _tmp12_;
	GArray* _tmp13_;
	UndoGroupsRemove* _tmp14_;
	UndoGroupsRemove* _tmp15_;
	MindMap* _tmp16_;
	Selection* _tmp17_;
	Selection* _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_groups (_tmp2_);
	selgroups = _tmp3_;
	_tmp4_ = selgroups;
	if (_tmp4_->len == ((guint) 0)) {
		_g_array_unref0 (selgroups);
		return;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				GArray* _tmp7_;
				NodeGroups* _tmp8_;
				NodeGroups* _tmp9_;
				GArray* _tmp10_;
				NodeGroup* _tmp11_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = selgroups;
				if (!(((guint) i) < _tmp7_->len)) {
					break;
				}
				_tmp8_ = map_model_get_groups (self);
				_tmp9_ = _tmp8_;
				_tmp10_ = selgroups;
				_tmp11_ = g_array_index (_tmp10_, NodeGroup*, (guint) i);
				node_groups_remove_group (_tmp9_, _tmp11_);
			}
		}
	}
	_tmp12_ = self->priv->_map;
	_tmp13_ = selgroups;
	_tmp14_ = undo_groups_remove_new (_tmp13_);
	_tmp15_ = _tmp14_;
	mind_map_add_undo (_tmp12_, (UndoItem*) _tmp15_);
	_g_object_unref0 (_tmp15_);
	_tmp16_ = self->priv->_map;
	_tmp17_ = mind_map_get_selected (_tmp16_);
	_tmp18_ = _tmp17_;
	selection_clear (_tmp18_, TRUE, 1.0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (selgroups);
}

void
map_model_change_group_color (MapModel* self,
                              GdkRGBA* color)
{
	GArray* selgroups = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	MindMap* _tmp5_;
	GArray* _tmp6_;
	GdkRGBA _tmp7_;
	UndoGroupsColor* _tmp8_;
	UndoGroupsColor* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (color != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_groups (_tmp2_);
	selgroups = _tmp3_;
	_tmp4_ = selgroups;
	if (_tmp4_->len == ((guint) 0)) {
		_g_array_unref0 (selgroups);
		return;
	}
	_tmp5_ = self->priv->_map;
	_tmp6_ = selgroups;
	_tmp7_ = *color;
	_tmp8_ = undo_groups_color_new (_tmp6_, &_tmp7_);
	_tmp9_ = _tmp8_;
	mind_map_add_undo (_tmp5_, (UndoItem*) _tmp9_);
	_g_object_unref0 (_tmp9_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp10_ = FALSE;
			_tmp10_ = TRUE;
			while (TRUE) {
				GArray* _tmp12_;
				GArray* _tmp13_;
				NodeGroup* _tmp14_;
				GdkRGBA _tmp15_;
				if (!_tmp10_) {
					gint _tmp11_;
					_tmp11_ = i;
					i = _tmp11_ + 1;
				}
				_tmp10_ = FALSE;
				_tmp12_ = selgroups;
				if (!(((guint) i) < _tmp12_->len)) {
					break;
				}
				_tmp13_ = selgroups;
				_tmp14_ = g_array_index (_tmp13_, NodeGroup*, (guint) i);
				_tmp15_ = *color;
				node_group_set_color (_tmp14_, &_tmp15_);
			}
		}
	}
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (selgroups);
}

gboolean
map_model_node_has_callout (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Node* _tmp1_;
	gboolean _tmp2_ = FALSE;
	Node* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_node (_tmp0_);
	current = _tmp1_;
	_tmp3_ = current;
	if (_tmp3_ != NULL) {
		Node* _tmp4_;
		Callout* _tmp5_;
		Callout* _tmp6_;
		_tmp4_ = current;
		_tmp5_ = node_get_callout (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp2_ = _tmp6_ != NULL;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_g_object_unref0 (current);
	return result;
}

void
map_model_add_callout (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	gboolean _tmp4_ = FALSE;
	Node* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp5_ = current;
	if (_tmp5_ != NULL) {
		Node* _tmp6_;
		Callout* _tmp7_;
		Callout* _tmp8_;
		_tmp6_ = current;
		_tmp7_ = node_get_callout (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_ == NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		MindMap* _tmp9_;
		Node* _tmp10_;
		UndoNodeCallout* _tmp11_;
		UndoNodeCallout* _tmp12_;
		Node* _tmp13_;
		Node* _tmp14_;
		Callout* _tmp15_;
		Callout* _tmp16_;
		Node* _tmp17_;
		Callout* _tmp18_;
		Callout* _tmp19_;
		MindMap* _tmp20_;
		Style* _tmp21_;
		Style* _tmp22_;
		gdouble _tmp23_ = 0.0;
		MindMap* _tmp24_;
		gboolean _tmp25_;
		gboolean _tmp26_;
		MindMap* _tmp30_;
		Selection* _tmp31_;
		Selection* _tmp32_;
		Node* _tmp33_;
		Callout* _tmp34_;
		Callout* _tmp35_;
		Node* _tmp36_;
		Callout* _tmp37_;
		Callout* _tmp38_;
		_tmp9_ = self->priv->_map;
		_tmp10_ = current;
		_tmp11_ = undo_node_callout_new (_tmp10_);
		_tmp12_ = _tmp11_;
		mind_map_add_undo (_tmp9_, (UndoItem*) _tmp12_);
		_g_object_unref0 (_tmp12_);
		_tmp13_ = current;
		_tmp14_ = current;
		_tmp15_ = callout_new (_tmp14_);
		_tmp16_ = _tmp15_;
		node_set_callout (_tmp13_, _tmp16_);
		_g_object_unref0 (_tmp16_);
		_tmp17_ = current;
		_tmp18_ = node_get_callout (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = self->priv->_map;
		_tmp21_ = mind_map_get_global_style (_tmp20_);
		_tmp22_ = _tmp21_;
		callout_set_style (_tmp19_, _tmp22_);
		_tmp24_ = self->priv->_map;
		_tmp25_ = mind_map_get_focus_mode (_tmp24_);
		_tmp26_ = _tmp25_;
		if (_tmp26_) {
			MindMap* _tmp27_;
			gdouble _tmp28_;
			gdouble _tmp29_;
			_tmp27_ = self->priv->_map;
			_tmp28_ = mind_map_get_focus_alpha (_tmp27_);
			_tmp29_ = _tmp28_;
			_tmp23_ = _tmp29_;
		} else {
			_tmp23_ = 1.0;
		}
		_tmp30_ = self->priv->_map;
		_tmp31_ = mind_map_get_selected (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp33_ = current;
		_tmp34_ = node_get_callout (_tmp33_);
		_tmp35_ = _tmp34_;
		selection_set_current_callout (_tmp32_, _tmp35_, _tmp23_);
		_tmp36_ = current;
		_tmp37_ = node_get_callout (_tmp36_);
		_tmp38_ = _tmp37_;
		map_model_set_callout_mode (self, _tmp38_, CALLOUT_MODE_EDITABLE, TRUE);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
	}
	_g_object_unref0 (current);
}

void
map_model_remove_callout (MapModel* self)
{
	MindMap* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	if (mind_map_is_node_selected (_tmp0_)) {
		Node* current = NULL;
		MindMap* _tmp1_;
		Selection* _tmp2_;
		Selection* _tmp3_;
		Node* _tmp4_;
		Node* _tmp5_;
		Callout* _tmp6_;
		Callout* _tmp7_;
		_tmp1_ = self->priv->_map;
		_tmp2_ = mind_map_get_selected (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = selection_current_node (_tmp3_);
		current = _tmp4_;
		_tmp5_ = current;
		_tmp6_ = node_get_callout (_tmp5_);
		_tmp7_ = _tmp6_;
		if (_tmp7_ != NULL) {
			MindMap* _tmp8_;
			Node* _tmp9_;
			UndoNodeCallout* _tmp10_;
			UndoNodeCallout* _tmp11_;
			Node* _tmp12_;
			_tmp8_ = self->priv->_map;
			_tmp9_ = current;
			_tmp10_ = undo_node_callout_new (_tmp9_);
			_tmp11_ = _tmp10_;
			mind_map_add_undo (_tmp8_, (UndoItem*) _tmp11_);
			_g_object_unref0 (_tmp11_);
			_tmp12_ = current;
			node_set_callout (_tmp12_, NULL);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
			map_model_auto_save (self);
		}
		_g_object_unref0 (current);
	} else {
		MindMap* _tmp13_;
		_tmp13_ = self->priv->_map;
		if (mind_map_is_callout_selected (_tmp13_)) {
			Node* current = NULL;
			MindMap* _tmp14_;
			Selection* _tmp15_;
			Selection* _tmp16_;
			Callout* _tmp17_;
			Callout* _tmp18_;
			Node* _tmp19_;
			Node* _tmp20_;
			Node* _tmp21_;
			Node* _tmp22_;
			MindMap* _tmp23_;
			Node* _tmp24_;
			UndoNodeCallout* _tmp25_;
			UndoNodeCallout* _tmp26_;
			Node* _tmp27_;
			_tmp14_ = self->priv->_map;
			_tmp15_ = mind_map_get_selected (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = selection_current_callout (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = callout_get_node (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = _g_object_ref0 (_tmp20_);
			_tmp22_ = _tmp21_;
			_g_object_unref0 (_tmp18_);
			current = _tmp22_;
			_tmp23_ = self->priv->_map;
			_tmp24_ = current;
			_tmp25_ = undo_node_callout_new (_tmp24_);
			_tmp26_ = _tmp25_;
			mind_map_add_undo (_tmp23_, (UndoItem*) _tmp26_);
			_g_object_unref0 (_tmp26_);
			_tmp27_ = current;
			node_set_callout (_tmp27_, NULL);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
			map_model_auto_save (self);
			_g_object_unref0 (current);
		}
	}
}

void
map_model_change_current_connection_title (MapModel* self,
                                           const gchar* title)
{
	GArray* conns = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (title != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_connections (_tmp2_);
	conns = _tmp3_;
	_tmp4_ = conns;
	if (_tmp4_->len == ((guint) 1)) {
		Connection* current = NULL;
		GArray* _tmp5_;
		Connection* _tmp6_;
		Connection* _tmp7_;
		Connection* _tmp8_;
		CanvasText* _tmp9_;
		CanvasText* _tmp10_;
		FormattedText* _tmp11_;
		FormattedText* _tmp12_;
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		_tmp5_ = conns;
		_tmp6_ = g_array_index (_tmp5_, Connection*, (guint) 0);
		_tmp7_ = _g_object_ref0 (_tmp6_);
		current = _tmp7_;
		_tmp8_ = current;
		_tmp9_ = connection_get_title (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = canvas_text_get_text (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = formatted_text_get_text (_tmp12_);
		_tmp14_ = _tmp13_;
		if (g_strcmp0 (_tmp14_, title) != 0) {
			CanvasText* orig_title = NULL;
			MindMap* _tmp15_;
			CanvasText* _tmp16_;
			CanvasText* _tmp17_;
			Connection* _tmp18_;
			CanvasText* _tmp19_;
			CanvasText* _tmp20_;
			Connection* _tmp21_;
			MindMap* _tmp22_;
			MindMap* _tmp23_;
			MindMap* _tmp24_;
			Connection* _tmp25_;
			CanvasText* _tmp26_;
			UndoConnectionTitle* _tmp27_;
			UndoConnectionTitle* _tmp28_;
			_tmp15_ = self->priv->_map;
			_tmp16_ = canvas_text_new (_tmp15_);
			orig_title = _tmp16_;
			_tmp17_ = orig_title;
			_tmp18_ = current;
			_tmp19_ = connection_get_title (_tmp18_);
			_tmp20_ = _tmp19_;
			canvas_text_copy (_tmp17_, _tmp20_);
			_tmp21_ = current;
			_tmp22_ = self->priv->_map;
			connection_change_title (_tmp21_, _tmp22_, title, FALSE);
			_tmp23_ = self->priv->_map;
			_tmp24_ = self->priv->_map;
			_tmp25_ = current;
			_tmp26_ = orig_title;
			_tmp27_ = undo_connection_title_new (_tmp24_, _tmp25_, _tmp26_);
			_tmp28_ = _tmp27_;
			mind_map_add_undo (_tmp23_, (UndoItem*) _tmp28_);
			_g_object_unref0 (_tmp28_);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
			map_model_auto_save (self);
			_g_object_unref0 (orig_title);
		}
		_g_object_unref0 (current);
	}
	_g_array_unref0 (conns);
}

static gpointer
_node_task_info_dup0 (gpointer self)
{
	return self ? node_task_info_dup (self) : NULL;
}

static void
map_model_change_task (MapModel* self,
                       Node* node,
                       gboolean enable,
                       gboolean done,
                       GArray* changes)
{
	gboolean _tmp0_ = FALSE;
	NodeTaskInfo _tmp1_ = {0};
	NodeTaskInfo _tmp2_;
	NodeTaskInfo* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	g_return_if_fail (changes != NULL);
	if (node_task_enabled (node) == enable) {
		_tmp0_ = node_task_done (node) == done;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	node_task_info_init (&_tmp1_, node_task_enabled (node), node_task_done (node), node);
	_tmp2_ = _tmp1_;
	_tmp3_ = _node_task_info_dup0 (&_tmp2_);
	g_array_append_val (changes, _tmp3_);
	node_task_info_destroy (&_tmp2_);
	node_enable_task (node, enable);
	node_set_task_done (node, done);
}

void
map_model_change_current_task (MapModel* self,
                               gboolean enable,
                               gboolean done)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	MindMap* _tmp5_;
	Animator* _tmp6_;
	Animator* _tmp7_;
	GArray* _tmp8_;
	GArray* changes = NULL;
	GArray* _tmp9_;
	GArray* _tmp10_;
	Node* _tmp11_;
	GArray* _tmp12_;
	GArray* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	if (_tmp4_->len != ((guint) 1)) {
		_g_array_unref0 (nodes);
		return;
	}
	_tmp5_ = self->priv->_map;
	_tmp6_ = mind_map_get_animator (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->priv->_nodes;
	animator_add_nodes (_tmp7_, _tmp8_, FALSE, "change current task");
	_tmp9_ = g_array_new (TRUE, TRUE, sizeof (NodeTaskInfo*));
	g_array_set_clear_func (_tmp9_, (GDestroyNotify) _vala_NodeTaskInfo_free_function_content_of);
	changes = _tmp9_;
	_tmp10_ = nodes;
	_tmp11_ = g_array_index (_tmp10_, Node*, (guint) 0);
	_tmp12_ = changes;
	map_model_change_task (self, _tmp11_, enable, done, _tmp12_);
	_tmp13_ = changes;
	if (_tmp13_->len > ((guint) 0)) {
		MindMap* _tmp14_;
		GArray* _tmp15_;
		UndoNodeTasks* _tmp16_;
		UndoNodeTasks* _tmp17_;
		MindMap* _tmp18_;
		Animator* _tmp19_;
		Animator* _tmp20_;
		_tmp14_ = self->priv->_map;
		_tmp15_ = changes;
		_tmp16_ = undo_node_tasks_new (_tmp15_);
		_tmp17_ = _tmp16_;
		mind_map_add_undo (_tmp14_, (UndoItem*) _tmp17_);
		_g_object_unref0 (_tmp17_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
		_tmp18_ = self->priv->_map;
		_tmp19_ = mind_map_get_animator (_tmp18_);
		_tmp20_ = _tmp19_;
		animator_animate (_tmp20_);
		map_model_auto_save (self);
	} else {
		MindMap* _tmp21_;
		Animator* _tmp22_;
		Animator* _tmp23_;
		_tmp21_ = self->priv->_map;
		_tmp22_ = mind_map_get_animator (_tmp21_);
		_tmp23_ = _tmp22_;
		animator_cancel_last_add (_tmp23_);
	}
	_g_array_unref0 (changes);
	_g_array_unref0 (nodes);
}

void
map_model_change_selected_tasks (MapModel* self)
{
	GArray* parents = NULL;
	GArray* _tmp0_;
	GArray* changes = NULL;
	GArray* _tmp1_;
	gboolean all_enabled = FALSE;
	gboolean all_done = FALSE;
	MindMap* _tmp2_;
	Selection* _tmp3_;
	Selection* _tmp4_;
	GArray* _tmp31_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	parents = _tmp0_;
	_tmp1_ = g_array_new (TRUE, TRUE, sizeof (NodeTaskInfo*));
	g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_NodeTaskInfo_free_function_content_of);
	changes = _tmp1_;
	all_enabled = TRUE;
	all_done = TRUE;
	_tmp2_ = self->priv->_map;
	_tmp3_ = mind_map_get_selected (_tmp2_);
	_tmp4_ = _tmp3_;
	selection_get_parents (_tmp4_, &parents);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				GArray* _tmp7_;
				Node* node = NULL;
				GArray* _tmp8_;
				Node* _tmp9_;
				Node* _tmp10_;
				Node* _tmp11_;
				Node* _tmp12_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = parents;
				if (!(((guint) i) < _tmp7_->len)) {
					break;
				}
				_tmp8_ = parents;
				_tmp9_ = g_array_index (_tmp8_, Node*, (guint) i);
				_tmp10_ = _g_object_ref0 (_tmp9_);
				node = _tmp10_;
				_tmp11_ = node;
				all_enabled &= node_task_enabled (_tmp11_);
				_tmp12_ = node;
				all_done &= node_task_done (_tmp12_);
				_g_object_unref0 (node);
			}
		}
	}
	if (all_enabled) {
		if (all_done) {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp13_ = FALSE;
					_tmp13_ = TRUE;
					while (TRUE) {
						GArray* _tmp15_;
						GArray* _tmp16_;
						Node* _tmp17_;
						GArray* _tmp18_;
						if (!_tmp13_) {
							gint _tmp14_;
							_tmp14_ = i;
							i = _tmp14_ + 1;
						}
						_tmp13_ = FALSE;
						_tmp15_ = parents;
						if (!(((guint) i) < _tmp15_->len)) {
							break;
						}
						_tmp16_ = parents;
						_tmp17_ = g_array_index (_tmp16_, Node*, (guint) i);
						_tmp18_ = changes;
						map_model_change_task (self, _tmp17_, FALSE, FALSE, _tmp18_);
					}
				}
			}
		} else {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp19_ = FALSE;
					_tmp19_ = TRUE;
					while (TRUE) {
						GArray* _tmp21_;
						GArray* _tmp22_;
						Node* _tmp23_;
						GArray* _tmp24_;
						if (!_tmp19_) {
							gint _tmp20_;
							_tmp20_ = i;
							i = _tmp20_ + 1;
						}
						_tmp19_ = FALSE;
						_tmp21_ = parents;
						if (!(((guint) i) < _tmp21_->len)) {
							break;
						}
						_tmp22_ = parents;
						_tmp23_ = g_array_index (_tmp22_, Node*, (guint) i);
						_tmp24_ = changes;
						map_model_change_task (self, _tmp23_, TRUE, TRUE, _tmp24_);
					}
				}
			}
		}
	} else {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp25_ = FALSE;
				_tmp25_ = TRUE;
				while (TRUE) {
					GArray* _tmp27_;
					GArray* _tmp28_;
					Node* _tmp29_;
					GArray* _tmp30_;
					if (!_tmp25_) {
						gint _tmp26_;
						_tmp26_ = i;
						i = _tmp26_ + 1;
					}
					_tmp25_ = FALSE;
					_tmp27_ = parents;
					if (!(((guint) i) < _tmp27_->len)) {
						break;
					}
					_tmp28_ = parents;
					_tmp29_ = g_array_index (_tmp28_, Node*, (guint) i);
					_tmp30_ = changes;
					map_model_change_task (self, _tmp29_, TRUE, FALSE, _tmp30_);
				}
			}
		}
	}
	_tmp31_ = changes;
	if (_tmp31_->len > ((guint) 0)) {
		MindMap* _tmp32_;
		GArray* _tmp33_;
		UndoNodeTasks* _tmp34_;
		UndoNodeTasks* _tmp35_;
		_tmp32_ = self->priv->_map;
		_tmp33_ = changes;
		_tmp34_ = undo_node_tasks_new (_tmp33_);
		_tmp35_ = _tmp34_;
		mind_map_add_undo (_tmp32_, (UndoItem*) _tmp35_);
		_g_object_unref0 (_tmp35_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
	}
	_g_array_unref0 (changes);
	_g_array_unref0 (parents);
}

void
map_model_change_current_node_note (MapModel* self,
                                    const gchar* note)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (note != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	if (_tmp4_->len == ((guint) 1)) {
		GArray* _tmp5_;
		Node* _tmp6_;
		_tmp5_ = nodes;
		_tmp6_ = g_array_index (_tmp5_, Node*, (guint) 0);
		node_set_note (_tmp6_, note);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
	}
	_g_array_unref0 (nodes);
}

gint
map_model_add_note_node_link (MapModel* self,
                              NodeLink* link,
                              gchar** text)
{
	gchar* _vala_text = NULL;
	MindMap* _tmp0_;
	MindMap* _tmp1_;
	gchar* _tmp2_;
	NodeLinks* _tmp3_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (link != NULL, -1);
	_tmp0_ = self->priv->_map;
	node_link_normalize (link, _tmp0_);
	_tmp1_ = self->priv->_map;
	_tmp2_ = node_link_get_markdown_text (link, _tmp1_);
	_g_free0 (_vala_text);
	_vala_text = _tmp2_;
	_tmp3_ = self->priv->_node_links;
	result = node_links_add_link (_tmp3_, link);
	if (text) {
		*text = _vala_text;
	} else {
		_g_free0 (_vala_text);
	}
	return result;
}

void
map_model_note_node_link_clicked (MapModel* self,
                                  gint id)
{
	NodeLink* link = NULL;
	NodeLinks* _tmp0_;
	NodeLink* _tmp1_;
	NodeLink* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_node_links;
	_tmp1_ = node_links_get_node_link (_tmp0_, id);
	link = _tmp1_;
	_tmp2_ = link;
	if (_tmp2_ != NULL) {
		NodeLink* _tmp3_;
		MindMap* _tmp4_;
		_tmp3_ = link;
		_tmp4_ = self->priv->_map;
		node_link_select (_tmp3_, _tmp4_);
	}
	_node_link_unref0 (link);
}

gboolean
map_model_add_link_possible (MapModel* self,
                             CanvasText* ct)
{
	gint cursor = 0;
	gint selstart = 0;
	gint selend = 0;
	gboolean _tmp9_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (ct != NULL, FALSE);
	if (canvas_text_is_selected (ct)) {
		gint _tmp0_ = 0;
		gint _tmp1_ = 0;
		gint _tmp2_ = 0;
		canvas_text_get_cursor_info (ct, &_tmp0_, &_tmp1_, &_tmp2_);
		cursor = _tmp0_;
		selstart = _tmp1_;
		selend = _tmp2_;
	} else {
		FormattedText* _tmp3_;
		FormattedText* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		selstart = 0;
		_tmp3_ = canvas_text_get_text (ct);
		_tmp4_ = _tmp3_;
		_tmp5_ = formatted_text_get_text (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		selend = _tmp8_;
	}
	if (selstart != selend) {
		FormattedText* _tmp10_;
		FormattedText* _tmp11_;
		_tmp10_ = canvas_text_get_text (ct);
		_tmp11_ = _tmp10_;
		_tmp9_ = !formatted_text_is_tag_applied_in_range (_tmp11_, FORMAT_TAG_URL, selstart, selend);
	} else {
		_tmp9_ = FALSE;
	}
	result = _tmp9_;
	return result;
}

void
map_model_change_current_connection_note (MapModel* self,
                                          const gchar* note)
{
	GArray* conns = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (note != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_connections (_tmp2_);
	conns = _tmp3_;
	_tmp4_ = conns;
	if (_tmp4_->len == ((guint) 1)) {
		GArray* _tmp5_;
		Connection* _tmp6_;
		_tmp5_ = conns;
		_tmp6_ = g_array_index (_tmp5_, Connection*, (guint) 0);
		connection_set_note (_tmp6_, note);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
	}
	_g_array_unref0 (conns);
}

static void
___lambda107_ (MapModel* self,
               gint id)
{
	Node* curr = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	ImageManager* _tmp5_;
	ImageManager* _tmp6_;
	Node* _tmp7_;
	Style* _tmp8_;
	Style* _tmp9_;
	gint* _tmp10_;
	gint* _tmp11_;
	NodeImage* _tmp12_;
	NodeImage* _tmp13_;
	Node* _tmp14_;
	NodeImage* _tmp15_;
	NodeImage* _tmp16_;
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	curr = _tmp3_;
	_tmp4_ = curr;
	_tmp5_ = self->priv->_image_manager;
	_tmp6_ = self->priv->_image_manager;
	_tmp7_ = curr;
	_tmp8_ = node_get_style (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = style_get_node_width (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = node_image_new (_tmp6_, id, *_tmp11_);
	_tmp13_ = _tmp12_;
	node_set_image (_tmp4_, _tmp5_, _tmp13_);
	_node_image_unref0 (_tmp13_);
	_tmp14_ = curr;
	_tmp15_ = node_get_image (_tmp14_);
	_tmp16_ = _tmp15_;
	if (_tmp16_ != NULL) {
		MindMap* _tmp17_;
		Node* _tmp18_;
		UndoNodeImage* _tmp19_;
		UndoNodeImage* _tmp20_;
		_tmp17_ = self->priv->_map;
		_tmp18_ = curr;
		_tmp19_ = undo_node_image_new (_tmp18_, NULL);
		_tmp20_ = _tmp19_;
		mind_map_add_undo (_tmp17_, (UndoItem*) _tmp20_);
		_g_object_unref0 (_tmp20_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
		map_model_auto_save (self);
	}
	_g_object_unref0 (curr);
}

static void
____lambda107__image_id_func (gint id,
                              gpointer self)
{
	___lambda107_ ((MapModel*) self, id);
}

void
map_model_add_current_image (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	gboolean _tmp4_ = FALSE;
	Node* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp5_ = current;
	if (_tmp5_ != NULL) {
		Node* _tmp6_;
		NodeImage* _tmp7_;
		NodeImage* _tmp8_;
		_tmp6_ = current;
		_tmp7_ = node_get_image (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_ == NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		ImageManager* _tmp9_;
		MindMap* _tmp10_;
		MainWindow* _tmp11_;
		MainWindow* _tmp12_;
		_tmp9_ = self->priv->_image_manager;
		_tmp10_ = self->priv->_map;
		_tmp11_ = mind_map_get_win (_tmp10_);
		_tmp12_ = _tmp11_;
		image_manager_choose_image (_tmp9_, (GtkWindow*) _tmp12_, ____lambda107__image_id_func, self);
	}
	_g_object_unref0 (current);
}

static gpointer
_node_image_ref0 (gpointer self)
{
	return self ? node_image_ref (self) : NULL;
}

void
map_model_delete_current_image (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	if (_tmp4_->len == ((guint) 1)) {
		Node* current = NULL;
		GArray* _tmp5_;
		Node* _tmp6_;
		Node* _tmp7_;
		NodeImage* orig_image = NULL;
		Node* _tmp8_;
		NodeImage* _tmp9_;
		NodeImage* _tmp10_;
		NodeImage* _tmp11_;
		NodeImage* _tmp12_;
		_tmp5_ = nodes;
		_tmp6_ = g_array_index (_tmp5_, Node*, (guint) 0);
		_tmp7_ = _g_object_ref0 (_tmp6_);
		current = _tmp7_;
		_tmp8_ = current;
		_tmp9_ = node_get_image (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = _node_image_ref0 (_tmp10_);
		orig_image = _tmp11_;
		_tmp12_ = orig_image;
		if (_tmp12_ != NULL) {
			Node* _tmp13_;
			ImageManager* _tmp14_;
			MindMap* _tmp15_;
			Node* _tmp16_;
			NodeImage* _tmp17_;
			UndoNodeImage* _tmp18_;
			UndoNodeImage* _tmp19_;
			_tmp13_ = current;
			_tmp14_ = self->priv->_image_manager;
			node_set_image (_tmp13_, _tmp14_, NULL);
			_tmp15_ = self->priv->_map;
			_tmp16_ = current;
			_tmp17_ = orig_image;
			_tmp18_ = undo_node_image_new (_tmp16_, _tmp17_);
			_tmp19_ = _tmp18_;
			mind_map_add_undo (_tmp15_, (UndoItem*) _tmp19_);
			_g_object_unref0 (_tmp19_);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
			g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
			map_model_auto_save (self);
		}
		_node_image_unref0 (orig_image);
		_g_object_unref0 (current);
	}
	_g_array_unref0 (nodes);
}

void
map_model_edit_current_image (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	if (_tmp4_->len == ((guint) 1)) {
		Node* current = NULL;
		GArray* _tmp5_;
		Node* _tmp6_;
		Node* _tmp7_;
		Node* _tmp8_;
		NodeImage* _tmp9_;
		NodeImage* _tmp10_;
		_tmp5_ = nodes;
		_tmp6_ = g_array_index (_tmp5_, Node*, (guint) 0);
		_tmp7_ = _g_object_ref0 (_tmp6_);
		current = _tmp7_;
		_tmp8_ = current;
		_tmp9_ = node_get_image (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_ != NULL) {
			MindMap* _tmp11_;
			DrawArea* _tmp12_;
			DrawArea* _tmp13_;
			ImageEditor* _tmp14_;
			ImageEditor* _tmp15_;
			ImageManager* _tmp16_;
			Node* _tmp17_;
			Node* _tmp18_;
			gdouble _tmp19_;
			gdouble _tmp20_;
			Node* _tmp21_;
			gdouble _tmp22_;
			gdouble _tmp23_;
			_tmp11_ = self->priv->_map;
			_tmp12_ = mind_map_get_canvas (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = draw_area_get_image_editor (_tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = self->priv->_image_manager;
			_tmp17_ = current;
			_tmp18_ = current;
			_tmp19_ = node_get_posx (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = current;
			_tmp22_ = node_get_posy (_tmp21_);
			_tmp23_ = _tmp22_;
			image_editor_edit_image (_tmp15_, _tmp16_, _tmp17_, _tmp20_, _tmp23_);
		}
		_g_object_unref0 (current);
	}
	_g_array_unref0 (nodes);
}

void
map_model_current_image_edited (MapModel* self,
                                NodeImage* orig_image)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	MindMap* _tmp4_;
	UndoNodeImage* _tmp5_;
	UndoNodeImage* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = self->priv->_map;
	_tmp5_ = undo_node_image_new (current, orig_image);
	_tmp6_ = _tmp5_;
	mind_map_add_undo (_tmp4_, (UndoItem*) _tmp6_);
	_g_object_unref0 (_tmp6_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	map_model_auto_save (self);
	_g_object_unref0 (current);
}

void
map_model_end_link (MapModel* self,
                    Node* node)
{
	Connection* connection = NULL;
	MindMap* _tmp0_;
	Connection* _tmp1_;
	Connection* _tmp2_;
	Connection* _tmp3_;
	Node* _tmp4_;
	MindMap* _tmp5_;
	Selection* _tmp6_;
	Selection* _tmp7_;
	Node* _tmp8_;
	NodeLink* _tmp9_;
	NodeLink* _tmp10_;
	MindMap* _tmp11_;
	Node* _tmp12_;
	UndoNodeLink* _tmp13_;
	UndoNodeLink* _tmp14_;
	MindMap* _tmp15_;
	DrawArea* _tmp16_;
	DrawArea* _tmp17_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_connection (_tmp0_);
	connection = _tmp1_;
	_tmp2_ = connection;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (connection);
		return;
	}
	_tmp3_ = connection;
	_tmp4_ = self->priv->_last_node;
	connection_disconnect_node (_tmp3_, _tmp4_);
	_tmp5_ = self->priv->_map;
	_tmp6_ = mind_map_get_selected (_tmp5_);
	_tmp7_ = _tmp6_;
	selection_clear_connections (_tmp7_, TRUE, 1.0);
	_tmp8_ = self->priv->_last_node;
	_tmp9_ = node_link_new (node);
	_tmp10_ = _tmp9_;
	node_set_linked_node (_tmp8_, _tmp10_);
	_node_link_unref0 (_tmp10_);
	_tmp11_ = self->priv->_map;
	_tmp12_ = self->priv->_last_node;
	_tmp13_ = undo_node_link_new (_tmp12_, NULL);
	_tmp14_ = _tmp13_;
	mind_map_add_undo (_tmp11_, (UndoItem*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	_tmp15_ = self->priv->_map;
	_tmp16_ = mind_map_get_canvas (_tmp15_);
	_tmp17_ = _tmp16_;
	draw_area_set_last_connection (_tmp17_, NULL);
	_g_object_unref0 (self->priv->_last_node);
	self->priv->_last_node = NULL;
	map_model_set_attach_node (self, NULL, NODE_MODE_ATTACHABLE);
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_object_unref0 (connection);
}

gboolean
map_model_any_selected_nodes_linked (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				GArray* _tmp6_;
				GArray* _tmp7_;
				Node* _tmp8_;
				NodeLink* _tmp9_;
				NodeLink* _tmp10_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp6_ = nodes;
				if (!(((guint) i) < _tmp6_->len)) {
					break;
				}
				_tmp7_ = nodes;
				_tmp8_ = g_array_index (_tmp7_, Node*, (guint) i);
				_tmp9_ = node_get_linked_node (_tmp8_);
				_tmp10_ = _tmp9_;
				if (_tmp10_ != NULL) {
					result = TRUE;
					_g_array_unref0 (nodes);
					return result;
				}
			}
		}
	}
	result = FALSE;
	_g_array_unref0 (nodes);
	return result;
}

void
map_model_create_links (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	MindMap* _tmp5_;
	GArray* _tmp6_;
	UndoNodesLink* _tmp7_;
	UndoNodesLink* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	if (_tmp4_->len < ((guint) 2)) {
		_g_array_unref0 (nodes);
		return;
	}
	_tmp5_ = self->priv->_map;
	_tmp6_ = nodes;
	_tmp7_ = undo_nodes_link_new (_tmp6_);
	_tmp8_ = _tmp7_;
	mind_map_add_undo (_tmp5_, (UndoItem*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp9_ = FALSE;
			_tmp9_ = TRUE;
			while (TRUE) {
				GArray* _tmp11_;
				GArray* _tmp12_;
				Node* _tmp13_;
				GArray* _tmp14_;
				Node* _tmp15_;
				NodeLink* _tmp16_;
				NodeLink* _tmp17_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp11_ = nodes;
				if (!(((guint) i) < (_tmp11_->len - 1))) {
					break;
				}
				_tmp12_ = nodes;
				_tmp13_ = g_array_index (_tmp12_, Node*, (guint) i);
				_tmp14_ = nodes;
				_tmp15_ = g_array_index (_tmp14_, Node*, (guint) (i + 1));
				_tmp16_ = node_link_new (_tmp15_);
				_tmp17_ = _tmp16_;
				node_set_linked_node (_tmp13_, _tmp17_);
				_node_link_unref0 (_tmp17_);
			}
		}
	}
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_array_unref0 (nodes);
}

void
map_model_delete_links (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	MindMap* _tmp4_;
	GArray* _tmp5_;
	UndoNodesLink* _tmp6_;
	UndoNodesLink* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = self->priv->_map;
	_tmp5_ = nodes;
	_tmp6_ = undo_nodes_link_new (_tmp5_);
	_tmp7_ = _tmp6_;
	mind_map_add_undo (_tmp4_, (UndoItem*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				GArray* _tmp10_;
				GArray* _tmp11_;
				Node* _tmp12_;
				NodeLink* _tmp13_;
				NodeLink* _tmp14_;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				_tmp10_ = nodes;
				if (!(((guint) i) < _tmp10_->len)) {
					break;
				}
				_tmp11_ = nodes;
				_tmp12_ = g_array_index (_tmp11_, Node*, (guint) i);
				_tmp13_ = node_get_linked_node (_tmp12_);
				_tmp14_ = _tmp13_;
				if (_tmp14_ != NULL) {
					GArray* _tmp15_;
					Node* _tmp16_;
					_tmp15_ = nodes;
					_tmp16_ = g_array_index (_tmp15_, Node*, (guint) i);
					node_set_linked_node (_tmp16_, NULL);
				}
			}
		}
	}
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_array_unref0 (nodes);
}

void
map_model_toggle_links (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	if (map_model_any_selected_nodes_linked (self)) {
		map_model_delete_links (self);
	} else {
		Node* _tmp4_;
		_tmp4_ = current;
		if (_tmp4_ != NULL) {
			map_model_start_connection (self, TRUE, TRUE);
		} else {
			map_model_create_links (self);
		}
	}
	_g_object_unref0 (current);
}

static GdkRGBA*
_vala_GdkRGBA_copy (GdkRGBA* self)
{
	return g_boxed_copy (gdk_rgba_get_type (), self);
}

static gpointer
__vala_GdkRGBA_copy0 (gpointer self)
{
	return self ? _vala_GdkRGBA_copy (self) : NULL;
}

static gboolean
_gdk_rgba_equal (const GdkRGBA * s1,
                 const GdkRGBA * s2)
{
	if (s1 == s2) {
		return TRUE;
	}
	if (s1 == NULL) {
		return FALSE;
	}
	if (s2 == NULL) {
		return FALSE;
	}
	if (s1->red != s2->red) {
		return FALSE;
	}
	if (s1->green != s2->green) {
		return FALSE;
	}
	if (s1->blue != s2->blue) {
		return FALSE;
	}
	if (s1->alpha != s2->alpha) {
		return FALSE;
	}
	return TRUE;
}

static void
_vala_GdkRGBA_free (GdkRGBA* self)
{
	g_boxed_free (gdk_rgba_get_type (), self);
}

void
map_model_change_current_link_color (MapModel* self,
                                     GdkRGBA* color)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ != NULL) {
		GdkRGBA* orig_color = NULL;
		Node* _tmp5_;
		GdkRGBA* _tmp6_;
		GdkRGBA* _tmp7_;
		GdkRGBA* _tmp8_;
		GdkRGBA* _tmp9_;
		_tmp5_ = current;
		_tmp6_ = node_get_link_color (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = __vala_GdkRGBA_copy0 (_tmp7_);
		orig_color = _tmp8_;
		_tmp9_ = orig_color;
		if (_gdk_rgba_equal (_tmp9_, color) != TRUE) {
			Node* _tmp10_;
			MindMap* _tmp11_;
			Node* _tmp12_;
			GdkRGBA* _tmp13_;
			UndoNodeLinkColor* _tmp14_;
			UndoNodeLinkColor* _tmp15_;
			_tmp10_ = current;
			node_set_link_color (_tmp10_, color);
			_tmp11_ = self->priv->_map;
			_tmp12_ = current;
			_tmp13_ = orig_color;
			_tmp14_ = undo_node_link_color_new (_tmp12_, _tmp13_);
			_tmp15_ = _tmp14_;
			mind_map_add_undo (_tmp11_, (UndoItem*) _tmp15_);
			_g_object_unref0 (_tmp15_);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
			map_model_auto_save (self);
		}
		__vala_GdkRGBA_free0 (orig_color);
	}
	_g_object_unref0 (current);
}

void
map_model_change_link_colors (MapModel* self,
                              GdkRGBA* color)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	MindMap* _tmp4_;
	GArray* _tmp5_;
	GdkRGBA _tmp6_;
	UndoNodesLinkColor* _tmp7_;
	UndoNodesLinkColor* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (color != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = self->priv->_map;
	_tmp5_ = nodes;
	_tmp6_ = *color;
	_tmp7_ = undo_nodes_link_color_new (_tmp5_, &_tmp6_);
	_tmp8_ = _tmp7_;
	mind_map_add_undo (_tmp4_, (UndoItem*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp9_ = FALSE;
			_tmp9_ = TRUE;
			while (TRUE) {
				GArray* _tmp11_;
				GArray* _tmp12_;
				Node* _tmp13_;
				GdkRGBA _tmp14_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp11_ = nodes;
				if (!(((guint) i) < _tmp11_->len)) {
					break;
				}
				_tmp12_ = nodes;
				_tmp13_ = g_array_index (_tmp12_, Node*, (guint) i);
				_tmp14_ = *color;
				node_set_link_color (_tmp13_, &_tmp14_);
			}
		}
	}
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (nodes);
}

void
map_model_randomize_current_link_color (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ != NULL) {
		GdkRGBA orig_color = {0};
		Node* _tmp5_;
		GdkRGBA* _tmp6_;
		GdkRGBA* _tmp7_;
		MindMap* _tmp16_;
		Node* _tmp17_;
		GdkRGBA _tmp18_;
		UndoNodeLinkColor* _tmp19_;
		UndoNodeLinkColor* _tmp20_;
		_tmp5_ = current;
		_tmp6_ = node_get_link_color (_tmp5_);
		_tmp7_ = _tmp6_;
		orig_color = *_tmp7_;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				Node* _tmp13_;
				Theme* _tmp14_;
				GdkRGBA _tmp15_ = {0};
				if (!_tmp8_) {
					Node* _tmp9_;
					GdkRGBA* _tmp10_;
					GdkRGBA* _tmp11_;
					GdkRGBA _tmp12_;
					_tmp9_ = current;
					_tmp10_ = node_get_link_color (_tmp9_);
					_tmp11_ = _tmp10_;
					_tmp12_ = *_tmp11_;
					if (!gdk_rgba_equal (&orig_color, &_tmp12_)) {
						break;
					}
				}
				_tmp8_ = FALSE;
				_tmp13_ = current;
				_tmp14_ = self->priv->_theme;
				theme_random_link_color (_tmp14_, &_tmp15_);
				node_set_link_color (_tmp13_, &_tmp15_);
			}
		}
		_tmp16_ = self->priv->_map;
		_tmp17_ = current;
		_tmp18_ = orig_color;
		_tmp19_ = undo_node_link_color_new (_tmp17_, &_tmp18_);
		_tmp20_ = _tmp19_;
		mind_map_add_undo (_tmp16_, (UndoItem*) _tmp20_);
		_g_object_unref0 (_tmp20_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	}
	_g_object_unref0 (current);
}

static void
__vala_GdkRGBA_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_GdkRGBA_free (var), NULL));
}

static void
_vala_GdkRGBA_free_function_content_of (gpointer data)
{
	GdkRGBA* self;
	self = *((GdkRGBA**) data);
	__vala_GdkRGBA_free0_ (self);
}

void
map_model_randomize_link_colors (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* colors = NULL;
	GArray* _tmp4_;
	MindMap* _tmp18_;
	GArray* _tmp19_;
	GArray* _tmp20_;
	UndoNodesRandLinkColor* _tmp21_;
	UndoNodesRandLinkColor* _tmp22_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = g_array_new (TRUE, TRUE, sizeof (GdkRGBA*));
	g_array_set_clear_func (_tmp4_, (GDestroyNotify) _vala_GdkRGBA_free_function_content_of);
	colors = _tmp4_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				GArray* _tmp7_;
				GArray* _tmp8_;
				GArray* _tmp9_;
				Node* _tmp10_;
				GdkRGBA* _tmp11_;
				GdkRGBA* _tmp12_;
				GdkRGBA* _tmp13_;
				GArray* _tmp14_;
				Node* _tmp15_;
				Theme* _tmp16_;
				GdkRGBA _tmp17_ = {0};
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = nodes;
				if (!(((guint) i) < _tmp7_->len)) {
					break;
				}
				_tmp8_ = colors;
				_tmp9_ = nodes;
				_tmp10_ = g_array_index (_tmp9_, Node*, (guint) i);
				_tmp11_ = node_get_link_color (_tmp10_);
				_tmp12_ = _tmp11_;
				_tmp13_ = __vala_GdkRGBA_copy0 (_tmp12_);
				g_array_append_val (_tmp8_, _tmp13_);
				_tmp14_ = nodes;
				_tmp15_ = g_array_index (_tmp14_, Node*, (guint) i);
				_tmp16_ = self->priv->_theme;
				theme_random_link_color (_tmp16_, &_tmp17_);
				node_set_link_color (_tmp15_, &_tmp17_);
			}
		}
	}
	_tmp18_ = self->priv->_map;
	_tmp19_ = nodes;
	_tmp20_ = colors;
	_tmp21_ = undo_nodes_rand_link_color_new (_tmp19_, _tmp20_);
	_tmp22_ = _tmp21_;
	mind_map_add_undo (_tmp18_, (UndoItem*) _tmp22_);
	_g_object_unref0 (_tmp22_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (colors);
	_g_array_unref0 (nodes);
}

void
map_model_reparent_current_link_color (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ != NULL) {
		MindMap* _tmp5_;
		Node* _tmp6_;
		UndoNodeReparentLinkColor* _tmp7_;
		UndoNodeReparentLinkColor* _tmp8_;
		Node* _tmp9_;
		_tmp5_ = self->priv->_map;
		_tmp6_ = current;
		_tmp7_ = undo_node_reparent_link_color_new (_tmp6_);
		_tmp8_ = _tmp7_;
		mind_map_add_undo (_tmp5_, (UndoItem*) _tmp8_);
		_g_object_unref0 (_tmp8_);
		_tmp9_ = current;
		node_set_link_color_root (_tmp9_, FALSE);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	}
	_g_object_unref0 (current);
}

void
map_model_reparent_link_colors (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	MindMap* _tmp4_;
	GArray* _tmp5_;
	UndoNodesReparentLinkColor* _tmp6_;
	UndoNodesReparentLinkColor* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = self->priv->_map;
	_tmp5_ = nodes;
	_tmp6_ = undo_nodes_reparent_link_color_new (_tmp5_);
	_tmp7_ = _tmp6_;
	mind_map_add_undo (_tmp4_, (UndoItem*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				GArray* _tmp10_;
				GArray* _tmp11_;
				Node* _tmp12_;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				_tmp10_ = nodes;
				if (!(((guint) i) < _tmp10_->len)) {
					break;
				}
				_tmp11_ = nodes;
				_tmp12_ = g_array_index (_tmp11_, Node*, (guint) i);
				node_set_link_color_root (_tmp12_, FALSE);
			}
		}
	}
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (nodes);
}

void
map_model_change_current_connection_color (MapModel* self,
                                           GdkRGBA* color)
{
	Connection* conn = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Connection* _tmp3_;
	Connection* _tmp4_;
	GdkRGBA* orig_color = NULL;
	Connection* _tmp5_;
	GdkRGBA* _tmp6_;
	GdkRGBA* _tmp7_;
	GdkRGBA* _tmp8_;
	GdkRGBA* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_connection (_tmp2_);
	conn = _tmp3_;
	_tmp4_ = conn;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (conn);
		return;
	}
	_tmp5_ = conn;
	_tmp6_ = connection_get_color (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = __vala_GdkRGBA_copy0 (_tmp7_);
	orig_color = _tmp8_;
	_tmp9_ = orig_color;
	if (_gdk_rgba_equal (_tmp9_, color) != TRUE) {
		Connection* _tmp10_;
		MindMap* _tmp11_;
		Connection* _tmp12_;
		GdkRGBA* _tmp13_;
		UndoConnectionColor* _tmp14_;
		UndoConnectionColor* _tmp15_;
		_tmp10_ = conn;
		connection_set_color (_tmp10_, color);
		_tmp11_ = self->priv->_map;
		_tmp12_ = conn;
		_tmp13_ = orig_color;
		_tmp14_ = undo_connection_color_new (_tmp12_, _tmp13_);
		_tmp15_ = _tmp14_;
		mind_map_add_undo (_tmp11_, (UndoItem*) _tmp15_);
		_g_object_unref0 (_tmp15_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	}
	__vala_GdkRGBA_free0 (orig_color);
	_g_object_unref0 (conn);
}

gboolean
map_model_select_connection_if_unselected (MapModel* self,
                                           gdouble x,
                                           gdouble y)
{
	Connection* conn = NULL;
	Connections* _tmp0_;
	Connection* _tmp1_;
	Connection* _tmp2_;
	Connection* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_connections;
	_tmp1_ = connections_within_title (_tmp0_, x, y);
	conn = _tmp1_;
	_tmp2_ = conn;
	if (_tmp2_ == NULL) {
		Connections* _tmp3_;
		Connection* _tmp4_;
		_tmp3_ = self->priv->_connections;
		_tmp4_ = connections_on_curve (_tmp3_, x, y);
		_g_object_unref0 (conn);
		conn = _tmp4_;
	}
	_tmp5_ = conn;
	if (_tmp5_ != NULL) {
		gboolean _tmp6_ = FALSE;
		MindMap* _tmp7_;
		Selection* _tmp8_;
		Selection* _tmp9_;
		Connection* _tmp10_;
		_tmp7_ = self->priv->_map;
		_tmp8_ = mind_map_get_selected (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = conn;
		if (!selection_is_connection_selected (_tmp9_, _tmp10_)) {
			Connection* _tmp11_;
			ConnMode _tmp12_;
			ConnMode _tmp13_;
			_tmp11_ = conn;
			_tmp12_ = connection_get_mode (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp6_ = _tmp13_ != CONN_MODE_EDITABLE;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			MindMap* _tmp14_;
			Connection* _tmp15_;
			_tmp14_ = self->priv->_map;
			_tmp15_ = conn;
			mind_map_set_current_connection (_tmp14_, _tmp15_);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		}
		result = TRUE;
		_g_object_unref0 (conn);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (conn);
	return result;
}

gboolean
map_model_select_node_if_unselected (MapModel* self,
                                     gdouble x,
                                     gdouble y)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				Node* node = NULL;
				GArray* _tmp3_;
				Node* _tmp4_;
				Node* _tmp5_;
				Node* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = node_contains (_tmp4_, x, y, TRUE);
				node = _tmp5_;
				_tmp6_ = node;
				if (_tmp6_ != NULL) {
					gboolean _tmp7_ = FALSE;
					MindMap* _tmp8_;
					Selection* _tmp9_;
					Selection* _tmp10_;
					Node* _tmp11_;
					_tmp8_ = self->priv->_map;
					_tmp9_ = mind_map_get_selected (_tmp8_);
					_tmp10_ = _tmp9_;
					_tmp11_ = node;
					if (!selection_is_node_selected (_tmp10_, _tmp11_)) {
						Node* _tmp12_;
						NodeMode _tmp13_;
						NodeMode _tmp14_;
						_tmp12_ = node;
						_tmp13_ = node_get_mode (_tmp12_);
						_tmp14_ = _tmp13_;
						_tmp7_ = _tmp14_ != NODE_MODE_EDITABLE;
					} else {
						_tmp7_ = FALSE;
					}
					if (_tmp7_) {
						MindMap* _tmp15_;
						Node* _tmp16_;
						_tmp15_ = self->priv->_map;
						_tmp16_ = node;
						mind_map_set_current_node (_tmp15_, _tmp16_);
						g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
					}
					result = TRUE;
					_g_object_unref0 (node);
					return result;
				}
				_g_object_unref0 (node);
			}
		}
	}
	result = FALSE;
	return result;
}

Node*
map_model_sibling_node (MapModel* self,
                        Node* node,
                        const gchar* dir,
                        gboolean wrap)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (dir != NULL, NULL);
	if (node != NULL) {
		if (node_is_root (node)) {
			if (g_strcmp0 (dir, "first") == 0) {
				GArray* _tmp0_;
				Node* _tmp1_;
				Node* _tmp2_;
				_tmp0_ = self->priv->_nodes;
				_tmp1_ = g_array_index (_tmp0_, Node*, (guint) 0);
				_tmp2_ = _g_object_ref0 (_tmp1_);
				result = _tmp2_;
				return result;
			} else {
				if (g_strcmp0 (dir, "last") == 0) {
					GArray* _tmp3_;
					GArray* _tmp4_;
					Node* _tmp5_;
					Node* _tmp6_;
					_tmp3_ = self->priv->_nodes;
					_tmp4_ = self->priv->_nodes;
					_tmp5_ = g_array_index (_tmp3_, Node*, _tmp4_->len - 1);
					_tmp6_ = _g_object_ref0 (_tmp5_);
					result = _tmp6_;
					return result;
				} else {
					gint _tmp7_ = 0;
					gint int_dir = 0;
					if (g_strcmp0 (dir, "next") == 0) {
						_tmp7_ = 1;
					} else {
						_tmp7_ = -1;
					}
					int_dir = _tmp7_;
					{
						gint i = 0;
						i = 0;
						{
							gboolean _tmp8_ = FALSE;
							_tmp8_ = TRUE;
							while (TRUE) {
								GArray* _tmp10_;
								GArray* _tmp11_;
								Node* _tmp12_;
								if (!_tmp8_) {
									gint _tmp9_;
									_tmp9_ = i;
									i = _tmp9_ + 1;
								}
								_tmp8_ = FALSE;
								_tmp10_ = self->priv->_nodes;
								if (!(((guint) i) < _tmp10_->len)) {
									break;
								}
								_tmp11_ = self->priv->_nodes;
								_tmp12_ = g_array_index (_tmp11_, Node*, (guint) i);
								if (_tmp12_ == node) {
									if ((i + int_dir) < 0) {
										Node* _tmp13_ = NULL;
										Node* _tmp17_;
										if (wrap) {
											GArray* _tmp14_;
											GArray* _tmp15_;
											Node* _tmp16_;
											_tmp14_ = self->priv->_nodes;
											_tmp15_ = self->priv->_nodes;
											_tmp16_ = g_array_index (_tmp14_, Node*, _tmp15_->len - 1);
											_tmp13_ = _tmp16_;
										} else {
											_tmp13_ = NULL;
										}
										_tmp17_ = _g_object_ref0 (_tmp13_);
										result = _tmp17_;
										return result;
									} else {
										GArray* _tmp18_;
										_tmp18_ = self->priv->_nodes;
										if (((guint) (i + int_dir)) >= _tmp18_->len) {
											Node* _tmp19_ = NULL;
											Node* _tmp22_;
											if (wrap) {
												GArray* _tmp20_;
												Node* _tmp21_;
												_tmp20_ = self->priv->_nodes;
												_tmp21_ = g_array_index (_tmp20_, Node*, (guint) 0);
												_tmp19_ = _tmp21_;
											} else {
												_tmp19_ = NULL;
											}
											_tmp22_ = _g_object_ref0 (_tmp19_);
											result = _tmp22_;
											return result;
										} else {
											GArray* _tmp23_;
											Node* _tmp24_;
											Node* _tmp25_;
											_tmp23_ = self->priv->_nodes;
											_tmp24_ = g_array_index (_tmp23_, Node*, (guint) (i + int_dir));
											_tmp25_ = _g_object_ref0 (_tmp24_);
											result = _tmp25_;
											return result;
										}
									}
								}
							}
						}
					}
				}
			}
		} else {
			if (g_strcmp0 (dir, "first") == 0) {
				Node* _tmp26_;
				Node* _tmp27_;
				Node* _tmp28_;
				_tmp26_ = node_get_parent (node);
				_tmp27_ = _tmp26_;
				_tmp28_ = node_first_child (_tmp27_, NULL);
				result = _tmp28_;
				return result;
			} else {
				if (g_strcmp0 (dir, "last") == 0) {
					Node* _tmp29_;
					Node* _tmp30_;
					Node* _tmp31_;
					_tmp29_ = node_get_parent (node);
					_tmp30_ = _tmp29_;
					_tmp31_ = node_last_child (_tmp30_, NULL);
					result = _tmp31_;
					return result;
				} else {
					if (g_strcmp0 (dir, "next") == 0) {
						Node* _tmp32_;
						Node* _tmp33_;
						Node* _tmp34_;
						_tmp32_ = node_get_parent (node);
						_tmp33_ = _tmp32_;
						_tmp34_ = node_next_child (_tmp33_, node, wrap);
						result = _tmp34_;
						return result;
					} else {
						Node* _tmp35_;
						Node* _tmp36_;
						Node* _tmp37_;
						_tmp35_ = node_get_parent (node);
						_tmp36_ = _tmp35_;
						_tmp37_ = node_prev_child (_tmp36_, node, wrap);
						result = _tmp37_;
						return result;
					}
				}
			}
		}
	}
	result = NULL;
	return result;
}

Node*
map_model_get_node_at_position (MapModel* self,
                                gdouble x,
                                gdouble y,
                                MapItemComponent* component)
{
	MapItemComponent _vala_component = 0;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	_vala_component = MAP_ITEM_COMPONENT_NONE;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				Node* node = NULL;
				GArray* _tmp3_;
				Node* _tmp4_;
				Node* _tmp5_;
				Node* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = node_contains (_tmp4_, x, y, TRUE);
				node = _tmp5_;
				_tmp6_ = node;
				if (_tmp6_ != NULL) {
					Node* _tmp7_;
					_tmp7_ = node;
					if (node_is_within_title (_tmp7_, x, y)) {
						_vala_component = MAP_ITEM_COMPONENT_TITLE;
					} else {
						Node* _tmp8_;
						_tmp8_ = node;
						if (node_is_within_task (_tmp8_, x, y)) {
							_vala_component = MAP_ITEM_COMPONENT_TASK;
						} else {
							Node* _tmp9_;
							_tmp9_ = node;
							if (node_is_within_note (_tmp9_, x, y)) {
								_vala_component = MAP_ITEM_COMPONENT_NOTE;
							} else {
								Node* _tmp10_;
								_tmp10_ = node;
								if (node_is_within_linked_node (_tmp10_, x, y)) {
									_vala_component = MAP_ITEM_COMPONENT_NODE_LINK;
								} else {
									Node* _tmp11_;
									_tmp11_ = node;
									if (node_is_within_fold (_tmp11_, x, y)) {
										_vala_component = MAP_ITEM_COMPONENT_FOLD;
									} else {
										Node* _tmp12_;
										_tmp12_ = node;
										if (node_is_within_image (_tmp12_, x, y)) {
											_vala_component = MAP_ITEM_COMPONENT_IMAGE;
										} else {
											Node* _tmp13_;
											_tmp13_ = node;
											if (node_is_within_resizer (_tmp13_, x, y)) {
												_vala_component = MAP_ITEM_COMPONENT_RESIZER;
											} else {
												Node* _tmp14_;
												_tmp14_ = node;
												if (node_is_within_tags (_tmp14_, x, y)) {
													_vala_component = MAP_ITEM_COMPONENT_TAGS;
												}
											}
										}
									}
								}
							}
						}
					}
					result = node;
					if (component) {
						*component = _vala_component;
					}
					return result;
				}
				_g_object_unref0 (node);
			}
		}
	}
	result = NULL;
	if (component) {
		*component = _vala_component;
	}
	return result;
}

Callout*
map_model_get_callout_at_position (MapModel* self,
                                   gdouble x,
                                   gdouble y,
                                   MapItemComponent* component)
{
	MapItemComponent _vala_component = 0;
	Callout* result;
	g_return_val_if_fail (self != NULL, NULL);
	_vala_component = MAP_ITEM_COMPONENT_NONE;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				Callout* callout = NULL;
				GArray* _tmp3_;
				Node* _tmp4_;
				Callout* _tmp5_;
				Callout* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = node_contains_callout (_tmp4_, x, y);
				callout = _tmp5_;
				_tmp6_ = callout;
				if (_tmp6_ != NULL) {
					Callout* _tmp7_;
					_tmp7_ = callout;
					if (callout_is_within_title (_tmp7_, x, y)) {
						_vala_component = MAP_ITEM_COMPONENT_TITLE;
					} else {
						Callout* _tmp8_;
						_tmp8_ = callout;
						if (callout_is_within_resizer (_tmp8_, x, y)) {
							_vala_component = MAP_ITEM_COMPONENT_RESIZER;
						}
					}
					result = callout;
					if (component) {
						*component = _vala_component;
					}
					return result;
				}
				_g_object_unref0 (callout);
			}
		}
	}
	result = NULL;
	if (component) {
		*component = _vala_component;
	}
	return result;
}

Connection*
map_model_get_connection_at_position (MapModel* self,
                                      gdouble x,
                                      gdouble y,
                                      MapItemComponent* component)
{
	MapItemComponent _vala_component = 0;
	Connections* _tmp0_;
	MapItemComponent _tmp1_ = 0;
	Connection* _tmp2_;
	Connection* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_connections;
	_tmp2_ = connections_within (_tmp0_, x, y, &_tmp1_);
	_vala_component = _tmp1_;
	result = _tmp2_;
	if (component) {
		*component = _vala_component;
	}
	return result;
}

Sticker*
map_model_get_sticker_at_position (MapModel* self,
                                   gdouble x,
                                   gdouble y)
{
	Stickers* _tmp0_;
	Sticker* _tmp1_;
	Sticker* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stickers;
	_tmp1_ = stickers_is_within (_tmp0_, x, y);
	result = _tmp1_;
	return result;
}

NodeGroup*
map_model_get_group_at_position (MapModel* self,
                                 gdouble x,
                                 gdouble y)
{
	NodeGroups* _tmp0_;
	NodeGroup* _tmp1_;
	NodeGroup* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_groups;
	_tmp1_ = node_groups_node_group_containing (_tmp0_, x, y);
	result = _tmp1_;
	return result;
}

void
map_model_set_attach_node (MapModel* self,
                           Node* n,
                           NodeMode mode)
{
	gboolean change = FALSE;
	Node* _tmp0_;
	Node* _tmp1_;
	Node* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_attach_node;
	change = _tmp0_ != n;
	_tmp1_ = self->priv->_attach_node;
	if (_tmp1_ != NULL) {
		Node* _tmp2_;
		_tmp2_ = self->priv->_attach_node;
		map_model_set_node_mode (self, _tmp2_, NODE_MODE_NONE, TRUE);
	}
	_tmp3_ = _g_object_ref0 (n);
	_g_object_unref0 (self->priv->_attach_node);
	self->priv->_attach_node = _tmp3_;
	if (n != NULL) {
		map_model_set_node_mode (self, n, mode, TRUE);
	}
	if (change) {
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	}
}

void
map_model_set_attach_summary (MapModel* self,
                              SummaryNode* n)
{
	gboolean change = FALSE;
	SummaryNode* _tmp0_;
	SummaryNode* _tmp1_;
	SummaryNode* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_attach_summary;
	change = _tmp0_ != n;
	_tmp1_ = self->priv->_attach_summary;
	if (_tmp1_ != NULL) {
		SummaryNode* _tmp2_;
		_tmp2_ = self->priv->_attach_summary;
		summary_node_set_attachable (_tmp2_, FALSE);
	}
	_tmp3_ = _g_object_ref0 (n);
	_g_object_unref0 (self->priv->_attach_summary);
	self->priv->_attach_summary = _tmp3_;
	if (n != NULL) {
		SummaryNode* _tmp4_;
		_tmp4_ = self->priv->_attach_summary;
		summary_node_set_attachable (_tmp4_, TRUE);
	}
	if (change) {
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	}
}

void
map_model_set_attach_connection (MapModel* self,
                                 Connection* c,
                                 ConnMode mode)
{
	gboolean change = FALSE;
	Connection* _tmp0_;
	Connection* _tmp1_;
	Connection* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_attach_conn;
	change = _tmp0_ != c;
	_tmp1_ = self->priv->_attach_conn;
	if (_tmp1_ != NULL) {
		Connection* _tmp2_;
		_tmp2_ = self->priv->_attach_conn;
		map_model_set_connection_mode (self, _tmp2_, CONN_MODE_NONE, TRUE);
	}
	_tmp3_ = _g_object_ref0 (c);
	_g_object_unref0 (self->priv->_attach_conn);
	self->priv->_attach_conn = _tmp3_;
	if (c != NULL) {
		map_model_set_connection_mode (self, c, mode, TRUE);
	}
	if (change) {
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	}
}

void
map_model_set_attach_sticker (MapModel* self,
                              Sticker* s,
                              StickerMode mode)
{
	gboolean change = FALSE;
	Sticker* _tmp0_;
	Sticker* _tmp1_;
	Sticker* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_attach_sticker;
	change = _tmp0_ != s;
	_tmp1_ = self->priv->_attach_sticker;
	if (_tmp1_ != NULL) {
		Sticker* _tmp2_;
		_tmp2_ = self->priv->_attach_sticker;
		sticker_set_mode (_tmp2_, STICKER_MODE_NONE);
	}
	_tmp3_ = _g_object_ref0 (s);
	_g_object_unref0 (self->priv->_attach_sticker);
	self->priv->_attach_sticker = _tmp3_;
	if (s != NULL) {
		sticker_set_mode (s, mode);
	}
	if (change) {
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	}
}

Node*
map_model_attachable_node (MapModel* self,
                           gdouble x,
                           gdouble y)
{
	GArray* sel_nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	sel_nodes = _tmp3_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				GArray* _tmp6_;
				Node* tmp = NULL;
				GArray* _tmp7_;
				Node* _tmp8_;
				Node* _tmp9_;
				Node* _tmp10_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				_tmp6_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp6_->len)) {
					break;
				}
				_tmp7_ = self->priv->_nodes;
				_tmp8_ = g_array_index (_tmp7_, Node*, (guint) i);
				_tmp9_ = node_contains (_tmp8_, x, y, FALSE);
				tmp = _tmp9_;
				_tmp10_ = tmp;
				if (_tmp10_ != NULL) {
					{
						gint j = 0;
						j = 0;
						{
							gboolean _tmp11_ = FALSE;
							_tmp11_ = TRUE;
							while (TRUE) {
								GArray* _tmp13_;
								Node* current = NULL;
								GArray* _tmp14_;
								Node* _tmp15_;
								Node* _tmp16_;
								gboolean _tmp17_ = FALSE;
								gboolean _tmp18_ = FALSE;
								Node* _tmp19_;
								Node* _tmp20_;
								Node* _tmp21_;
								Node* _tmp22_;
								if (!_tmp11_) {
									gint _tmp12_;
									_tmp12_ = j;
									j = _tmp12_ + 1;
								}
								_tmp11_ = FALSE;
								_tmp13_ = sel_nodes;
								if (!(((guint) j) < _tmp13_->len)) {
									break;
								}
								_tmp14_ = sel_nodes;
								_tmp15_ = g_array_index (_tmp14_, Node*, (guint) j);
								_tmp16_ = _g_object_ref0 (_tmp15_);
								current = _tmp16_;
								_tmp19_ = tmp;
								_tmp20_ = current;
								_tmp21_ = node_get_parent (_tmp20_);
								_tmp22_ = _tmp21_;
								if (_tmp19_ == _tmp22_) {
									_tmp18_ = TRUE;
								} else {
									Node* _tmp23_;
									Node* _tmp24_;
									_tmp23_ = current;
									_tmp24_ = tmp;
									_tmp18_ = node_contains_node (_tmp23_, _tmp24_);
								}
								if (_tmp18_) {
									_tmp17_ = TRUE;
								} else {
									Node* _tmp25_;
									_tmp25_ = tmp;
									_tmp17_ = node_is_summarized (_tmp25_);
								}
								if (_tmp17_) {
									result = NULL;
									_g_object_unref0 (current);
									_g_object_unref0 (tmp);
									_g_array_unref0 (sel_nodes);
									return result;
								}
								_g_object_unref0 (current);
							}
						}
					}
					result = tmp;
					_g_array_unref0 (sel_nodes);
					return result;
				}
				_g_object_unref0 (tmp);
			}
		}
	}
	result = NULL;
	_g_array_unref0 (sel_nodes);
	return result;
}

SummaryNode*
map_model_attachable_summary_node (MapModel* self,
                                   gdouble x,
                                   gdouble y)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	Node* _tmp7_;
	SummaryNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp7_ = current;
	if (node_is_summarized (_tmp7_)) {
		Node* _tmp8_;
		Node* _tmp9_;
		Node* _tmp10_;
		GArray* _tmp11_;
		GArray* _tmp12_;
		_tmp8_ = current;
		_tmp9_ = node_get_parent (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = node_children (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp6_ = _tmp12_->len > ((guint) 1);
		_g_array_unref0 (_tmp12_);
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		Node* _tmp13_;
		SummaryNode* _tmp14_;
		SummaryNode* _tmp15_;
		_tmp13_ = current;
		_tmp14_ = node_summary_node (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp5_ = summary_node_summarized_count (_tmp15_) > 1;
		_g_object_unref0 (_tmp15_);
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		_tmp4_ = TRUE;
	} else {
		Node* _tmp16_;
		_tmp16_ = current;
		_tmp4_ = node_is_leaf (_tmp16_);
	}
	if (_tmp4_) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp17_ = FALSE;
				_tmp17_ = TRUE;
				while (TRUE) {
					Node* _tmp19_;
					Node* _tmp20_;
					Node* _tmp21_;
					GArray* _tmp22_;
					GArray* _tmp23_;
					gboolean _tmp24_;
					Node* sibling = NULL;
					Node* _tmp25_;
					Node* _tmp26_;
					Node* _tmp27_;
					GArray* _tmp28_;
					GArray* _tmp29_;
					Node* _tmp30_;
					Node* _tmp31_;
					Node* _tmp32_;
					gboolean _tmp33_ = FALSE;
					Node* _tmp34_;
					if (!_tmp17_) {
						gint _tmp18_;
						_tmp18_ = i;
						i = _tmp18_ + 1;
					}
					_tmp17_ = FALSE;
					_tmp19_ = current;
					_tmp20_ = node_get_parent (_tmp19_);
					_tmp21_ = _tmp20_;
					_tmp22_ = node_children (_tmp21_);
					_tmp23_ = _tmp22_;
					_tmp24_ = !(((guint) i) < _tmp23_->len);
					_g_array_unref0 (_tmp23_);
					if (_tmp24_) {
						break;
					}
					_tmp25_ = current;
					_tmp26_ = node_get_parent (_tmp25_);
					_tmp27_ = _tmp26_;
					_tmp28_ = node_children (_tmp27_);
					_tmp29_ = _tmp28_;
					_tmp30_ = g_array_index (_tmp29_, Node*, (guint) i);
					_tmp31_ = _g_object_ref0 (_tmp30_);
					_tmp32_ = _tmp31_;
					_g_array_unref0 (_tmp29_);
					sibling = _tmp32_;
					_tmp34_ = sibling;
					if (node_last_summarized (_tmp34_)) {
						Node* _tmp35_;
						SummaryNode* _tmp36_;
						SummaryNode* _tmp37_;
						_tmp35_ = sibling;
						_tmp36_ = node_summary_node (_tmp35_);
						_tmp37_ = _tmp36_;
						_tmp33_ = summary_node_is_within_summarized (_tmp37_, x, y);
						_g_object_unref0 (_tmp37_);
					} else {
						_tmp33_ = FALSE;
					}
					if (_tmp33_) {
						Node* _tmp38_;
						SummaryNode* _tmp39_;
						_tmp38_ = sibling;
						_tmp39_ = node_summary_node (_tmp38_);
						result = _tmp39_;
						_g_object_unref0 (sibling);
						_g_object_unref0 (current);
						return result;
					}
					_g_object_unref0 (sibling);
				}
			}
		}
	}
	result = NULL;
	_g_object_unref0 (current);
	return result;
}

void
map_model_draw_all (MapModel* self,
                    cairo_t* ctx,
                    gboolean exporting,
                    gboolean moving_node)
{
	NodeGroups* _tmp6_;
	Theme* _tmp7_;
	Node* current_node = NULL;
	MindMap* _tmp8_;
	Selection* _tmp9_;
	Selection* _tmp10_;
	Node* _tmp11_;
	Connection* current_conn = NULL;
	MindMap* _tmp12_;
	Selection* _tmp13_;
	Selection* _tmp14_;
	Connection* _tmp15_;
	gboolean _tmp23_ = FALSE;
	Node* _tmp24_;
	Connections* _tmp32_;
	Theme* _tmp33_;
	Connection* _tmp34_;
	Stickers* _tmp37_;
	Theme* _tmp38_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ctx != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				Theme* _tmp5_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = self->priv->_theme;
				node_draw_links (_tmp4_, ctx, _tmp5_);
			}
		}
	}
	_tmp6_ = self->priv->_groups;
	_tmp7_ = self->priv->_theme;
	node_groups_draw_all (_tmp6_, ctx, _tmp7_, exporting);
	_tmp8_ = self->priv->_map;
	_tmp9_ = mind_map_get_selected (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = selection_current_node (_tmp10_);
	current_node = _tmp11_;
	_tmp12_ = self->priv->_map;
	_tmp13_ = mind_map_get_selected (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = selection_current_connection (_tmp14_);
	current_conn = _tmp15_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp16_ = FALSE;
			_tmp16_ = TRUE;
			while (TRUE) {
				GArray* _tmp18_;
				GArray* _tmp19_;
				Node* _tmp20_;
				Theme* _tmp21_;
				Node* _tmp22_;
				if (!_tmp16_) {
					gint _tmp17_;
					_tmp17_ = i;
					i = _tmp17_ + 1;
				}
				_tmp16_ = FALSE;
				_tmp18_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp18_->len)) {
					break;
				}
				_tmp19_ = self->priv->_nodes;
				_tmp20_ = g_array_index (_tmp19_, Node*, (guint) i);
				_tmp21_ = self->priv->_theme;
				_tmp22_ = current_node;
				node_draw_all (_tmp20_, ctx, _tmp21_, _tmp22_, FALSE, exporting);
			}
		}
	}
	_tmp24_ = current_node;
	if (_tmp24_ != NULL) {
		Node* _tmp25_;
		Node* _tmp26_;
		Node* _tmp27_;
		_tmp25_ = current_node;
		_tmp26_ = node_folded_ancestor (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp23_ = _tmp27_ == NULL;
		_g_object_unref0 (_tmp27_);
	} else {
		_tmp23_ = FALSE;
	}
	if (_tmp23_) {
		gboolean _tmp28_ = FALSE;
		MindMap* _tmp29_;
		Node* _tmp30_;
		Theme* _tmp31_;
		_tmp29_ = self->priv->_map;
		if (!mind_map_is_node_editable (_tmp29_)) {
			_tmp28_ = moving_node;
		} else {
			_tmp28_ = FALSE;
		}
		_tmp30_ = current_node;
		_tmp31_ = self->priv->_theme;
		node_draw_all (_tmp30_, ctx, _tmp31_, NULL, _tmp28_, exporting);
	}
	_tmp32_ = self->priv->_connections;
	_tmp33_ = self->priv->_theme;
	connections_draw_all (_tmp32_, ctx, _tmp33_, exporting);
	_tmp34_ = current_conn;
	if (_tmp34_ != NULL) {
		Connection* _tmp35_;
		Theme* _tmp36_;
		_tmp35_ = current_conn;
		_tmp36_ = self->priv->_theme;
		connection_draw (_tmp35_, ctx, _tmp36_, exporting);
	}
	_tmp37_ = self->priv->_stickers;
	_tmp38_ = self->priv->_theme;
	stickers_draw_all (_tmp37_, ctx, _tmp38_, 1.0, exporting);
	_g_object_unref0 (current_conn);
	_g_object_unref0 (current_node);
}

void
map_model_get_nodes_within_rectangle (MapModel* self,
                                      GdkRectangle* box,
                                      GArray* nodes)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (box != NULL);
	g_return_if_fail (nodes != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				GdkRectangle _tmp5_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = *box;
				node_get_nodes_within_box (_tmp4_, &_tmp5_, nodes);
			}
		}
	}
}

gboolean
map_model_update_last_match (MapModel* self,
                             Node* match)
{
	Node* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_last_match;
	if (match != _tmp0_) {
		Node* _tmp1_;
		Node* _tmp3_;
		_tmp1_ = self->priv->_last_match;
		if (_tmp1_ != NULL) {
			Node* _tmp2_;
			_tmp2_ = self->priv->_last_match;
			node_set_show_fold (_tmp2_, FALSE);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		}
		_tmp3_ = _g_object_ref0 (match);
		_g_object_unref0 (self->priv->_last_match);
		self->priv->_last_match = _tmp3_;
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gpointer
vala_g_array_remove_index (GArray* self,
                           guint index)
{
	gpointer g = NULL;
	gpointer* _tmp0_;
	gint _tmp0__length1;
	gpointer _tmp1_;
	gpointer result;
	g_return_val_if_fail (self != NULL, NULL);
	_vala_assert (self->len > index, "length > index");
	_tmp0_ = self->data;
	_tmp0__length1 = self->len;
	_tmp1_ = _tmp0_[index];
	_tmp0_[index] = NULL;
	g = _tmp1_;
	g_array_remove_index (self, index);
	result = g;
	return result;
}

void
map_model_attach_current_node (MapModel* self)
{
	Node* orig_parent = NULL;
	gint orig_index = 0;
	SummaryNode* orig_summary = NULL;
	gint orig_summary_index = 0;
	Style* orig_style = NULL;
	Style* _tmp0_;
	Node* current = NULL;
	MindMap* _tmp1_;
	Selection* _tmp2_;
	Selection* _tmp3_;
	Node* _tmp4_;
	gboolean isroot = FALSE;
	Node* _tmp5_;
	gboolean isleaf = FALSE;
	Node* _tmp6_;
	MindMap* _tmp7_;
	Animator* _tmp8_;
	Animator* _tmp9_;
	GArray* _tmp10_;
	Style* _tmp40_;
	Node* _tmp41_;
	Style* _tmp42_;
	Style* _tmp43_;
	SummaryNode* summary = NULL;
	Node* _tmp44_;
	SummaryNode* _tmp45_;
	gboolean _tmp46_ = FALSE;
	gboolean _tmp47_ = FALSE;
	MindMap* _tmp121_;
	Animator* _tmp122_;
	Animator* _tmp123_;
	g_return_if_fail (self != NULL);
	orig_parent = NULL;
	orig_index = -1;
	orig_summary = NULL;
	orig_summary_index = -1;
	_tmp0_ = style_new ();
	orig_style = _tmp0_;
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_selected (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = selection_current_node (_tmp3_);
	current = _tmp4_;
	_tmp5_ = current;
	isroot = node_is_root (_tmp5_);
	_tmp6_ = current;
	isleaf = node_is_leaf (_tmp6_);
	_tmp7_ = self->priv->_map;
	_tmp8_ = mind_map_get_animator (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->priv->_nodes;
	animator_add_nodes (_tmp9_, _tmp10_, FALSE, "attach_current_node");
	if (isroot) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					GArray* _tmp13_;
					GArray* _tmp14_;
					Node* _tmp15_;
					Node* _tmp16_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ + 1;
					}
					_tmp11_ = FALSE;
					_tmp13_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp13_->len)) {
						break;
					}
					_tmp14_ = self->priv->_nodes;
					_tmp15_ = g_array_index (_tmp14_, Node*, (guint) i);
					_tmp16_ = current;
					if (_tmp15_ == _tmp16_) {
						GArray* _tmp17_;
						Node* _tmp18_;
						Node* _tmp19_;
						_tmp17_ = self->priv->_nodes;
						_tmp18_ = vala_g_array_remove_index (_tmp17_, (guint) i);
						_tmp19_ = _tmp18_;
						_g_object_unref0 (_tmp19_);
						orig_index = i;
						break;
					}
				}
			}
		}
	} else {
		Node* _tmp20_;
		Node* _tmp21_;
		Node* _tmp22_;
		Node* _tmp23_;
		Node* _tmp24_;
		Node* _tmp25_;
		SummaryNode* _tmp26_;
		gint _tmp27_ = 0;
		SummaryNode* _tmp28_;
		Node* _tmp31_;
		MindMap* _tmp32_;
		DrawArea* _tmp33_;
		DrawArea* _tmp34_;
		gboolean _tmp35_ = FALSE;
		SummaryNode* _tmp36_;
		_tmp20_ = current;
		_tmp21_ = node_get_parent (_tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = _g_object_ref0 (_tmp22_);
		_g_object_unref0 (orig_parent);
		orig_parent = _tmp23_;
		_tmp24_ = current;
		orig_index = node_index (_tmp24_);
		_tmp25_ = current;
		_tmp26_ = node_summary_node (_tmp25_);
		_g_object_unref0 (orig_summary);
		orig_summary = _tmp26_;
		_tmp28_ = orig_summary;
		if (_tmp28_ != NULL) {
			SummaryNode* _tmp29_;
			Node* _tmp30_;
			_tmp29_ = orig_summary;
			_tmp30_ = current;
			_tmp27_ = summary_node_node_index (_tmp29_, _tmp30_);
		} else {
			_tmp27_ = -1;
		}
		orig_summary_index = _tmp27_;
		_tmp31_ = current;
		_tmp32_ = self->priv->_map;
		_tmp33_ = mind_map_get_canvas (_tmp32_);
		_tmp34_ = _tmp33_;
		node_detach (_tmp31_, draw_area_get_orig_side (_tmp34_));
		_tmp36_ = orig_summary;
		if (_tmp36_ != NULL) {
			SummaryNode* _tmp37_;
			_tmp37_ = orig_summary;
			_tmp35_ = summary_node_summarized_count (_tmp37_) > 1;
		} else {
			_tmp35_ = FALSE;
		}
		if (_tmp35_) {
			SummaryNode* _tmp38_;
			Node* _tmp39_;
			_tmp38_ = orig_summary;
			_tmp39_ = current;
			summary_node_remove_node (_tmp38_, _tmp39_);
		}
	}
	_tmp40_ = orig_style;
	_tmp41_ = current;
	_tmp42_ = node_get_style (_tmp41_);
	_tmp43_ = _tmp42_;
	style_copy (_tmp40_, _tmp43_);
	_tmp44_ = self->priv->_attach_node;
	_tmp45_ = node_summary_node (_tmp44_);
	summary = _tmp45_;
	if (isleaf) {
		SummaryNode* _tmp48_;
		SummaryNode* _tmp49_;
		_tmp48_ = orig_summary;
		_tmp49_ = summary;
		_tmp47_ = _tmp48_ != _tmp49_;
	} else {
		_tmp47_ = FALSE;
	}
	if (_tmp47_) {
		Node* _tmp50_;
		_tmp50_ = self->priv->_attach_node;
		_tmp46_ = node_first_summarized (_tmp50_);
	} else {
		_tmp46_ = FALSE;
	}
	if (_tmp46_) {
		Node* _tmp51_;
		Node* _tmp52_;
		Node* _tmp53_;
		Node* _tmp54_;
		Node* _tmp55_;
		Theme* _tmp56_;
		SummaryNode* _tmp57_;
		Node* _tmp58_;
		_tmp51_ = current;
		_tmp52_ = self->priv->_attach_node;
		_tmp53_ = node_get_parent (_tmp52_);
		_tmp54_ = _tmp53_;
		_tmp55_ = self->priv->_attach_node;
		_tmp56_ = self->priv->_theme;
		node_attach (_tmp51_, _tmp54_, node_index (_tmp55_), _tmp56_, TRUE);
		_tmp57_ = summary;
		_tmp58_ = current;
		summary_node_add_node (_tmp57_, _tmp58_);
	} else {
		gboolean _tmp59_ = FALSE;
		gboolean _tmp60_ = FALSE;
		if (isleaf) {
			SummaryNode* _tmp61_;
			SummaryNode* _tmp62_;
			_tmp61_ = orig_summary;
			_tmp62_ = summary;
			_tmp60_ = _tmp61_ != _tmp62_;
		} else {
			_tmp60_ = FALSE;
		}
		if (_tmp60_) {
			Node* _tmp63_;
			_tmp63_ = self->priv->_attach_node;
			_tmp59_ = node_last_summarized (_tmp63_);
		} else {
			_tmp59_ = FALSE;
		}
		if (_tmp59_) {
			Node* _tmp64_;
			Node* _tmp65_;
			Node* _tmp66_;
			Node* _tmp67_;
			Node* _tmp68_;
			Theme* _tmp69_;
			SummaryNode* _tmp70_;
			Node* _tmp71_;
			_tmp64_ = current;
			_tmp65_ = self->priv->_attach_node;
			_tmp66_ = node_get_parent (_tmp65_);
			_tmp67_ = _tmp66_;
			_tmp68_ = self->priv->_attach_node;
			_tmp69_ = self->priv->_theme;
			node_attach (_tmp64_, _tmp67_, node_index (_tmp68_) + 1, _tmp69_, TRUE);
			_tmp70_ = summary;
			_tmp71_ = current;
			summary_node_add_node (_tmp70_, _tmp71_);
		} else {
			gboolean _tmp72_ = FALSE;
			SummaryNode* _tmp73_;
			SummaryNode* _tmp74_;
			_tmp73_ = orig_summary;
			_tmp74_ = summary;
			if (_tmp73_ == _tmp74_) {
				Node* _tmp75_;
				_tmp75_ = self->priv->_attach_node;
				_tmp72_ = node_first_summarized (_tmp75_);
			} else {
				_tmp72_ = FALSE;
			}
			if (_tmp72_) {
				Node* _tmp76_;
				Node* _tmp77_;
				Node* _tmp78_;
				Node* _tmp79_;
				Node* _tmp80_;
				Theme* _tmp81_;
				_tmp76_ = current;
				_tmp77_ = self->priv->_attach_node;
				_tmp78_ = node_get_parent (_tmp77_);
				_tmp79_ = _tmp78_;
				_tmp80_ = self->priv->_attach_node;
				_tmp81_ = self->priv->_theme;
				node_attach (_tmp76_, _tmp79_, node_index (_tmp80_), _tmp81_, TRUE);
			} else {
				gboolean _tmp82_ = FALSE;
				SummaryNode* _tmp83_;
				SummaryNode* _tmp84_;
				_tmp83_ = orig_summary;
				_tmp84_ = summary;
				if (_tmp83_ == _tmp84_) {
					Node* _tmp85_;
					_tmp85_ = self->priv->_attach_node;
					_tmp82_ = node_last_summarized (_tmp85_);
				} else {
					_tmp82_ = FALSE;
				}
				if (_tmp82_) {
					Node* _tmp86_;
					Node* _tmp87_;
					Node* _tmp88_;
					Node* _tmp89_;
					Node* _tmp90_;
					Theme* _tmp91_;
					_tmp86_ = current;
					_tmp87_ = self->priv->_attach_node;
					_tmp88_ = node_get_parent (_tmp87_);
					_tmp89_ = _tmp88_;
					_tmp90_ = self->priv->_attach_node;
					_tmp91_ = self->priv->_theme;
					node_attach (_tmp86_, _tmp89_, node_index (_tmp90_) + 1, _tmp91_, TRUE);
				} else {
					Node* _tmp92_;
					Node* _tmp93_;
					Theme* _tmp94_;
					Node* _tmp95_;
					_tmp92_ = current;
					_tmp93_ = self->priv->_attach_node;
					_tmp94_ = self->priv->_theme;
					node_attach (_tmp92_, _tmp93_, -1, _tmp94_, TRUE);
					_tmp95_ = current;
					map_model_set_style_after_parent_attach (self, _tmp95_);
				}
			}
		}
	}
	map_model_set_attach_node (self, NULL, NODE_MODE_ATTACHABLE);
	if (isroot) {
		MindMap* _tmp96_;
		Node* _tmp97_;
		MindMap* _tmp98_;
		DrawArea* _tmp99_;
		DrawArea* _tmp100_;
		GArray* _tmp101_;
		GArray* _tmp102_;
		Style* _tmp103_;
		UndoNodeAttach* _tmp104_;
		UndoNodeAttach* _tmp105_;
		_tmp96_ = self->priv->_map;
		_tmp97_ = current;
		_tmp98_ = self->priv->_map;
		_tmp99_ = mind_map_get_canvas (_tmp98_);
		_tmp100_ = _tmp99_;
		_tmp101_ = draw_area_get_orig_info (_tmp100_);
		_tmp102_ = _tmp101_;
		_tmp103_ = orig_style;
		_tmp104_ = undo_node_attach_new_for_root (_tmp97_, orig_index, _tmp102_, _tmp103_);
		_tmp105_ = _tmp104_;
		mind_map_add_undo (_tmp96_, (UndoItem*) _tmp105_);
		_g_object_unref0 (_tmp105_);
	} else {
		MindMap* _tmp106_;
		Node* _tmp107_;
		Node* _tmp108_;
		MindMap* _tmp109_;
		DrawArea* _tmp110_;
		DrawArea* _tmp111_;
		MindMap* _tmp112_;
		DrawArea* _tmp113_;
		DrawArea* _tmp114_;
		GArray* _tmp115_;
		GArray* _tmp116_;
		SummaryNode* _tmp117_;
		Style* _tmp118_;
		UndoNodeAttach* _tmp119_;
		UndoNodeAttach* _tmp120_;
		_tmp106_ = self->priv->_map;
		_tmp107_ = current;
		_tmp108_ = orig_parent;
		_tmp109_ = self->priv->_map;
		_tmp110_ = mind_map_get_canvas (_tmp109_);
		_tmp111_ = _tmp110_;
		_tmp112_ = self->priv->_map;
		_tmp113_ = mind_map_get_canvas (_tmp112_);
		_tmp114_ = _tmp113_;
		_tmp115_ = draw_area_get_orig_info (_tmp114_);
		_tmp116_ = _tmp115_;
		_tmp117_ = orig_summary;
		_tmp118_ = orig_style;
		_tmp119_ = undo_node_attach_new (_tmp107_, _tmp108_, draw_area_get_orig_side (_tmp111_), orig_index, _tmp116_, _tmp117_, orig_summary_index, _tmp118_);
		_tmp120_ = _tmp119_;
		mind_map_add_undo (_tmp106_, (UndoItem*) _tmp120_);
		_g_object_unref0 (_tmp120_);
	}
	_tmp121_ = self->priv->_map;
	_tmp122_ = mind_map_get_animator (_tmp121_);
	_tmp123_ = _tmp122_;
	animator_animate (_tmp123_);
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	_g_object_unref0 (summary);
	_g_object_unref0 (current);
	_style_unref0 (orig_style);
	_g_object_unref0 (orig_summary);
	_g_object_unref0 (orig_parent);
}

void
map_model_attach_nodes (MapModel* self,
                        GArray* nodes,
                        Node* parent)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (nodes != NULL);
	g_return_if_fail (parent != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				Node* node = NULL;
				Node* _tmp2_;
				Node* _tmp3_;
				Node* _tmp4_;
				Node* _tmp5_;
				Node* _tmp6_;
				Node* _tmp7_;
				NodeSide _tmp8_;
				NodeSide _tmp9_;
				Node* _tmp10_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(((guint) i) < nodes->len)) {
					break;
				}
				_tmp2_ = g_array_index (nodes, Node*, (guint) i);
				_tmp3_ = _g_object_ref0 (_tmp2_);
				node = _tmp3_;
				_tmp4_ = node;
				node_return_to_position (_tmp4_);
				_tmp5_ = node;
				node_make_children_siblings (_tmp5_);
				_tmp6_ = node;
				_tmp7_ = node;
				_tmp8_ = node_get_side (_tmp7_);
				_tmp9_ = _tmp8_;
				node_detach (_tmp6_, _tmp9_);
				_tmp10_ = node;
				node_attach (_tmp10_, parent, -1, NULL, TRUE);
				_g_object_unref0 (node);
			}
		}
	}
}

void
map_model_set_style_after_parent_attach (MapModel* self,
                                         Node* node)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	if (!node_is_root (node)) {
		Node* sibling = NULL;
		Node* _tmp0_;
		gboolean _tmp1_ = FALSE;
		MindMap* _tmp2_;
		GSettings* _tmp3_;
		GSettings* _tmp4_;
		gboolean from_parent = FALSE;
		gboolean _tmp6_ = FALSE;
		_tmp0_ = node_previous_sibling (node, FALSE);
		sibling = _tmp0_;
		_tmp2_ = self->priv->_map;
		_tmp3_ = mind_map_get_settings (_tmp2_);
		_tmp4_ = _tmp3_;
		if (g_settings_get_boolean (_tmp4_, "style-always-from-parent")) {
			_tmp1_ = TRUE;
		} else {
			Node* _tmp5_;
			_tmp5_ = sibling;
			_tmp1_ = _tmp5_ == NULL;
		}
		from_parent = _tmp1_;
		if (node_main_branch (node)) {
			_tmp6_ = from_parent;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			MindMap* _tmp7_;
			Style* _tmp8_;
			Style* _tmp9_;
			_tmp7_ = self->priv->_map;
			_tmp8_ = mind_map_get_global_style (_tmp7_);
			_tmp9_ = _tmp8_;
			node_set_style (node, _tmp9_);
		} else {
			if (from_parent) {
				Node* _tmp10_;
				Node* _tmp11_;
				Style* _tmp12_;
				Style* _tmp13_;
				_tmp10_ = node_get_parent (node);
				_tmp11_ = _tmp10_;
				_tmp12_ = node_get_style (_tmp11_);
				_tmp13_ = _tmp12_;
				node_set_style (node, _tmp13_);
			} else {
				Node* _tmp14_;
				Style* _tmp15_;
				Style* _tmp16_;
				_tmp14_ = sibling;
				_tmp15_ = node_get_style (_tmp14_);
				_tmp16_ = _tmp15_;
				node_set_style (node, _tmp16_);
			}
		}
		_g_object_unref0 (sibling);
	}
}

gboolean
map_model_sibling_exists (MapModel* self,
                          Node* node)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (node != NULL) {
		gboolean _tmp1_ = FALSE;
		if (node_is_root (node)) {
			GArray* _tmp2_;
			_tmp2_ = self->priv->_nodes;
			_tmp1_ = _tmp2_->len > ((guint) 1);
		} else {
			Node* _tmp3_;
			Node* _tmp4_;
			GArray* _tmp5_;
			GArray* _tmp6_;
			_tmp3_ = node_get_parent (node);
			_tmp4_ = _tmp3_;
			_tmp5_ = node_children (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp1_ = _tmp6_->len > ((guint) 1);
			_g_array_unref0 (_tmp6_);
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

gboolean
map_model_sequences_togglable (MapModel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				MindMap* _tmp2_;
				Selection* _tmp3_;
				Selection* _tmp4_;
				GArray* _tmp5_;
				GArray* _tmp6_;
				gboolean _tmp7_;
				Node* node = NULL;
				MindMap* _tmp8_;
				Selection* _tmp9_;
				Selection* _tmp10_;
				GArray* _tmp11_;
				GArray* _tmp12_;
				Node* _tmp13_;
				Node* _tmp14_;
				Node* _tmp15_;
				Node* _tmp16_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_map;
				_tmp3_ = mind_map_get_selected (_tmp2_);
				_tmp4_ = _tmp3_;
				_tmp5_ = selection_nodes (_tmp4_);
				_tmp6_ = _tmp5_;
				_tmp7_ = !(((guint) i) < _tmp6_->len);
				_g_array_unref0 (_tmp6_);
				if (_tmp7_) {
					break;
				}
				_tmp8_ = self->priv->_map;
				_tmp9_ = mind_map_get_selected (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = selection_nodes (_tmp10_);
				_tmp12_ = _tmp11_;
				_tmp13_ = g_array_index (_tmp12_, Node*, (guint) i);
				_tmp14_ = _g_object_ref0 (_tmp13_);
				_tmp15_ = _tmp14_;
				_g_array_unref0 (_tmp12_);
				node = _tmp15_;
				_tmp16_ = node;
				if (!node_is_root (_tmp16_)) {
					result = TRUE;
					_g_object_unref0 (node);
					return result;
				}
				_g_object_unref0 (node);
			}
		}
	}
	result = FALSE;
	return result;
}

void
map_model_toggle_sequence (MapModel* self)
{
	GArray* changed = NULL;
	GArray* _tmp0_;
	GArray* _tmp25_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	changed = _tmp0_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp1_ = FALSE;
			_tmp1_ = TRUE;
			while (TRUE) {
				MindMap* _tmp3_;
				Selection* _tmp4_;
				Selection* _tmp5_;
				GArray* _tmp6_;
				GArray* _tmp7_;
				gboolean _tmp8_;
				Node* node = NULL;
				MindMap* _tmp9_;
				Selection* _tmp10_;
				Selection* _tmp11_;
				GArray* _tmp12_;
				GArray* _tmp13_;
				Node* _tmp14_;
				Node* _tmp15_;
				Node* _tmp16_;
				Node* _tmp17_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp3_ = self->priv->_map;
				_tmp4_ = mind_map_get_selected (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = selection_nodes (_tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = !(((guint) i) < _tmp7_->len);
				_g_array_unref0 (_tmp7_);
				if (_tmp8_) {
					break;
				}
				_tmp9_ = self->priv->_map;
				_tmp10_ = mind_map_get_selected (_tmp9_);
				_tmp11_ = _tmp10_;
				_tmp12_ = selection_nodes (_tmp11_);
				_tmp13_ = _tmp12_;
				_tmp14_ = g_array_index (_tmp13_, Node*, (guint) i);
				_tmp15_ = _g_object_ref0 (_tmp14_);
				_tmp16_ = _tmp15_;
				_g_array_unref0 (_tmp13_);
				node = _tmp16_;
				_tmp17_ = node;
				if (!node_is_root (_tmp17_)) {
					Node* _tmp18_;
					Node* _tmp19_;
					gboolean _tmp20_;
					gboolean _tmp21_;
					GArray* _tmp22_;
					Node* _tmp23_;
					Node* _tmp24_;
					_tmp18_ = node;
					_tmp19_ = node;
					_tmp20_ = node_get_sequence (_tmp19_);
					_tmp21_ = _tmp20_;
					node_set_sequence (_tmp18_, !_tmp21_);
					_tmp22_ = changed;
					_tmp23_ = node;
					_tmp24_ = _g_object_ref0 (_tmp23_);
					g_array_append_val (_tmp22_, _tmp24_);
				}
				_g_object_unref0 (node);
			}
		}
	}
	_tmp25_ = changed;
	if (_tmp25_->len > ((guint) 0)) {
		MindMap* _tmp26_;
		GArray* _tmp27_;
		UndoNodeSequences* _tmp28_;
		UndoNodeSequences* _tmp29_;
		_tmp26_ = self->priv->_map;
		_tmp27_ = changed;
		_tmp28_ = undo_node_sequences_new (_tmp27_);
		_tmp29_ = _tmp28_;
		mind_map_add_undo (_tmp26_, (UndoItem*) _tmp29_);
		_g_object_unref0 (_tmp29_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
		map_model_auto_save (self);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	}
	_g_array_unref0 (changed);
}

static void
_vala_Connection_free_function_content_of (gpointer data)
{
	Connection* self;
	self = *((Connection**) data);
	_g_object_unref0_ (self);
}

void
map_model_delete_node (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	Node* next_node = NULL;
	MindMap* _tmp5_;
	Node* _tmp6_;
	GArray* conns = NULL;
	GArray* _tmp7_;
	UndoNodeGroups* undo_groups = NULL;
	MindMap* _tmp8_;
	Animator* _tmp9_;
	Animator* _tmp10_;
	GArray* _tmp11_;
	Connections* _tmp12_;
	Node* _tmp13_;
	GArray* _tmp14_;
	NodeGroups* _tmp15_;
	Node* _tmp16_;
	Node* _tmp17_;
	MindMap* _tmp49_;
	Selection* _tmp50_;
	Selection* _tmp51_;
	Node* _tmp52_;
	Node* _tmp53_;
	MindMap* _tmp60_;
	Node* _tmp61_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (current);
		return;
	}
	_tmp5_ = self->priv->_map;
	_tmp6_ = mind_map_next_node_to_select (_tmp5_);
	next_node = _tmp6_;
	_tmp7_ = g_array_new (TRUE, TRUE, sizeof (Connection*));
	g_array_set_clear_func (_tmp7_, (GDestroyNotify) _vala_Connection_free_function_content_of);
	conns = _tmp7_;
	undo_groups = NULL;
	_tmp8_ = self->priv->_map;
	_tmp9_ = mind_map_get_animator (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->_nodes;
	animator_add_nodes (_tmp10_, _tmp11_, TRUE, "delete_node");
	_tmp12_ = self->priv->_connections;
	_tmp13_ = current;
	_tmp14_ = conns;
	connections_node_deleted (_tmp12_, _tmp13_, _tmp14_);
	_tmp15_ = self->priv->_groups;
	_tmp16_ = current;
	node_groups_remove_node (_tmp15_, _tmp16_, &undo_groups);
	_tmp17_ = current;
	if (node_is_root (_tmp17_)) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp18_ = FALSE;
				_tmp18_ = TRUE;
				while (TRUE) {
					GArray* _tmp20_;
					GArray* _tmp21_;
					Node* _tmp22_;
					Node* _tmp23_;
					if (!_tmp18_) {
						gint _tmp19_;
						_tmp19_ = i;
						i = _tmp19_ + 1;
					}
					_tmp18_ = FALSE;
					_tmp20_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp20_->len)) {
						break;
					}
					_tmp21_ = self->priv->_nodes;
					_tmp22_ = g_array_index (_tmp21_, Node*, (guint) i);
					_tmp23_ = current;
					if (_tmp22_ == _tmp23_) {
						MindMap* _tmp24_;
						Node* _tmp25_;
						GArray* _tmp26_;
						UndoNodeGroups* _tmp27_;
						UndoNodeDelete* _tmp28_;
						UndoNodeDelete* _tmp29_;
						GArray* _tmp30_;
						Node* _tmp31_;
						Node* _tmp32_;
						_tmp24_ = self->priv->_map;
						_tmp25_ = current;
						_tmp26_ = conns;
						_tmp27_ = undo_groups;
						_tmp28_ = undo_node_delete_new (_tmp25_, i, _tmp26_, _tmp27_);
						_tmp29_ = _tmp28_;
						mind_map_add_undo (_tmp24_, (UndoItem*) _tmp29_);
						_g_object_unref0 (_tmp29_);
						_tmp30_ = self->priv->_nodes;
						_tmp31_ = vala_g_array_remove_index (_tmp30_, (guint) i);
						_tmp32_ = _tmp31_;
						_g_object_unref0 (_tmp32_);
						break;
					}
				}
			}
		}
	} else {
		Node* _tmp33_;
		_tmp33_ = current;
		if (node_is_summary (_tmp33_)) {
			MindMap* _tmp34_;
			Node* _tmp35_;
			GArray* _tmp36_;
			UndoNodeGroups* _tmp37_;
			UndoNodeSummaryDelete* _tmp38_;
			UndoNodeSummaryDelete* _tmp39_;
			Node* _tmp40_;
			_tmp34_ = self->priv->_map;
			_tmp35_ = current;
			_tmp36_ = conns;
			_tmp37_ = undo_groups;
			_tmp38_ = undo_node_summary_delete_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, TYPE_SUMMARY_NODE, SummaryNode), _tmp36_, _tmp37_);
			_tmp39_ = _tmp38_;
			mind_map_add_undo (_tmp34_, (UndoItem*) _tmp39_);
			_g_object_unref0 (_tmp39_);
			_tmp40_ = current;
			node_delete (_tmp40_);
		} else {
			MindMap* _tmp41_;
			Node* _tmp42_;
			Node* _tmp43_;
			GArray* _tmp44_;
			UndoNodeGroups* _tmp45_;
			UndoNodeDelete* _tmp46_;
			UndoNodeDelete* _tmp47_;
			Node* _tmp48_;
			_tmp41_ = self->priv->_map;
			_tmp42_ = current;
			_tmp43_ = current;
			_tmp44_ = conns;
			_tmp45_ = undo_groups;
			_tmp46_ = undo_node_delete_new (_tmp42_, node_index (_tmp43_), _tmp44_, _tmp45_);
			_tmp47_ = _tmp46_;
			mind_map_add_undo (_tmp41_, (UndoItem*) _tmp47_);
			_g_object_unref0 (_tmp47_);
			_tmp48_ = current;
			node_delete (_tmp48_);
		}
	}
	_tmp49_ = self->priv->_map;
	_tmp50_ = mind_map_get_selected (_tmp49_);
	_tmp51_ = _tmp50_;
	_tmp52_ = current;
	selection_remove_node (_tmp51_, _tmp52_, 1.0, TRUE);
	_tmp53_ = current;
	if (!node_is_root (_tmp53_)) {
		MindMap* _tmp54_;
		Animator* _tmp55_;
		Animator* _tmp56_;
		_tmp54_ = self->priv->_map;
		_tmp55_ = mind_map_get_animator (_tmp54_);
		_tmp56_ = _tmp55_;
		animator_animate (_tmp56_);
	} else {
		MindMap* _tmp57_;
		Animator* _tmp58_;
		Animator* _tmp59_;
		_tmp57_ = self->priv->_map;
		_tmp58_ = mind_map_get_animator (_tmp57_);
		_tmp59_ = _tmp58_;
		animator_cancel_last_add (_tmp59_);
	}
	_tmp60_ = self->priv->_map;
	_tmp61_ = next_node;
	mind_map_select_node (_tmp60_, _tmp61_, TRUE);
	map_model_auto_save (self);
	_undo_node_groups_free0 (undo_groups);
	_g_array_unref0 (conns);
	_g_object_unref0 (next_node);
	_g_object_unref0 (current);
}

void
map_model_delete_nodes (MapModel* self)
{
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	MindMap* _tmp3_;
	Selection* _tmp4_;
	Selection* _tmp5_;
	GArray* nodes = NULL;
	MindMap* _tmp14_;
	Selection* _tmp15_;
	Selection* _tmp16_;
	GArray* _tmp17_;
	GArray* conns = NULL;
	GArray* _tmp18_;
	GArray* undo_groups = NULL;
	MindMap* _tmp19_;
	Animator* _tmp20_;
	Animator* _tmp21_;
	GArray* _tmp22_;
	NodeGroups* _tmp30_;
	GArray* _tmp31_;
	GArray* _tmp32_ = NULL;
	MindMap* _tmp33_;
	GArray* _tmp34_;
	GArray* _tmp35_;
	GArray* _tmp36_;
	UndoNodesDelete* _tmp37_;
	UndoNodesDelete* _tmp38_;
	MindMap* _tmp44_;
	Selection* _tmp45_;
	Selection* _tmp46_;
	MindMap* _tmp47_;
	Animator* _tmp48_;
	Animator* _tmp49_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	if (selection_num_nodes (_tmp2_) == 0) {
		return;
	}
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_selected (_tmp3_);
	_tmp5_ = _tmp4_;
	if (selection_num_nodes (_tmp5_) == 1) {
		MindMap* _tmp6_;
		MindMap* _tmp7_;
		MapModel* _tmp8_;
		MapModel* _tmp9_;
		MindMap* _tmp10_;
		MindMap* _tmp11_;
		Node* _tmp12_;
		Node* _tmp13_;
		_tmp6_ = map_model_get_map (self);
		_tmp7_ = _tmp6_;
		_tmp8_ = mind_map_get_model (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = map_model_get_map (self);
		_tmp11_ = _tmp10_;
		_tmp12_ = mind_map_get_current_node (_tmp11_);
		_tmp13_ = _tmp12_;
		map_model_set_node_mode (_tmp9_, _tmp13_, NODE_MODE_SELECTED, TRUE);
		_g_object_unref0 (_tmp13_);
	}
	_tmp14_ = self->priv->_map;
	_tmp15_ = mind_map_get_selected (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = selection_ordered_nodes (_tmp16_);
	nodes = _tmp17_;
	_tmp18_ = g_array_new (TRUE, TRUE, sizeof (Connection*));
	g_array_set_clear_func (_tmp18_, (GDestroyNotify) _vala_Connection_free_function_content_of);
	conns = _tmp18_;
	undo_groups = NULL;
	_tmp19_ = self->priv->_map;
	_tmp20_ = mind_map_get_animator (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = self->priv->_nodes;
	animator_add_nodes (_tmp21_, _tmp22_, TRUE, "delete_nodes");
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp23_ = FALSE;
			_tmp23_ = TRUE;
			while (TRUE) {
				GArray* _tmp25_;
				Connections* _tmp26_;
				GArray* _tmp27_;
				Node* _tmp28_;
				GArray* _tmp29_;
				if (!_tmp23_) {
					gint _tmp24_;
					_tmp24_ = i;
					i = _tmp24_ + 1;
				}
				_tmp23_ = FALSE;
				_tmp25_ = nodes;
				if (!(((guint) i) < _tmp25_->len)) {
					break;
				}
				_tmp26_ = self->priv->_connections;
				_tmp27_ = nodes;
				_tmp28_ = g_array_index (_tmp27_, Node*, (guint) i);
				_tmp29_ = conns;
				connections_node_only_deleted (_tmp26_, _tmp28_, _tmp29_);
			}
		}
	}
	_tmp30_ = self->priv->_groups;
	_tmp31_ = nodes;
	node_groups_remove_nodes (_tmp30_, _tmp31_, &_tmp32_);
	_g_array_unref0 (undo_groups);
	undo_groups = _tmp32_;
	_tmp33_ = self->priv->_map;
	_tmp34_ = nodes;
	_tmp35_ = conns;
	_tmp36_ = undo_groups;
	_tmp37_ = undo_nodes_delete_new (_tmp34_, _tmp35_, _tmp36_, _ ("delete nodes"));
	_tmp38_ = _tmp37_;
	mind_map_add_undo (_tmp33_, (UndoItem*) _tmp38_);
	_g_object_unref0 (_tmp38_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp39_ = FALSE;
			_tmp39_ = TRUE;
			while (TRUE) {
				GArray* _tmp41_;
				GArray* _tmp42_;
				Node* _tmp43_;
				if (!_tmp39_) {
					gint _tmp40_;
					_tmp40_ = i;
					i = _tmp40_ + 1;
				}
				_tmp39_ = FALSE;
				_tmp41_ = nodes;
				if (!(((guint) i) < _tmp41_->len)) {
					break;
				}
				_tmp42_ = nodes;
				_tmp43_ = g_array_index (_tmp42_, Node*, (guint) i);
				node_delete_only (_tmp43_);
			}
		}
	}
	_tmp44_ = self->priv->_map;
	_tmp45_ = mind_map_get_selected (_tmp44_);
	_tmp46_ = _tmp45_;
	selection_clear_nodes (_tmp46_, TRUE, 1.0);
	_tmp47_ = self->priv->_map;
	_tmp48_ = mind_map_get_animator (_tmp47_);
	_tmp49_ = _tmp48_;
	animator_animate (_tmp49_);
	map_model_auto_save (self);
	_g_array_unref0 (undo_groups);
	_g_array_unref0 (conns);
	_g_array_unref0 (nodes);
}

void
map_model_remove_sticker (MapModel* self)
{
	Sticker* current_sticker = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Sticker* _tmp3_;
	Sticker* _tmp4_;
	Node* current_node = NULL;
	MindMap* _tmp15_;
	Selection* _tmp16_;
	Selection* _tmp17_;
	Node* _tmp18_;
	Node* _tmp19_;
	Connection* current_conn = NULL;
	MindMap* _tmp25_;
	Selection* _tmp26_;
	Selection* _tmp27_;
	Connection* _tmp28_;
	Connection* _tmp29_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_sticker (_tmp2_);
	current_sticker = _tmp3_;
	_tmp4_ = current_sticker;
	if (_tmp4_ != NULL) {
		MindMap* _tmp5_;
		Sticker* _tmp6_;
		UndoStickerRemove* _tmp7_;
		UndoStickerRemove* _tmp8_;
		Stickers* _tmp9_;
		Sticker* _tmp10_;
		MindMap* _tmp11_;
		Selection* _tmp12_;
		Selection* _tmp13_;
		Sticker* _tmp14_;
		_tmp5_ = self->priv->_map;
		_tmp6_ = current_sticker;
		_tmp7_ = undo_sticker_remove_new (_tmp6_);
		_tmp8_ = _tmp7_;
		mind_map_add_undo (_tmp5_, (UndoItem*) _tmp8_);
		_g_object_unref0 (_tmp8_);
		_tmp9_ = self->priv->_stickers;
		_tmp10_ = current_sticker;
		stickers_remove_sticker (_tmp9_, _tmp10_);
		_tmp11_ = self->priv->_map;
		_tmp12_ = mind_map_get_selected (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = current_sticker;
		selection_remove_sticker (_tmp13_, _tmp14_, 1.0);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		_g_object_unref0 (current_sticker);
		return;
	}
	_tmp15_ = self->priv->_map;
	_tmp16_ = mind_map_get_selected (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = selection_current_node (_tmp17_);
	current_node = _tmp18_;
	_tmp19_ = current_node;
	if (_tmp19_ != NULL) {
		MindMap* _tmp20_;
		Node* _tmp21_;
		UndoNodeStickerRemove* _tmp22_;
		UndoNodeStickerRemove* _tmp23_;
		Node* _tmp24_;
		_tmp20_ = self->priv->_map;
		_tmp21_ = current_node;
		_tmp22_ = undo_node_sticker_remove_new (_tmp21_);
		_tmp23_ = _tmp22_;
		mind_map_add_undo (_tmp20_, (UndoItem*) _tmp23_);
		_g_object_unref0 (_tmp23_);
		_tmp24_ = current_node;
		node_set_sticker (_tmp24_, NULL);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		_g_object_unref0 (current_node);
		_g_object_unref0 (current_sticker);
		return;
	}
	_tmp25_ = self->priv->_map;
	_tmp26_ = mind_map_get_selected (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = selection_current_connection (_tmp27_);
	current_conn = _tmp28_;
	_tmp29_ = current_conn;
	if (_tmp29_ != NULL) {
		MindMap* _tmp30_;
		Connection* _tmp31_;
		UndoConnectionStickerRemove* _tmp32_;
		UndoConnectionStickerRemove* _tmp33_;
		Connection* _tmp34_;
		_tmp30_ = self->priv->_map;
		_tmp31_ = current_conn;
		_tmp32_ = undo_connection_sticker_remove_new (_tmp31_);
		_tmp33_ = _tmp32_;
		mind_map_add_undo (_tmp30_, (UndoItem*) _tmp33_);
		_g_object_unref0 (_tmp33_);
		_tmp34_ = current_conn;
		connection_set_sticker (_tmp34_, NULL);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		_g_object_unref0 (current_conn);
		_g_object_unref0 (current_node);
		_g_object_unref0 (current_sticker);
		return;
	}
	_g_object_unref0 (current_conn);
	_g_object_unref0 (current_node);
	_g_object_unref0 (current_sticker);
}

void
map_model_position_root_node (MapModel* self,
                              Node* node)
{
	GArray* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = self->priv->_nodes;
	if (_tmp0_->len == ((guint) 0)) {
		gint _tmp1_ = 0;
		MindMap* _tmp2_;
		DrawArea* _tmp3_;
		DrawArea* _tmp4_;
		gint width = 0;
		gint _tmp8_ = 0;
		MindMap* _tmp9_;
		DrawArea* _tmp10_;
		DrawArea* _tmp11_;
		gint height = 0;
		_tmp2_ = self->priv->_map;
		_tmp3_ = mind_map_get_canvas (_tmp2_);
		_tmp4_ = _tmp3_;
		if (gtk_widget_get_allocated_width ((GtkWidget*) _tmp4_) == 0) {
			_tmp1_ = 600;
		} else {
			MindMap* _tmp5_;
			DrawArea* _tmp6_;
			DrawArea* _tmp7_;
			_tmp5_ = self->priv->_map;
			_tmp6_ = mind_map_get_canvas (_tmp5_);
			_tmp7_ = _tmp6_;
			_tmp1_ = gtk_widget_get_allocated_width ((GtkWidget*) _tmp7_);
		}
		width = _tmp1_;
		_tmp9_ = self->priv->_map;
		_tmp10_ = mind_map_get_canvas (_tmp9_);
		_tmp11_ = _tmp10_;
		if (gtk_widget_get_allocated_height ((GtkWidget*) _tmp11_) == 0) {
			_tmp8_ = 600;
		} else {
			MindMap* _tmp12_;
			DrawArea* _tmp13_;
			DrawArea* _tmp14_;
			_tmp12_ = self->priv->_map;
			_tmp13_ = mind_map_get_canvas (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp8_ = gtk_widget_get_allocated_height ((GtkWidget*) _tmp14_);
		}
		height = _tmp8_;
		node_set_posx (node, (gdouble) ((width / 4) - 50));
		node_set_posy (node, (gdouble) ((height / 2) - 30));
	} else {
		GArray* _tmp15_;
		GArray* _tmp16_;
		Node* _tmp17_;
		Layout* _tmp18_;
		Layout* _tmp19_;
		GArray* _tmp20_;
		GArray* _tmp21_;
		Node* _tmp22_;
		_tmp15_ = self->priv->_nodes;
		_tmp16_ = self->priv->_nodes;
		_tmp17_ = g_array_index (_tmp15_, Node*, _tmp16_->len - 1);
		_tmp18_ = node_get_layout (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = self->priv->_nodes;
		_tmp21_ = self->priv->_nodes;
		_tmp22_ = g_array_index (_tmp20_, Node*, _tmp21_->len - 1);
		layout_position_root (_tmp19_, _tmp22_, node);
	}
}

Node*
map_model_create_root_node (MapModel* self,
                            const gchar* name)
{
	Layout* _tmp0_ = NULL;
	GArray* _tmp1_;
	Node* node = NULL;
	MindMap* _tmp9_;
	Node* _tmp10_;
	Style* style = NULL;
	Style* _tmp11_;
	MindMap* _tmp12_;
	Style* _tmp13_;
	Style* _tmp14_;
	GArray* _tmp15_;
	Node* _tmp16_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp1_ = self->priv->_nodes;
	if (_tmp1_->len == ((guint) 0)) {
		Layouts* _tmp2_;
		Layout* _tmp3_;
		_tmp2_ = self->priv->_layouts;
		_tmp3_ = layouts_get_default (_tmp2_);
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp3_;
	} else {
		GArray* _tmp4_;
		Node* _tmp5_;
		Layout* _tmp6_;
		Layout* _tmp7_;
		Layout* _tmp8_;
		_tmp4_ = self->priv->_nodes;
		_tmp5_ = g_array_index (_tmp4_, Node*, (guint) 0);
		_tmp6_ = node_get_layout (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = _g_object_ref0 (_tmp7_);
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp8_;
	}
	_tmp9_ = self->priv->_map;
	_tmp10_ = node_new_with_name (_tmp9_, name, _tmp0_);
	node = _tmp10_;
	_tmp11_ = style_new ();
	style = _tmp11_;
	_tmp12_ = self->priv->_map;
	_tmp13_ = mind_map_get_global_style (_tmp12_);
	_tmp14_ = _tmp13_;
	style_copy (style, _tmp14_);
	style_set_node_padding (style, 20);
	node_set_style (node, style);
	map_model_position_root_node (self, node);
	_tmp15_ = self->priv->_nodes;
	_tmp16_ = _g_object_ref0 (node);
	g_array_append_val (_tmp15_, _tmp16_);
	result = node;
	_style_unref0 (style);
	_g_object_unref0 (_tmp0_);
	return result;
}

Node*
map_model_create_main_node (MapModel* self,
                            Node* root,
                            NodeSide side,
                            const gchar* name)
{
	Node* node = NULL;
	MindMap* _tmp0_;
	Layouts* _tmp1_;
	Layout* _tmp2_;
	Layout* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	Node* _tmp6_;
	gboolean _tmp7_ = FALSE;
	Layout* _tmp8_;
	Layout* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	Node* _tmp17_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (root != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = self->priv->_layouts;
	_tmp2_ = layouts_get_default (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_new_with_name (_tmp0_, name, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	node = _tmp5_;
	_tmp6_ = node;
	node_set_side (_tmp6_, side);
	_tmp8_ = node_get_layout (root);
	_tmp9_ = _tmp8_;
	_tmp10_ = layout_get_balanceable (_tmp9_);
	_tmp11_ = _tmp10_;
	if (_tmp11_) {
		gboolean _tmp12_ = FALSE;
		if (side == NODE_SIDE_LEFT) {
			_tmp12_ = TRUE;
		} else {
			_tmp12_ = side == NODE_SIDE_TOP;
		}
		_tmp7_ = _tmp12_;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		Node* _tmp13_;
		Theme* _tmp14_;
		_tmp13_ = node;
		_tmp14_ = self->priv->_theme;
		node_attach (_tmp13_, root, node_side_count (root, side), _tmp14_, FALSE);
	} else {
		Node* _tmp15_;
		Theme* _tmp16_;
		_tmp15_ = node;
		_tmp16_ = self->priv->_theme;
		node_attach (_tmp15_, root, -1, _tmp16_, FALSE);
	}
	_tmp17_ = node;
	map_model_set_style_after_parent_attach (self, _tmp17_);
	result = node;
	return result;
}

Node*
map_model_create_sibling_node (MapModel* self,
                               Node* sibling,
                               gboolean below,
                               const gchar* name)
{
	Node* node = NULL;
	MindMap* _tmp0_;
	Layouts* _tmp1_;
	Layout* _tmp2_;
	Layout* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	Node* _tmp6_;
	NodeSide _tmp7_;
	NodeSide _tmp8_;
	gint _tmp9_ = 0;
	Node* _tmp10_;
	Node* _tmp11_;
	Node* _tmp12_;
	Theme* _tmp13_;
	Node* _tmp14_;
	Node* _tmp16_;
	Node* _tmp17_;
	Node* _tmp18_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (sibling != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = self->priv->_layouts;
	_tmp2_ = layouts_get_default (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_new_with_name (_tmp0_, name, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	node = _tmp5_;
	_tmp6_ = node;
	_tmp7_ = node_get_side (sibling);
	_tmp8_ = _tmp7_;
	node_set_side (_tmp6_, _tmp8_);
	if (below) {
		_tmp9_ = 1;
	} else {
		_tmp9_ = 0;
	}
	_tmp10_ = node;
	_tmp11_ = node_get_parent (sibling);
	_tmp12_ = _tmp11_;
	_tmp13_ = self->priv->_theme;
	node_attach (_tmp10_, _tmp12_, node_index (sibling) + _tmp9_, _tmp13_, TRUE);
	_tmp14_ = node;
	map_model_set_style_after_parent_attach (self, _tmp14_);
	if (node_task_enabled (sibling)) {
		Node* _tmp15_;
		_tmp15_ = node;
		node_enable_task (_tmp15_, TRUE);
	}
	_tmp16_ = node;
	_tmp17_ = node_get_parent (_tmp16_);
	_tmp18_ = _tmp17_;
	node_set_fold (_tmp18_, FALSE, TRUE, NULL);
	if (node_is_summarized (sibling)) {
		SummaryNode* _tmp19_;
		SummaryNode* _tmp20_;
		Node* _tmp21_;
		_tmp19_ = node_summary_node (sibling);
		_tmp20_ = _tmp19_;
		_tmp21_ = node;
		summary_node_add_node (_tmp20_, _tmp21_);
		_g_object_unref0 (_tmp20_);
	}
	result = node;
	return result;
}

Node*
map_model_create_parent_node (MapModel* self,
                              Node* child,
                              const gchar* name)
{
	Node* node = NULL;
	MindMap* _tmp0_;
	Layouts* _tmp1_;
	Layout* _tmp2_;
	Layout* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	GdkRGBA* color = NULL;
	GdkRGBA* _tmp6_;
	GdkRGBA* _tmp7_;
	GdkRGBA* _tmp8_;
	NodeSide _tmp9_;
	NodeSide _tmp10_;
	Node* _tmp11_;
	Node* _tmp12_;
	NodeSide _tmp13_;
	NodeSide _tmp14_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (child != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = self->priv->_layouts;
	_tmp2_ = layouts_get_default (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_new_with_name (_tmp0_, name, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	node = _tmp5_;
	_tmp6_ = node_get_link_color (child);
	_tmp7_ = _tmp6_;
	_tmp8_ = __vala_GdkRGBA_copy0 (_tmp7_);
	color = _tmp8_;
	_tmp9_ = node_get_side (child);
	_tmp10_ = _tmp9_;
	node_set_side (node, _tmp10_);
	_tmp11_ = node_get_parent (child);
	_tmp12_ = _tmp11_;
	node_attach (node, _tmp12_, node_index (child), NULL, TRUE);
	node_set_link_color (node, color);
	map_model_set_style_after_parent_attach (self, node);
	_tmp13_ = node_get_side (node);
	_tmp14_ = _tmp13_;
	node_detach (child, _tmp14_);
	node_attach (child, node, -1, NULL, TRUE);
	result = node;
	__vala_GdkRGBA_free0 (color);
	return result;
}

Node*
map_model_create_child_node (MapModel* self,
                             Node* parent,
                             const gchar* name)
{
	Node* node = NULL;
	MindMap* _tmp0_;
	Layouts* _tmp1_;
	Layout* _tmp2_;
	Layout* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	GArray* _tmp9_;
	GArray* _tmp10_;
	gboolean _tmp11_;
	Node* _tmp12_;
	Theme* _tmp13_;
	Node* _tmp14_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (parent != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = self->priv->_layouts;
	_tmp2_ = layouts_get_default (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = node_new_with_name (_tmp0_, name, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	node = _tmp5_;
	if (!node_is_root (parent)) {
		Node* _tmp6_;
		NodeSide _tmp7_;
		NodeSide _tmp8_;
		_tmp6_ = node;
		_tmp7_ = node_get_side (parent);
		_tmp8_ = _tmp7_;
		node_set_side (_tmp6_, _tmp8_);
	}
	_tmp9_ = node_children (parent);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_->len > ((guint) 0);
	_g_array_unref0 (_tmp10_);
	if (_tmp11_) {
		node_set_folded (parent, FALSE);
	}
	_tmp12_ = node;
	_tmp13_ = self->priv->_theme;
	node_attach (_tmp12_, parent, -1, _tmp13_, TRUE);
	_tmp14_ = node;
	map_model_set_style_after_parent_attach (self, _tmp14_);
	if (node_task_enabled (parent)) {
		Node* _tmp15_;
		_tmp15_ = node;
		node_enable_task (_tmp15_, TRUE);
	}
	node_set_fold (parent, FALSE, TRUE, NULL);
	result = node;
	return result;
}

Node*
map_model_create_summary_node (MapModel* self,
                               GArray* nodes)
{
	SummaryNode* summary = NULL;
	MindMap* _tmp0_;
	Layouts* _tmp1_;
	Layout* _tmp2_;
	Layout* _tmp3_;
	SummaryNode* _tmp4_;
	SummaryNode* _tmp5_;
	Node* _tmp6_;
	NodeSide _tmp7_;
	NodeSide _tmp8_;
	Node* _tmp9_;
	Node* _tmp10_;
	Node* _tmp11_;
	Theme* _tmp12_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (nodes != NULL, NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = self->priv->_layouts;
	_tmp2_ = layouts_get_default (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = summary_node_new (_tmp0_, _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	summary = _tmp5_;
	_tmp6_ = g_array_index (nodes, Node*, (guint) 0);
	_tmp7_ = node_get_side (_tmp6_);
	_tmp8_ = _tmp7_;
	node_set_side ((Node*) summary, _tmp8_);
	_tmp9_ = g_array_index (nodes, Node*, (guint) 0);
	_tmp10_ = node_get_parent (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = self->priv->_theme;
	summary_node_attach_nodes (summary, _tmp11_, nodes, TRUE, _tmp12_);
	result = (Node*) summary;
	return result;
}

Node*
map_model_create_summary_node_from_node (MapModel* self,
                                         Node* node)
{
	Node* prev_node = NULL;
	Node* _tmp0_;
	NodeSide _tmp1_;
	NodeSide _tmp2_;
	SummaryNode* summary = NULL;
	MindMap* _tmp3_;
	ImageManager* _tmp4_;
	SummaryNode* _tmp5_;
	NodeSide _tmp6_;
	NodeSide _tmp7_;
	Theme* _tmp8_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	_tmp0_ = node_previous_sibling (node, FALSE);
	prev_node = _tmp0_;
	_tmp1_ = node_get_side (node);
	_tmp2_ = _tmp1_;
	node_detach (node, _tmp2_);
	_tmp3_ = self->priv->_map;
	_tmp4_ = self->priv->_image_manager;
	_tmp5_ = summary_node_new_from_node (_tmp3_, node, _tmp4_);
	summary = _tmp5_;
	_tmp6_ = node_get_side (node);
	_tmp7_ = _tmp6_;
	node_set_side ((Node*) summary, _tmp7_);
	_tmp8_ = self->priv->_theme;
	summary_node_attach_siblings (summary, prev_node, _tmp8_);
	result = (Node*) summary;
	_g_object_unref0 (prev_node);
	return result;
}

void
map_model_add_root_node (MapModel* self)
{
	Node* node = NULL;
	Node* _tmp0_;
	gint int_node_len = 0;
	GArray* _tmp1_;
	MindMap* _tmp2_;
	Node* _tmp3_;
	UndoNodeInsert* _tmp4_;
	UndoNodeInsert* _tmp5_;
	MindMap* _tmp6_;
	Node* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = map_model_create_root_node (self, _ ("Another Idea"));
	node = _tmp0_;
	_tmp1_ = self->priv->_nodes;
	int_node_len = (gint) (_tmp1_->len - 1);
	_tmp2_ = self->priv->_map;
	_tmp3_ = node;
	_tmp4_ = undo_node_insert_new (_tmp3_, int_node_len);
	_tmp5_ = _tmp4_;
	mind_map_add_undo (_tmp2_, (UndoItem*) _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->priv->_map;
	_tmp7_ = node;
	if (mind_map_select_node (_tmp6_, _tmp7_, TRUE)) {
		Node* _tmp8_;
		_tmp8_ = node;
		map_model_set_node_mode (self, _tmp8_, NODE_MODE_EDITABLE, FALSE);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	}
	g_signal_emit (self, map_model_signals[MAP_MODEL_SEE_SIGNAL], 0, TRUE, (gdouble) 0, 100.0);
	map_model_auto_save (self);
	_g_object_unref0 (node);
}

void
map_model_add_connected_node (MapModel* self)
{
	gint index = 0;
	GArray* _tmp0_;
	Node* node = NULL;
	Node* _tmp1_;
	Connection* conn = NULL;
	MindMap* _tmp2_;
	MindMap* _tmp3_;
	Selection* _tmp4_;
	Selection* _tmp5_;
	Node* _tmp6_;
	Node* _tmp7_;
	Connection* _tmp8_;
	Connection* _tmp9_;
	Connection* _tmp10_;
	MindMap* _tmp11_;
	Selection* _tmp12_;
	Selection* _tmp13_;
	Node* _tmp14_;
	Node* _tmp15_;
	Connection* _tmp16_;
	Node* _tmp17_;
	Connections* _tmp18_;
	Connection* _tmp19_;
	MindMap* _tmp20_;
	Node* _tmp21_;
	Connection* _tmp22_;
	UndoConnectedNode* _tmp23_;
	UndoConnectedNode* _tmp24_;
	MindMap* _tmp25_;
	Node* _tmp26_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_nodes;
	index = (gint) _tmp0_->len;
	_tmp1_ = map_model_create_root_node (self, _ ("Another Idea"));
	node = _tmp1_;
	_tmp2_ = self->priv->_map;
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_selected (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = selection_current_node (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = connection_new (_tmp2_, _tmp7_);
	_tmp9_ = _tmp8_;
	_g_object_unref0 (_tmp7_);
	conn = _tmp9_;
	_tmp10_ = conn;
	_tmp11_ = self->priv->_map;
	_tmp12_ = mind_map_get_selected (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = selection_current_node (_tmp13_);
	_tmp15_ = _tmp14_;
	connection_connect_to (_tmp10_, _tmp15_);
	_g_object_unref0 (_tmp15_);
	_tmp16_ = conn;
	_tmp17_ = node;
	connection_connect_to (_tmp16_, _tmp17_);
	_tmp18_ = self->priv->_connections;
	_tmp19_ = conn;
	connections_add_connection (_tmp18_, _tmp19_);
	_tmp20_ = self->priv->_map;
	_tmp21_ = node;
	_tmp22_ = conn;
	_tmp23_ = undo_connected_node_new (_tmp21_, index, _tmp22_);
	_tmp24_ = _tmp23_;
	mind_map_add_undo (_tmp20_, (UndoItem*) _tmp24_);
	_g_object_unref0 (_tmp24_);
	_tmp25_ = self->priv->_map;
	_tmp26_ = node;
	if (mind_map_select_node (_tmp25_, _tmp26_, TRUE)) {
		Node* _tmp27_;
		_tmp27_ = node;
		map_model_set_node_mode (self, _tmp27_, NODE_MODE_EDITABLE, FALSE);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	}
	g_signal_emit (self, map_model_signals[MAP_MODEL_SEE_SIGNAL], 0, TRUE, (gdouble) 0, 100.0);
	map_model_auto_save (self);
	_g_object_unref0 (conn);
	_g_object_unref0 (node);
}

void
map_model_add_sibling_node (MapModel* self,
                            gboolean shift)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	Node* node = NULL;
	Node* _tmp5_;
	Node* _tmp6_;
	MindMap* _tmp7_;
	Node* _tmp8_;
	Node* _tmp9_;
	UndoNodeInsert* _tmp10_;
	UndoNodeInsert* _tmp11_;
	MindMap* _tmp12_;
	Node* _tmp13_;
	Node* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (node_is_summary (_tmp4_)) {
		_g_object_unref0 (current);
		return;
	}
	_tmp5_ = current;
	_tmp6_ = map_model_create_sibling_node (self, _tmp5_, !shift, "");
	node = _tmp6_;
	_tmp7_ = self->priv->_map;
	_tmp8_ = node;
	_tmp9_ = node;
	_tmp10_ = undo_node_insert_new (_tmp8_, node_index (_tmp9_));
	_tmp11_ = _tmp10_;
	mind_map_add_undo (_tmp7_, (UndoItem*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = self->priv->_map;
	_tmp13_ = node;
	mind_map_set_current_node (_tmp12_, _tmp13_);
	_tmp14_ = node;
	map_model_set_node_mode (self, _tmp14_, NODE_MODE_EDITABLE, FALSE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_SEE_SIGNAL], 0, TRUE, (gdouble) 0, 100.0);
	map_model_auto_save (self);
	_g_object_unref0 (node);
	_g_object_unref0 (current);
}

void
map_model_add_parent_node (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	gboolean _tmp4_ = FALSE;
	Node* _tmp5_;
	MindMap* _tmp7_;
	Animator* _tmp8_;
	Animator* _tmp9_;
	GArray* _tmp10_;
	Node* node = NULL;
	Node* _tmp11_;
	Node* _tmp12_;
	MindMap* _tmp13_;
	Node* _tmp14_;
	Node* _tmp15_;
	UndoNodeAddParent* _tmp16_;
	UndoNodeAddParent* _tmp17_;
	MindMap* _tmp18_;
	Node* _tmp19_;
	Node* _tmp20_;
	MindMap* _tmp21_;
	Animator* _tmp22_;
	Animator* _tmp23_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp5_ = current;
	if (node_is_root (_tmp5_)) {
		_tmp4_ = TRUE;
	} else {
		Node* _tmp6_;
		_tmp6_ = current;
		_tmp4_ = node_is_summarized (_tmp6_);
	}
	if (_tmp4_) {
		_g_object_unref0 (current);
		return;
	}
	_tmp7_ = self->priv->_map;
	_tmp8_ = mind_map_get_animator (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->priv->_nodes;
	animator_add_nodes (_tmp9_, _tmp10_, FALSE, "add_parent_node");
	_tmp11_ = current;
	_tmp12_ = map_model_create_parent_node (self, _tmp11_, "");
	node = _tmp12_;
	_tmp13_ = self->priv->_map;
	_tmp14_ = node;
	_tmp15_ = current;
	_tmp16_ = undo_node_add_parent_new (_tmp14_, _tmp15_);
	_tmp17_ = _tmp16_;
	mind_map_add_undo (_tmp13_, (UndoItem*) _tmp17_);
	_g_object_unref0 (_tmp17_);
	_tmp18_ = self->priv->_map;
	_tmp19_ = node;
	mind_map_set_current_node (_tmp18_, _tmp19_);
	_tmp20_ = node;
	map_model_set_node_mode (self, _tmp20_, NODE_MODE_EDITABLE, FALSE);
	_tmp21_ = self->priv->_map;
	_tmp22_ = mind_map_get_animator (_tmp21_);
	_tmp23_ = _tmp22_;
	animator_animate (_tmp23_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_SEE_SIGNAL], 0, TRUE, (gdouble) 0, 100.0);
	map_model_auto_save (self);
	_g_object_unref0 (node);
	_g_object_unref0 (current);
}

void
map_model_add_child_node (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	Node* node = NULL;
	Node* _tmp5_;
	Node* _tmp6_;
	MindMap* _tmp7_;
	Node* _tmp8_;
	Node* _tmp9_;
	UndoNodeInsert* _tmp10_;
	UndoNodeInsert* _tmp11_;
	MindMap* _tmp12_;
	Node* _tmp13_;
	Node* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (node_is_summarized (_tmp4_)) {
		_g_object_unref0 (current);
		return;
	}
	_tmp5_ = current;
	_tmp6_ = map_model_create_child_node (self, _tmp5_, "");
	node = _tmp6_;
	_tmp7_ = self->priv->_map;
	_tmp8_ = node;
	_tmp9_ = node;
	_tmp10_ = undo_node_insert_new (_tmp8_, node_index (_tmp9_));
	_tmp11_ = _tmp10_;
	mind_map_add_undo (_tmp7_, (UndoItem*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = self->priv->_map;
	_tmp13_ = node;
	mind_map_set_current_node (_tmp12_, _tmp13_);
	_tmp14_ = node;
	map_model_set_node_mode (self, _tmp14_, NODE_MODE_EDITABLE, FALSE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_SEE_SIGNAL], 0, TRUE, (gdouble) 0, 100.0);
	map_model_auto_save (self);
	_g_object_unref0 (node);
	_g_object_unref0 (current);
}

gboolean
map_model_nodes_summarizable (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	Node* first = NULL;
	GArray* _tmp5_;
	Node* _tmp6_;
	Node* _tmp7_;
	gboolean _tmp8_ = FALSE;
	Node* _tmp9_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_ordered_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	if (_tmp4_->len < ((guint) 2)) {
		result = FALSE;
		_g_array_unref0 (nodes);
		return result;
	}
	_tmp5_ = nodes;
	_tmp6_ = g_array_index (_tmp5_, Node*, (guint) 0);
	_tmp7_ = _g_object_ref0 (_tmp6_);
	first = _tmp7_;
	_tmp9_ = first;
	if (node_is_leaf (_tmp9_)) {
		Node* _tmp10_;
		_tmp10_ = first;
		_tmp8_ = !node_is_summarized (_tmp10_);
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		{
			gint i = 0;
			i = 1;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					GArray* _tmp13_;
					Node* prev = NULL;
					GArray* _tmp14_;
					Node* _tmp15_;
					Node* _tmp16_;
					Node* node = NULL;
					GArray* _tmp17_;
					Node* _tmp18_;
					Node* _tmp19_;
					gboolean _tmp20_ = FALSE;
					gboolean _tmp21_ = FALSE;
					gboolean _tmp22_ = FALSE;
					gboolean _tmp23_ = FALSE;
					Node* _tmp24_;
					Node* _tmp25_;
					Node* _tmp26_;
					Node* _tmp27_;
					Node* _tmp28_;
					Node* _tmp29_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ + 1;
					}
					_tmp11_ = FALSE;
					_tmp13_ = nodes;
					if (!(((guint) i) < _tmp13_->len)) {
						break;
					}
					_tmp14_ = nodes;
					_tmp15_ = g_array_index (_tmp14_, Node*, (guint) (i - 1));
					_tmp16_ = _g_object_ref0 (_tmp15_);
					prev = _tmp16_;
					_tmp17_ = nodes;
					_tmp18_ = g_array_index (_tmp17_, Node*, (guint) i);
					_tmp19_ = _g_object_ref0 (_tmp18_);
					node = _tmp19_;
					_tmp24_ = prev;
					_tmp25_ = node_get_parent (_tmp24_);
					_tmp26_ = _tmp25_;
					_tmp27_ = node;
					_tmp28_ = node_get_parent (_tmp27_);
					_tmp29_ = _tmp28_;
					if (_tmp26_ != _tmp29_) {
						_tmp23_ = TRUE;
					} else {
						Node* _tmp30_;
						NodeSide _tmp31_;
						NodeSide _tmp32_;
						Node* _tmp33_;
						NodeSide _tmp34_;
						NodeSide _tmp35_;
						_tmp30_ = prev;
						_tmp31_ = node_get_side (_tmp30_);
						_tmp32_ = _tmp31_;
						_tmp33_ = node;
						_tmp34_ = node_get_side (_tmp33_);
						_tmp35_ = _tmp34_;
						_tmp23_ = _tmp32_ != _tmp35_;
					}
					if (_tmp23_) {
						_tmp22_ = TRUE;
					} else {
						Node* _tmp36_;
						Node* _tmp37_;
						_tmp36_ = prev;
						_tmp37_ = node;
						_tmp22_ = (node_index (_tmp36_) + 1) != node_index (_tmp37_);
					}
					if (_tmp22_) {
						_tmp21_ = TRUE;
					} else {
						Node* _tmp38_;
						_tmp38_ = node;
						_tmp21_ = !node_is_leaf (_tmp38_);
					}
					if (_tmp21_) {
						_tmp20_ = TRUE;
					} else {
						Node* _tmp39_;
						_tmp39_ = node;
						_tmp20_ = node_is_summarized (_tmp39_);
					}
					if (_tmp20_) {
						result = FALSE;
						_g_object_unref0 (node);
						_g_object_unref0 (prev);
						_g_object_unref0 (first);
						_g_array_unref0 (nodes);
						return result;
					}
					_g_object_unref0 (node);
					_g_object_unref0 (prev);
				}
			}
		}
	}
	result = TRUE;
	_g_object_unref0 (first);
	_g_array_unref0 (nodes);
	return result;
}

gboolean
map_model_node_summarizable (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	Node* _tmp6_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp6_ = current;
	if (_tmp6_ != NULL) {
		Node* _tmp7_;
		_tmp7_ = current;
		_tmp5_ = !node_is_summary (_tmp7_);
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		Node* _tmp8_;
		_tmp8_ = current;
		_tmp4_ = !node_is_summarized (_tmp8_);
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		Node* sibling = NULL;
		Node* _tmp9_;
		Node* _tmp10_;
		gboolean _tmp11_ = FALSE;
		gboolean _tmp12_ = FALSE;
		gboolean _tmp13_ = FALSE;
		Node* _tmp14_;
		_tmp9_ = current;
		_tmp10_ = node_previous_sibling (_tmp9_, FALSE);
		sibling = _tmp10_;
		_tmp14_ = sibling;
		if (_tmp14_ != NULL) {
			Node* _tmp15_;
			_tmp15_ = sibling;
			_tmp13_ = !node_is_summarized (_tmp15_);
		} else {
			_tmp13_ = FALSE;
		}
		if (_tmp13_) {
			Node* _tmp16_;
			_tmp16_ = sibling;
			_tmp12_ = node_is_leaf (_tmp16_);
		} else {
			_tmp12_ = FALSE;
		}
		if (_tmp12_) {
			Node* _tmp17_;
			NodeSide _tmp18_;
			NodeSide _tmp19_;
			Node* _tmp20_;
			NodeSide _tmp21_;
			NodeSide _tmp22_;
			_tmp17_ = current;
			_tmp18_ = node_get_side (_tmp17_);
			_tmp19_ = _tmp18_;
			_tmp20_ = sibling;
			_tmp21_ = node_get_side (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp11_ = _tmp19_ == _tmp22_;
		} else {
			_tmp11_ = FALSE;
		}
		result = _tmp11_;
		_g_object_unref0 (sibling);
		_g_object_unref0 (current);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (current);
	return result;
}

void
map_model_add_summary_node_from_selected (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	Node* node = NULL;
	GArray* _tmp4_;
	Node* _tmp5_;
	MindMap* _tmp6_;
	Node* _tmp7_;
	UndoNodeSummary* _tmp8_;
	UndoNodeSummary* _tmp9_;
	MindMap* _tmp10_;
	Node* _tmp11_;
	Node* _tmp12_;
	g_return_if_fail (self != NULL);
	if (!map_model_nodes_summarizable (self)) {
		return;
	}
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	_tmp5_ = map_model_create_summary_node (self, _tmp4_);
	node = _tmp5_;
	_tmp6_ = self->priv->_map;
	_tmp7_ = node;
	_tmp8_ = undo_node_summary_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, TYPE_SUMMARY_NODE, SummaryNode));
	_tmp9_ = _tmp8_;
	mind_map_add_undo (_tmp6_, (UndoItem*) _tmp9_);
	_g_object_unref0 (_tmp9_);
	_tmp10_ = self->priv->_map;
	_tmp11_ = node;
	mind_map_set_current_node (_tmp10_, _tmp11_);
	_tmp12_ = node;
	map_model_set_node_mode (self, _tmp12_, NODE_MODE_EDITABLE, FALSE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_SEE_SIGNAL], 0, TRUE, (gdouble) 0, 100.0);
	map_model_auto_save (self);
	_g_object_unref0 (node);
	_g_array_unref0 (nodes);
}

void
map_model_add_summary_node_from_current (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* node = NULL;
	Node* _tmp4_;
	Node* _tmp5_;
	MindMap* _tmp6_;
	Node* _tmp7_;
	Node* _tmp8_;
	UndoNodeSummaryFromNode* _tmp9_;
	UndoNodeSummaryFromNode* _tmp10_;
	MindMap* _tmp11_;
	Node* _tmp12_;
	Node* _tmp13_;
	g_return_if_fail (self != NULL);
	if (!map_model_node_summarizable (self)) {
		return;
	}
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	_tmp5_ = map_model_create_summary_node_from_node (self, _tmp4_);
	node = _tmp5_;
	_tmp6_ = self->priv->_map;
	_tmp7_ = current;
	_tmp8_ = node;
	_tmp9_ = undo_node_summary_from_node_new (_tmp7_, G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, TYPE_SUMMARY_NODE, SummaryNode));
	_tmp10_ = _tmp9_;
	mind_map_add_undo (_tmp6_, (UndoItem*) _tmp10_);
	_g_object_unref0 (_tmp10_);
	_tmp11_ = self->priv->_map;
	_tmp12_ = node;
	mind_map_set_current_node (_tmp11_, _tmp12_);
	_tmp13_ = node;
	map_model_set_node_mode (self, _tmp13_, NODE_MODE_CURRENT, FALSE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_SEE_SIGNAL], 0, TRUE, (gdouble) 0, 100.0);
	map_model_auto_save (self);
	_g_object_unref0 (node);
	_g_object_unref0 (current);
}

void
map_model_replace_node (MapModel* self,
                        Node* orig_node,
                        Node* new_node)
{
	Node* parent = NULL;
	Node* _tmp0_;
	Node* _tmp1_;
	Node* _tmp2_;
	gint _tmp3_ = 0;
	Node* _tmp4_;
	gint index = 0;
	Node* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (orig_node != NULL);
	g_return_if_fail (new_node != NULL);
	_tmp0_ = node_get_parent (orig_node);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	parent = _tmp2_;
	_tmp4_ = parent;
	if (_tmp4_ == NULL) {
		_tmp3_ = map_model_root_index (self, orig_node);
	} else {
		_tmp3_ = node_index (orig_node);
	}
	index = _tmp3_;
	_tmp5_ = parent;
	if (_tmp5_ == NULL) {
		gdouble _tmp6_;
		gdouble _tmp7_;
		gdouble _tmp8_;
		gdouble _tmp9_;
		map_model_remove_root_node (self, orig_node);
		map_model_add_root (self, new_node, index);
		_tmp6_ = node_get_posx (orig_node);
		_tmp7_ = _tmp6_;
		node_set_posx (new_node, _tmp7_);
		_tmp8_ = node_get_posy (orig_node);
		_tmp9_ = _tmp8_;
		node_set_posy (new_node, _tmp9_);
	} else {
		NodeSide _tmp10_;
		NodeSide _tmp11_;
		Node* _tmp12_;
		_tmp10_ = node_get_side (orig_node);
		_tmp11_ = _tmp10_;
		node_detach (orig_node, _tmp11_);
		_tmp12_ = parent;
		node_attach (new_node, _tmp12_, index, NULL, TRUE);
	}
	if (node_main_branch (new_node)) {
		GdkRGBA* _tmp13_;
		GdkRGBA* _tmp14_;
		_tmp13_ = node_get_link_color (orig_node);
		_tmp14_ = _tmp13_;
		node_set_link_color (new_node, _tmp14_);
	}
	_g_object_unref0 (parent);
}

gint
map_model_root_index (MapModel* self,
                      Node* root)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (root != NULL, -1);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				if (_tmp4_ == root) {
					result = i;
					return result;
				}
			}
		}
	}
	result = -1;
	return result;
}

void
map_model_add_root (MapModel* self,
                    Node* n,
                    gint index)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (n != NULL);
	if (index == -1) {
		GArray* _tmp0_;
		Node* _tmp1_;
		_tmp0_ = self->priv->_nodes;
		_tmp1_ = _g_object_ref0 (n);
		g_array_append_val (_tmp0_, _tmp1_);
	} else {
		GArray* _tmp2_;
		Node* _tmp3_;
		_tmp2_ = self->priv->_nodes;
		_tmp3_ = _g_object_ref0 (n);
		g_array_insert_val (_tmp2_, (guint) index, _tmp3_);
	}
}

void
map_model_remove_root (MapModel* self,
                       gint index)
{
	GArray* _tmp0_;
	Node* _tmp1_;
	Node* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_nodes;
	_tmp1_ = vala_g_array_remove_index (_tmp0_, (guint) index);
	_tmp2_ = _tmp1_;
	_g_object_unref0 (_tmp2_);
}

void
map_model_remove_root_node (MapModel* self,
                            Node* node)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				GArray* _tmp3_;
				Node* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				if (_tmp4_ == node) {
					GArray* _tmp5_;
					Node* _tmp6_;
					Node* _tmp7_;
					_tmp5_ = self->priv->_nodes;
					_tmp6_ = vala_g_array_remove_index (_tmp5_, (guint) i);
					_tmp7_ = _tmp6_;
					_g_object_unref0 (_tmp7_);
				}
			}
		}
	}
}

gboolean
map_model_detachable (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	gboolean _tmp4_ = FALSE;
	Node* _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp5_ = current;
	if (_tmp5_ != NULL) {
		Node* _tmp6_;
		Node* _tmp7_;
		Node* _tmp8_;
		_tmp6_ = current;
		_tmp7_ = node_get_parent (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_ != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	result = _tmp4_;
	_g_object_unref0 (current);
	return result;
}

void
map_model_detach (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* parent = NULL;
	Node* _tmp4_;
	Node* _tmp5_;
	Node* _tmp6_;
	Node* _tmp7_;
	gint index = 0;
	Node* _tmp8_;
	NodeSide side = 0;
	Node* _tmp9_;
	NodeSide _tmp10_;
	NodeSide _tmp11_;
	gint root_index = 0;
	GArray* _tmp12_;
	Node* _tmp13_;
	Node* _tmp14_;
	MindMap* _tmp15_;
	Node* _tmp16_;
	Node* _tmp17_;
	UndoNodeDetach* _tmp18_;
	UndoNodeDetach* _tmp19_;
	g_return_if_fail (self != NULL);
	if (!map_model_detachable (self)) {
		return;
	}
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	_tmp5_ = node_get_parent (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	parent = _tmp7_;
	_tmp8_ = current;
	index = node_index (_tmp8_);
	_tmp9_ = current;
	_tmp10_ = node_get_side (_tmp9_);
	_tmp11_ = _tmp10_;
	side = _tmp11_;
	_tmp12_ = self->priv->_nodes;
	root_index = (gint) _tmp12_->len;
	_tmp13_ = current;
	node_detach (_tmp13_, side);
	_tmp14_ = current;
	map_model_add_root (self, _tmp14_, -1);
	_tmp15_ = self->priv->_map;
	_tmp16_ = current;
	_tmp17_ = parent;
	_tmp18_ = undo_node_detach_new (_tmp16_, root_index, _tmp17_, side, index);
	_tmp19_ = _tmp18_;
	mind_map_add_undo (_tmp15_, (UndoItem*) _tmp19_);
	_g_object_unref0 (_tmp19_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_object_unref0 (parent);
	_g_object_unref0 (current);
}

void
map_model_balance_nodes (MapModel* self,
                         gboolean undoable,
                         gboolean animate)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_ = NULL;
	Node* _tmp5_;
	Node* root_node = NULL;
	Node* _tmp8_;
	gboolean _tmp14_ = FALSE;
	Node* _tmp15_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp5_ = current;
	if (_tmp5_ == NULL) {
		_g_object_unref0 (_tmp4_);
		_tmp4_ = NULL;
	} else {
		Node* _tmp6_;
		Node* _tmp7_;
		_tmp6_ = current;
		_tmp7_ = node_get_root (_tmp6_);
		_g_object_unref0 (_tmp4_);
		_tmp4_ = _tmp7_;
	}
	_tmp8_ = _tmp4_;
	_tmp4_ = NULL;
	root_node = _tmp8_;
	if (undoable) {
		MindMap* _tmp9_;
		MindMap* _tmp10_;
		Node* _tmp11_;
		UndoNodeBalance* _tmp12_;
		UndoNodeBalance* _tmp13_;
		_tmp9_ = self->priv->_map;
		_tmp10_ = self->priv->_map;
		_tmp11_ = root_node;
		_tmp12_ = undo_node_balance_new (_tmp10_, _tmp11_);
		_tmp13_ = _tmp12_;
		mind_map_add_undo (_tmp9_, (UndoItem*) _tmp13_);
		_g_object_unref0 (_tmp13_);
	}
	_tmp15_ = current;
	if (_tmp15_ == NULL) {
		_tmp14_ = TRUE;
	} else {
		_tmp14_ = !undoable;
	}
	if (_tmp14_) {
		if (animate) {
			MindMap* _tmp16_;
			Animator* _tmp17_;
			Animator* _tmp18_;
			GArray* _tmp19_;
			_tmp16_ = self->priv->_map;
			_tmp17_ = mind_map_get_animator (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = self->priv->_nodes;
			animator_add_nodes (_tmp18_, _tmp19_, FALSE, "balance nodes");
		}
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp20_ = FALSE;
				_tmp20_ = TRUE;
				while (TRUE) {
					GArray* _tmp22_;
					Partitioner* partitioner = NULL;
					Partitioner* _tmp23_;
					Partitioner* _tmp24_;
					GArray* _tmp25_;
					Node* _tmp26_;
					if (!_tmp20_) {
						gint _tmp21_;
						_tmp21_ = i;
						i = _tmp21_ + 1;
					}
					_tmp20_ = FALSE;
					_tmp22_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp22_->len)) {
						break;
					}
					_tmp23_ = partitioner_new ();
					partitioner = _tmp23_;
					_tmp24_ = partitioner;
					_tmp25_ = self->priv->_nodes;
					_tmp26_ = g_array_index (_tmp25_, Node*, (guint) i);
					partitioner_partition_node (_tmp24_, _tmp26_);
					_g_object_unref0 (partitioner);
				}
			}
		}
	} else {
		Partitioner* partitioner = NULL;
		Partitioner* _tmp31_;
		Partitioner* _tmp32_;
		Node* _tmp33_;
		if (animate) {
			MindMap* _tmp27_;
			Animator* _tmp28_;
			Animator* _tmp29_;
			Node* _tmp30_;
			_tmp27_ = self->priv->_map;
			_tmp28_ = mind_map_get_animator (_tmp27_);
			_tmp29_ = _tmp28_;
			_tmp30_ = root_node;
			animator_add_node (_tmp29_, _tmp30_, "balance tree");
		}
		_tmp31_ = partitioner_new ();
		partitioner = _tmp31_;
		_tmp32_ = partitioner;
		_tmp33_ = root_node;
		partitioner_partition_node (_tmp32_, _tmp33_);
		_g_object_unref0 (partitioner);
	}
	if (animate) {
		MindMap* _tmp34_;
		Animator* _tmp35_;
		Animator* _tmp36_;
		_tmp34_ = self->priv->_map;
		_tmp35_ = mind_map_get_animator (_tmp34_);
		_tmp36_ = _tmp35_;
		animator_animate (_tmp36_);
	}
	_g_object_unref0 (root_node);
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (current);
}

gboolean
map_model_completed_tasks_foldable (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ != NULL) {
		Node* _tmp5_;
		Node* _tmp6_;
		Node* _tmp7_;
		gboolean _tmp8_;
		_tmp5_ = current;
		_tmp6_ = node_get_root (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = node_completed_tasks_foldable (_tmp7_);
		_g_object_unref0 (_tmp7_);
		result = _tmp8_;
		_g_object_unref0 (current);
		return result;
	} else {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp9_ = FALSE;
				_tmp9_ = TRUE;
				while (TRUE) {
					GArray* _tmp11_;
					GArray* _tmp12_;
					Node* _tmp13_;
					if (!_tmp9_) {
						gint _tmp10_;
						_tmp10_ = i;
						i = _tmp10_ + 1;
					}
					_tmp9_ = FALSE;
					_tmp11_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp11_->len)) {
						break;
					}
					_tmp12_ = self->priv->_nodes;
					_tmp13_ = g_array_index (_tmp12_, Node*, (guint) i);
					if (node_completed_tasks_foldable (_tmp13_)) {
						result = TRUE;
						_g_object_unref0 (current);
						return result;
					}
				}
			}
		}
	}
	result = FALSE;
	_g_object_unref0 (current);
	return result;
}

void
map_model_fold_completed_tasks (MapModel* self)
{
	GArray* changes = NULL;
	GArray* _tmp0_;
	Node* current = NULL;
	MindMap* _tmp1_;
	Selection* _tmp2_;
	Selection* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	GArray* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	changes = _tmp0_;
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_selected (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = selection_current_node (_tmp3_);
	current = _tmp4_;
	_tmp5_ = current;
	if (_tmp5_ == NULL) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp6_ = FALSE;
				_tmp6_ = TRUE;
				while (TRUE) {
					GArray* _tmp8_;
					GArray* _tmp9_;
					Node* _tmp10_;
					GArray* _tmp11_;
					if (!_tmp6_) {
						gint _tmp7_;
						_tmp7_ = i;
						i = _tmp7_ + 1;
					}
					_tmp6_ = FALSE;
					_tmp8_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp8_->len)) {
						break;
					}
					_tmp9_ = self->priv->_nodes;
					_tmp10_ = g_array_index (_tmp9_, Node*, (guint) i);
					_tmp11_ = changes;
					node_fold_completed_tasks (_tmp10_, _tmp11_);
				}
			}
		}
	} else {
		Node* _tmp12_;
		Node* _tmp13_;
		Node* _tmp14_;
		GArray* _tmp15_;
		_tmp12_ = current;
		_tmp13_ = node_get_root (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = changes;
		node_fold_completed_tasks (_tmp14_, _tmp15_);
		_g_object_unref0 (_tmp14_);
	}
	_tmp16_ = changes;
	if (_tmp16_->len > ((guint) 0)) {
		MindMap* _tmp17_;
		GArray* _tmp18_;
		UndoNodeFolds* _tmp19_;
		UndoNodeFolds* _tmp20_;
		_tmp17_ = self->priv->_map;
		_tmp18_ = changes;
		_tmp19_ = undo_node_folds_new (_tmp18_);
		_tmp20_ = _tmp19_;
		mind_map_add_undo (_tmp17_, (UndoItem*) _tmp20_);
		_g_object_unref0 (_tmp20_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	}
	_g_object_unref0 (current);
	_g_array_unref0 (changes);
}

gboolean
map_model_unfoldable (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ != NULL) {
		Node* _tmp5_;
		Node* _tmp6_;
		Node* _tmp7_;
		gboolean _tmp8_;
		_tmp5_ = current;
		_tmp6_ = node_get_root (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = node_unfoldable (_tmp7_);
		_g_object_unref0 (_tmp7_);
		result = _tmp8_;
		_g_object_unref0 (current);
		return result;
	} else {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp9_ = FALSE;
				_tmp9_ = TRUE;
				while (TRUE) {
					GArray* _tmp11_;
					GArray* _tmp12_;
					Node* _tmp13_;
					if (!_tmp9_) {
						gint _tmp10_;
						_tmp10_ = i;
						i = _tmp10_ + 1;
					}
					_tmp9_ = FALSE;
					_tmp11_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp11_->len)) {
						break;
					}
					_tmp12_ = self->priv->_nodes;
					_tmp13_ = g_array_index (_tmp12_, Node*, (guint) i);
					if (node_unfoldable (_tmp13_)) {
						result = TRUE;
						_g_object_unref0 (current);
						return result;
					}
				}
			}
		}
	}
	result = FALSE;
	_g_object_unref0 (current);
	return result;
}

void
map_model_unfold_all_nodes (MapModel* self)
{
	GArray* changes = NULL;
	GArray* _tmp0_;
	Node* current = NULL;
	MindMap* _tmp1_;
	Selection* _tmp2_;
	Selection* _tmp3_;
	Node* _tmp4_;
	Node* _tmp5_;
	GArray* _tmp16_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	changes = _tmp0_;
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_selected (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = selection_current_node (_tmp3_);
	current = _tmp4_;
	_tmp5_ = current;
	if (_tmp5_ != NULL) {
		Node* _tmp6_;
		Node* _tmp7_;
		Node* _tmp8_;
		GArray* _tmp9_;
		_tmp6_ = current;
		_tmp7_ = node_get_root (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = changes;
		node_set_fold (_tmp8_, FALSE, TRUE, _tmp9_);
		_g_object_unref0 (_tmp8_);
	} else {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp10_ = FALSE;
				_tmp10_ = TRUE;
				while (TRUE) {
					GArray* _tmp12_;
					GArray* _tmp13_;
					Node* _tmp14_;
					GArray* _tmp15_;
					if (!_tmp10_) {
						gint _tmp11_;
						_tmp11_ = i;
						i = _tmp11_ + 1;
					}
					_tmp10_ = FALSE;
					_tmp12_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp12_->len)) {
						break;
					}
					_tmp13_ = self->priv->_nodes;
					_tmp14_ = g_array_index (_tmp13_, Node*, (guint) i);
					_tmp15_ = changes;
					node_set_fold (_tmp14_, FALSE, TRUE, _tmp15_);
				}
			}
		}
	}
	_tmp16_ = changes;
	if (_tmp16_->len > ((guint) 0)) {
		MindMap* _tmp17_;
		GArray* _tmp18_;
		UndoNodeFolds* _tmp19_;
		UndoNodeFolds* _tmp20_;
		_tmp17_ = self->priv->_map;
		_tmp18_ = changes;
		_tmp19_ = undo_node_folds_new (_tmp18_);
		_tmp20_ = _tmp19_;
		mind_map_add_undo (_tmp17_, (UndoItem*) _tmp20_);
		_g_object_unref0 (_tmp20_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	}
	_g_object_unref0 (current);
	_g_array_unref0 (changes);
}

Node*
map_model_get_select_parent (MapModel* self,
                             Node* node)
{
	Node* _tmp9_;
	Node* _tmp10_;
	Node* _tmp11_;
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	if (node_is_summary (node)) {
		SummaryNode* summary = NULL;
		SummaryNode* _tmp0_;
		Node* _tmp1_ = NULL;
		SummaryNode* _tmp2_;
		Node* _tmp3_;
		Node* _tmp4_;
		Node* _tmp5_;
		Node* _tmp8_;
		_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (node, TYPE_SUMMARY_NODE, SummaryNode));
		summary = _tmp0_;
		_tmp2_ = summary;
		_tmp3_ = summary_node_get_last_selected_node (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		_tmp1_ = _tmp5_;
		if (_tmp1_ == NULL) {
			SummaryNode* _tmp6_;
			Node* _tmp7_;
			_tmp6_ = summary;
			_tmp7_ = summary_node_first_node (_tmp6_);
			_g_object_unref0 (_tmp1_);
			_tmp1_ = _tmp7_;
		}
		_tmp8_ = _tmp1_;
		_tmp1_ = NULL;
		result = _tmp8_;
		_g_object_unref0 (_tmp1_);
		_g_object_unref0 (summary);
		return result;
	}
	_tmp9_ = node_get_parent (node);
	_tmp10_ = _tmp9_;
	_tmp11_ = _g_object_ref0 (_tmp10_);
	result = _tmp11_;
	return result;
}

Node*
map_model_get_node_right (MapModel* self,
                          Node* node)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	if (node_is_root (node)) {
		NodeSide _tmp0_;
		NodeSide _tmp1_;
		_tmp0_ = node_get_side (node);
		_tmp1_ = _tmp0_;
		if (node_side_horizontal (_tmp1_)) {
			gboolean _tmp2_ = FALSE;
			Node* _tmp3_;
			Node* _tmp4_;
			NodeSide _tmp12_;
			Node* _tmp13_;
			_tmp3_ = node_get_last_selected_child (node);
			_tmp4_ = _tmp3_;
			if (_tmp4_ != NULL) {
				Node* _tmp5_;
				Node* _tmp6_;
				NodeSide _tmp7_;
				NodeSide _tmp8_;
				_tmp5_ = node_get_last_selected_child (node);
				_tmp6_ = _tmp5_;
				_tmp7_ = node_get_side (_tmp6_);
				_tmp8_ = _tmp7_;
				_tmp2_ = _tmp8_ == NODE_SIDE_RIGHT;
			} else {
				_tmp2_ = FALSE;
			}
			if (_tmp2_) {
				Node* _tmp9_;
				Node* _tmp10_;
				Node* _tmp11_;
				_tmp9_ = node_get_last_selected_child (node);
				_tmp10_ = _tmp9_;
				_tmp11_ = _g_object_ref0 (_tmp10_);
				result = _tmp11_;
				return result;
			}
			_tmp12_ = NODE_SIDE_RIGHT;
			_tmp13_ = node_first_child (node, &_tmp12_);
			result = _tmp13_;
			return result;
		} else {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp14_ = FALSE;
					_tmp14_ = TRUE;
					while (TRUE) {
						GArray* _tmp16_;
						GArray* _tmp17_;
						Node* _tmp18_;
						if (!_tmp14_) {
							gint _tmp15_;
							_tmp15_ = i;
							i = _tmp15_ + 1;
						}
						_tmp14_ = FALSE;
						_tmp16_ = self->priv->_nodes;
						if (!(((guint) i) < _tmp16_->len)) {
							break;
						}
						_tmp17_ = self->priv->_nodes;
						_tmp18_ = g_array_index (_tmp17_, Node*, (guint) i);
						if (_tmp18_ == node) {
							Node* _tmp19_ = NULL;
							GArray* _tmp20_;
							Node* _tmp23_;
							_tmp20_ = self->priv->_nodes;
							if (((guint) (i + 1)) < _tmp20_->len) {
								GArray* _tmp21_;
								Node* _tmp22_;
								_tmp21_ = self->priv->_nodes;
								_tmp22_ = g_array_index (_tmp21_, Node*, (guint) (i + 1));
								_tmp19_ = _tmp22_;
							} else {
								_tmp19_ = NULL;
							}
							_tmp23_ = _g_object_ref0 (_tmp19_);
							result = _tmp23_;
							return result;
						}
					}
				}
			}
		}
		result = NULL;
		return result;
	} else {
		NodeSide _tmp24_;
		NodeSide _tmp25_;
		_tmp24_ = node_get_side (node);
		_tmp25_ = _tmp24_;
		switch (_tmp25_) {
			case NODE_SIDE_TOP:
			case NODE_SIDE_BOTTOM:
			{
				Node* _tmp26_ = NULL;
				Node* _tmp30_;
				if (node_is_summary (node)) {
					_g_object_unref0 (_tmp26_);
					_tmp26_ = NULL;
				} else {
					Node* _tmp27_;
					Node* _tmp28_;
					Node* _tmp29_;
					_tmp27_ = node_get_parent (node);
					_tmp28_ = _tmp27_;
					_tmp29_ = node_next_child (_tmp28_, node, FALSE);
					_g_object_unref0 (_tmp26_);
					_tmp26_ = _tmp29_;
				}
				_tmp30_ = _tmp26_;
				_tmp26_ = NULL;
				result = _tmp30_;
				_g_object_unref0 (_tmp26_);
				return result;
			}
			case NODE_SIDE_LEFT:
			{
				Node* _tmp31_;
				_tmp31_ = map_model_get_select_parent (self, node);
				result = _tmp31_;
				return result;
			}
			default:
			{
				Node* _tmp32_ = NULL;
				Node* _tmp33_;
				Node* _tmp34_;
				Node* _tmp35_;
				Node* _tmp38_;
				_tmp33_ = node_get_last_selected_child (node);
				_tmp34_ = _tmp33_;
				_tmp35_ = _g_object_ref0 (_tmp34_);
				_tmp32_ = _tmp35_;
				if (_tmp32_ == NULL) {
					NodeSide _tmp36_;
					Node* _tmp37_;
					_tmp36_ = NODE_SIDE_RIGHT;
					_tmp37_ = node_first_child (node, &_tmp36_);
					_g_object_unref0 (_tmp32_);
					_tmp32_ = _tmp37_;
				}
				_tmp38_ = _tmp32_;
				_tmp32_ = NULL;
				result = _tmp38_;
				_g_object_unref0 (_tmp32_);
				return result;
			}
		}
	}
}

Node*
map_model_get_node_left (MapModel* self,
                         Node* node)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	if (node_is_root (node)) {
		NodeSide _tmp0_;
		NodeSide _tmp1_;
		_tmp0_ = node_get_side (node);
		_tmp1_ = _tmp0_;
		if (node_side_horizontal (_tmp1_)) {
			gboolean _tmp2_ = FALSE;
			Node* _tmp3_;
			Node* _tmp4_;
			NodeSide _tmp12_;
			Node* _tmp13_;
			_tmp3_ = node_get_last_selected_child (node);
			_tmp4_ = _tmp3_;
			if (_tmp4_ != NULL) {
				Node* _tmp5_;
				Node* _tmp6_;
				NodeSide _tmp7_;
				NodeSide _tmp8_;
				_tmp5_ = node_get_last_selected_child (node);
				_tmp6_ = _tmp5_;
				_tmp7_ = node_get_side (_tmp6_);
				_tmp8_ = _tmp7_;
				_tmp2_ = _tmp8_ == NODE_SIDE_LEFT;
			} else {
				_tmp2_ = FALSE;
			}
			if (_tmp2_) {
				Node* _tmp9_;
				Node* _tmp10_;
				Node* _tmp11_;
				_tmp9_ = node_get_last_selected_child (node);
				_tmp10_ = _tmp9_;
				_tmp11_ = _g_object_ref0 (_tmp10_);
				result = _tmp11_;
				return result;
			}
			_tmp12_ = NODE_SIDE_LEFT;
			_tmp13_ = node_first_child (node, &_tmp12_);
			result = _tmp13_;
			return result;
		} else {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp14_ = FALSE;
					_tmp14_ = TRUE;
					while (TRUE) {
						GArray* _tmp16_;
						GArray* _tmp17_;
						Node* _tmp18_;
						if (!_tmp14_) {
							gint _tmp15_;
							_tmp15_ = i;
							i = _tmp15_ + 1;
						}
						_tmp14_ = FALSE;
						_tmp16_ = self->priv->_nodes;
						if (!(((guint) i) < _tmp16_->len)) {
							break;
						}
						_tmp17_ = self->priv->_nodes;
						_tmp18_ = g_array_index (_tmp17_, Node*, (guint) i);
						if (_tmp18_ == node) {
							Node* _tmp19_ = NULL;
							Node* _tmp22_;
							if (i > 0) {
								GArray* _tmp20_;
								Node* _tmp21_;
								_tmp20_ = self->priv->_nodes;
								_tmp21_ = g_array_index (_tmp20_, Node*, (guint) (i - 1));
								_tmp19_ = _tmp21_;
							} else {
								_tmp19_ = NULL;
							}
							_tmp22_ = _g_object_ref0 (_tmp19_);
							result = _tmp22_;
							return result;
						}
					}
				}
			}
		}
		result = NULL;
		return result;
	} else {
		NodeSide _tmp23_;
		NodeSide _tmp24_;
		_tmp23_ = node_get_side (node);
		_tmp24_ = _tmp23_;
		switch (_tmp24_) {
			case NODE_SIDE_TOP:
			case NODE_SIDE_BOTTOM:
			{
				Node* _tmp25_ = NULL;
				Node* _tmp29_;
				if (node_is_summary (node)) {
					_g_object_unref0 (_tmp25_);
					_tmp25_ = NULL;
				} else {
					Node* _tmp26_;
					Node* _tmp27_;
					Node* _tmp28_;
					_tmp26_ = node_get_parent (node);
					_tmp27_ = _tmp26_;
					_tmp28_ = node_prev_child (_tmp27_, node, FALSE);
					_g_object_unref0 (_tmp25_);
					_tmp25_ = _tmp28_;
				}
				_tmp29_ = _tmp25_;
				_tmp25_ = NULL;
				result = _tmp29_;
				_g_object_unref0 (_tmp25_);
				return result;
			}
			case NODE_SIDE_LEFT:
			{
				Node* _tmp30_ = NULL;
				Node* _tmp31_;
				Node* _tmp32_;
				Node* _tmp33_;
				Node* _tmp36_;
				_tmp31_ = node_get_last_selected_child (node);
				_tmp32_ = _tmp31_;
				_tmp33_ = _g_object_ref0 (_tmp32_);
				_tmp30_ = _tmp33_;
				if (_tmp30_ == NULL) {
					NodeSide _tmp34_;
					Node* _tmp35_;
					_tmp34_ = NODE_SIDE_LEFT;
					_tmp35_ = node_first_child (node, &_tmp34_);
					_g_object_unref0 (_tmp30_);
					_tmp30_ = _tmp35_;
				}
				_tmp36_ = _tmp30_;
				_tmp30_ = NULL;
				result = _tmp36_;
				_g_object_unref0 (_tmp30_);
				return result;
			}
			default:
			{
				Node* _tmp37_;
				_tmp37_ = map_model_get_select_parent (self, node);
				result = _tmp37_;
				return result;
			}
		}
	}
}

Node*
map_model_get_node_up (MapModel* self,
                       Node* node)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	if (node_is_root (node)) {
		NodeSide _tmp0_;
		NodeSide _tmp1_;
		_tmp0_ = node_get_side (node);
		_tmp1_ = _tmp0_;
		if (node_side_vertical (_tmp1_)) {
			gboolean _tmp2_ = FALSE;
			Node* _tmp3_;
			Node* _tmp4_;
			NodeSide _tmp12_;
			Node* _tmp13_;
			_tmp3_ = node_get_last_selected_child (node);
			_tmp4_ = _tmp3_;
			if (_tmp4_ != NULL) {
				Node* _tmp5_;
				Node* _tmp6_;
				NodeSide _tmp7_;
				NodeSide _tmp8_;
				_tmp5_ = node_get_last_selected_child (node);
				_tmp6_ = _tmp5_;
				_tmp7_ = node_get_side (_tmp6_);
				_tmp8_ = _tmp7_;
				_tmp2_ = _tmp8_ == NODE_SIDE_TOP;
			} else {
				_tmp2_ = FALSE;
			}
			if (_tmp2_) {
				Node* _tmp9_;
				Node* _tmp10_;
				Node* _tmp11_;
				_tmp9_ = node_get_last_selected_child (node);
				_tmp10_ = _tmp9_;
				_tmp11_ = _g_object_ref0 (_tmp10_);
				result = _tmp11_;
				return result;
			}
			_tmp12_ = NODE_SIDE_TOP;
			_tmp13_ = node_first_child (node, &_tmp12_);
			result = _tmp13_;
			return result;
		} else {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp14_ = FALSE;
					_tmp14_ = TRUE;
					while (TRUE) {
						GArray* _tmp16_;
						GArray* _tmp17_;
						Node* _tmp18_;
						if (!_tmp14_) {
							gint _tmp15_;
							_tmp15_ = i;
							i = _tmp15_ + 1;
						}
						_tmp14_ = FALSE;
						_tmp16_ = self->priv->_nodes;
						if (!(((guint) i) < _tmp16_->len)) {
							break;
						}
						_tmp17_ = self->priv->_nodes;
						_tmp18_ = g_array_index (_tmp17_, Node*, (guint) i);
						if (_tmp18_ == node) {
							Node* _tmp19_ = NULL;
							Node* _tmp22_;
							if (i > 0) {
								GArray* _tmp20_;
								Node* _tmp21_;
								_tmp20_ = self->priv->_nodes;
								_tmp21_ = g_array_index (_tmp20_, Node*, (guint) (i - 1));
								_tmp19_ = _tmp21_;
							} else {
								_tmp19_ = NULL;
							}
							_tmp22_ = _g_object_ref0 (_tmp19_);
							result = _tmp22_;
							return result;
						}
					}
				}
			}
		}
		result = NULL;
		return result;
	} else {
		NodeSide _tmp23_;
		NodeSide _tmp24_;
		_tmp23_ = node_get_side (node);
		_tmp24_ = _tmp23_;
		switch (_tmp24_) {
			case NODE_SIDE_TOP:
			{
				Node* _tmp25_ = NULL;
				Node* _tmp26_;
				Node* _tmp27_;
				Node* _tmp28_;
				Node* _tmp31_;
				_tmp26_ = node_get_last_selected_child (node);
				_tmp27_ = _tmp26_;
				_tmp28_ = _g_object_ref0 (_tmp27_);
				_tmp25_ = _tmp28_;
				if (_tmp25_ == NULL) {
					NodeSide _tmp29_;
					Node* _tmp30_;
					_tmp29_ = NODE_SIDE_TOP;
					_tmp30_ = node_first_child (node, &_tmp29_);
					_g_object_unref0 (_tmp25_);
					_tmp25_ = _tmp30_;
				}
				_tmp31_ = _tmp25_;
				_tmp25_ = NULL;
				result = _tmp31_;
				_g_object_unref0 (_tmp25_);
				return result;
			}
			case NODE_SIDE_BOTTOM:
			{
				Node* _tmp32_;
				_tmp32_ = map_model_get_select_parent (self, node);
				result = _tmp32_;
				return result;
			}
			default:
			{
				Node* _tmp33_ = NULL;
				Node* _tmp37_;
				if (node_is_summary (node)) {
					_g_object_unref0 (_tmp33_);
					_tmp33_ = NULL;
				} else {
					Node* _tmp34_;
					Node* _tmp35_;
					Node* _tmp36_;
					_tmp34_ = node_get_parent (node);
					_tmp35_ = _tmp34_;
					_tmp36_ = node_prev_child (_tmp35_, node, FALSE);
					_g_object_unref0 (_tmp33_);
					_tmp33_ = _tmp36_;
				}
				_tmp37_ = _tmp33_;
				_tmp33_ = NULL;
				result = _tmp37_;
				_g_object_unref0 (_tmp33_);
				return result;
			}
		}
	}
}

Node*
map_model_get_node_down (MapModel* self,
                         Node* node)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	if (node_is_root (node)) {
		NodeSide _tmp0_;
		NodeSide _tmp1_;
		_tmp0_ = node_get_side (node);
		_tmp1_ = _tmp0_;
		if (node_side_vertical (_tmp1_)) {
			gboolean _tmp2_ = FALSE;
			Node* _tmp3_;
			Node* _tmp4_;
			NodeSide _tmp12_;
			Node* _tmp13_;
			_tmp3_ = node_get_last_selected_child (node);
			_tmp4_ = _tmp3_;
			if (_tmp4_ != NULL) {
				Node* _tmp5_;
				Node* _tmp6_;
				NodeSide _tmp7_;
				NodeSide _tmp8_;
				_tmp5_ = node_get_last_selected_child (node);
				_tmp6_ = _tmp5_;
				_tmp7_ = node_get_side (_tmp6_);
				_tmp8_ = _tmp7_;
				_tmp2_ = _tmp8_ == NODE_SIDE_BOTTOM;
			} else {
				_tmp2_ = FALSE;
			}
			if (_tmp2_) {
				Node* _tmp9_;
				Node* _tmp10_;
				Node* _tmp11_;
				_tmp9_ = node_get_last_selected_child (node);
				_tmp10_ = _tmp9_;
				_tmp11_ = _g_object_ref0 (_tmp10_);
				result = _tmp11_;
				return result;
			}
			_tmp12_ = NODE_SIDE_BOTTOM;
			_tmp13_ = node_first_child (node, &_tmp12_);
			result = _tmp13_;
			return result;
		} else {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp14_ = FALSE;
					_tmp14_ = TRUE;
					while (TRUE) {
						GArray* _tmp16_;
						GArray* _tmp17_;
						Node* _tmp18_;
						if (!_tmp14_) {
							gint _tmp15_;
							_tmp15_ = i;
							i = _tmp15_ + 1;
						}
						_tmp14_ = FALSE;
						_tmp16_ = self->priv->_nodes;
						if (!(((guint) i) < _tmp16_->len)) {
							break;
						}
						_tmp17_ = self->priv->_nodes;
						_tmp18_ = g_array_index (_tmp17_, Node*, (guint) i);
						if (_tmp18_ == node) {
							Node* _tmp19_ = NULL;
							GArray* _tmp20_;
							Node* _tmp23_;
							_tmp20_ = self->priv->_nodes;
							if (((guint) (i + 1)) < _tmp20_->len) {
								GArray* _tmp21_;
								Node* _tmp22_;
								_tmp21_ = self->priv->_nodes;
								_tmp22_ = g_array_index (_tmp21_, Node*, (guint) (i + 1));
								_tmp19_ = _tmp22_;
							} else {
								_tmp19_ = NULL;
							}
							_tmp23_ = _g_object_ref0 (_tmp19_);
							result = _tmp23_;
							return result;
						}
					}
				}
			}
		}
		result = NULL;
		return result;
	} else {
		NodeSide _tmp24_;
		NodeSide _tmp25_;
		_tmp24_ = node_get_side (node);
		_tmp25_ = _tmp24_;
		switch (_tmp25_) {
			case NODE_SIDE_TOP:
			{
				Node* _tmp26_;
				_tmp26_ = map_model_get_select_parent (self, node);
				result = _tmp26_;
				return result;
			}
			case NODE_SIDE_BOTTOM:
			{
				Node* _tmp27_ = NULL;
				Node* _tmp28_;
				Node* _tmp29_;
				Node* _tmp30_;
				Node* _tmp33_;
				_tmp28_ = node_get_last_selected_child (node);
				_tmp29_ = _tmp28_;
				_tmp30_ = _g_object_ref0 (_tmp29_);
				_tmp27_ = _tmp30_;
				if (_tmp27_ == NULL) {
					NodeSide _tmp31_;
					Node* _tmp32_;
					_tmp31_ = NODE_SIDE_BOTTOM;
					_tmp32_ = node_first_child (node, &_tmp31_);
					_g_object_unref0 (_tmp27_);
					_tmp27_ = _tmp32_;
				}
				_tmp33_ = _tmp27_;
				_tmp27_ = NULL;
				result = _tmp33_;
				_g_object_unref0 (_tmp27_);
				return result;
			}
			default:
			{
				Node* _tmp34_ = NULL;
				Node* _tmp38_;
				if (node_is_summary (node)) {
					_g_object_unref0 (_tmp34_);
					_tmp34_ = NULL;
				} else {
					Node* _tmp35_;
					Node* _tmp36_;
					Node* _tmp37_;
					_tmp35_ = node_get_parent (node);
					_tmp36_ = _tmp35_;
					_tmp37_ = node_next_child (_tmp36_, node, FALSE);
					_g_object_unref0 (_tmp34_);
					_tmp34_ = _tmp37_;
				}
				_tmp38_ = _tmp34_;
				_tmp34_ = NULL;
				result = _tmp38_;
				_g_object_unref0 (_tmp34_);
				return result;
			}
		}
	}
}

Node*
map_model_get_node_pageup (MapModel* self,
                           Node* node)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	if (node_is_root (node)) {
		Node* _tmp0_ = NULL;
		GArray* _tmp1_;
		Node* _tmp4_;
		_tmp1_ = self->priv->_nodes;
		if (_tmp1_->len > ((guint) 0)) {
			GArray* _tmp2_;
			Node* _tmp3_;
			_tmp2_ = self->priv->_nodes;
			_tmp3_ = g_array_index (_tmp2_, Node*, (guint) 0);
			_tmp0_ = _tmp3_;
		} else {
			_tmp0_ = NULL;
		}
		_tmp4_ = _g_object_ref0 (_tmp0_);
		result = _tmp4_;
		return result;
	} else {
		Node* _tmp5_ = NULL;
		Node* _tmp9_;
		if (node_is_summary (node)) {
			_g_object_unref0 (_tmp5_);
			_tmp5_ = NULL;
		} else {
			Node* _tmp6_;
			Node* _tmp7_;
			Node* _tmp8_;
			_tmp6_ = node_get_parent (node);
			_tmp7_ = _tmp6_;
			_tmp8_ = node_first_child (_tmp7_, NULL);
			_g_object_unref0 (_tmp5_);
			_tmp5_ = _tmp8_;
		}
		_tmp9_ = _tmp5_;
		_tmp5_ = NULL;
		result = _tmp9_;
		_g_object_unref0 (_tmp5_);
		return result;
	}
}

Node*
map_model_get_node_pagedn (MapModel* self,
                           Node* node)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (node != NULL, NULL);
	if (node_is_root (node)) {
		Node* _tmp0_ = NULL;
		GArray* _tmp1_;
		Node* _tmp5_;
		_tmp1_ = self->priv->_nodes;
		if (_tmp1_->len > ((guint) 0)) {
			GArray* _tmp2_;
			GArray* _tmp3_;
			Node* _tmp4_;
			_tmp2_ = self->priv->_nodes;
			_tmp3_ = self->priv->_nodes;
			_tmp4_ = g_array_index (_tmp2_, Node*, _tmp3_->len - 1);
			_tmp0_ = _tmp4_;
		} else {
			_tmp0_ = NULL;
		}
		_tmp5_ = _g_object_ref0 (_tmp0_);
		result = _tmp5_;
		return result;
	} else {
		Node* _tmp6_ = NULL;
		Node* _tmp10_;
		if (node_is_summary (node)) {
			_g_object_unref0 (_tmp6_);
			_tmp6_ = NULL;
		} else {
			Node* _tmp7_;
			Node* _tmp8_;
			Node* _tmp9_;
			_tmp7_ = node_get_parent (node);
			_tmp8_ = _tmp7_;
			_tmp9_ = node_last_child (_tmp8_, NULL);
			_g_object_unref0 (_tmp6_);
			_tmp6_ = _tmp9_;
		}
		_tmp10_ = _tmp6_;
		_tmp6_ = NULL;
		result = _tmp10_;
		_g_object_unref0 (_tmp6_);
		return result;
	}
}

gboolean
map_model_node_copyable (MapModel* self)
{
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	gboolean _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_object_unref0 (_tmp4_);
	result = _tmp5_;
	return result;
}

gboolean
map_model_node_cuttable (MapModel* self)
{
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	gboolean _tmp5_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_object_unref0 (_tmp4_);
	result = _tmp5_;
	return result;
}

gboolean
map_model_node_pasteable (MapModel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = minder_clipboard_node_pasteable ();
	return result;
}

gboolean
map_model_nodes_alignable (MapModel* self)
{
	GArray* nodes = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_nodes (_tmp2_);
	nodes = _tmp3_;
	_tmp4_ = nodes;
	if (_tmp4_->len < ((guint) 2)) {
		result = FALSE;
		_g_array_unref0 (nodes);
		return result;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				GArray* _tmp7_;
				Node* node = NULL;
				GArray* _tmp8_;
				Node* _tmp9_;
				Node* _tmp10_;
				gboolean _tmp11_ = FALSE;
				Node* _tmp12_;
				if (!_tmp5_) {
					gint _tmp6_;
					_tmp6_ = i;
					i = _tmp6_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp7_ = nodes;
				if (!(((guint) i) < _tmp7_->len)) {
					break;
				}
				_tmp8_ = nodes;
				_tmp9_ = g_array_index (_tmp8_, Node*, (guint) i);
				_tmp10_ = _g_object_ref0 (_tmp9_);
				node = _tmp10_;
				_tmp12_ = node;
				if (!node_is_root (_tmp12_)) {
					Node* _tmp13_;
					Layout* _tmp14_;
					Layout* _tmp15_;
					const gchar* _tmp16_;
					const gchar* _tmp17_;
					_tmp13_ = node;
					_tmp14_ = node_get_layout (_tmp13_);
					_tmp15_ = _tmp14_;
					_tmp16_ = layout_get_name (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp11_ = g_strcmp0 (_tmp17_, _ ("Manual")) != 0;
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					result = FALSE;
					_g_object_unref0 (node);
					_g_array_unref0 (nodes);
					return result;
				}
				_g_object_unref0 (node);
			}
		}
	}
	result = TRUE;
	_g_array_unref0 (nodes);
	return result;
}

gchar*
map_model_serialize_for_copy (MapModel* self,
                              GArray* nodes,
                              Connections* conns,
                              NodeGroups* groups)
{
	gchar* str = NULL;
	NodeLinks* nodelinks = NULL;
	NodeLinks* _tmp0_;
	xmlDoc* doc = NULL;
	xmlDoc* _tmp1_;
	xmlNode* root = NULL;
	xmlNode* _tmp2_;
	xmlDoc* _tmp3_;
	xmlNode* _tmp4_;
	xmlNode* ns = NULL;
	xmlNode* _tmp5_;
	xmlNode* _tmp13_;
	xmlNode* _tmp14_;
	xmlNode* cs = NULL;
	xmlNode* _tmp15_;
	xmlNode* gs = NULL;
	xmlNode* _tmp16_;
	xmlNode* _tmp25_;
	xmlNode* _tmp26_;
	xmlNode* _tmp27_;
	xmlNode* _tmp28_;
	NodeLinks* _tmp34_;
	xmlDoc* _tmp38_;
	gchar* _tmp39_ = NULL;
	xmlDoc* _tmp40_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (nodes != NULL, NULL);
	g_return_val_if_fail (conns != NULL, NULL);
	g_return_val_if_fail (groups != NULL, NULL);
	_tmp0_ = node_links_new ();
	nodelinks = _tmp0_;
	_tmp1_ = xmlNewDoc ((xmlChar*) "1.0");
	doc = _tmp1_;
	_tmp2_ = xmlNewNode (NULL, (xmlChar*) "minder");
	root = _tmp2_;
	_tmp3_ = doc;
	_tmp4_ = root;
	xmlDocSetRootElement (_tmp3_, _tmp4_);
	_tmp5_ = xmlNewNode (NULL, (xmlChar*) "nodes");
	ns = _tmp5_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp6_ = FALSE;
			_tmp6_ = TRUE;
			while (TRUE) {
				Node* _tmp8_;
				xmlNode* _tmp9_;
				NodeLinks* _tmp10_;
				Node* _tmp11_;
				NodeLinks* _tmp12_;
				if (!_tmp6_) {
					gint _tmp7_;
					_tmp7_ = i;
					i = _tmp7_ + 1;
				}
				_tmp6_ = FALSE;
				if (!(((guint) i) < nodes->len)) {
					break;
				}
				_tmp8_ = g_array_index (nodes, Node*, (guint) i);
				_tmp9_ = ns;
				node_save (_tmp8_, _tmp9_);
				_tmp10_ = nodelinks;
				_tmp11_ = g_array_index (nodes, Node*, (guint) i);
				_tmp12_ = self->priv->_node_links;
				node_links_get_links_from_node (_tmp10_, _tmp11_, _tmp12_);
			}
		}
	}
	_tmp13_ = root;
	_tmp14_ = ns;
	xmlAddChild (_tmp13_, _tmp14_);
	_tmp15_ = xmlNewNode (NULL, (xmlChar*) "connections");
	cs = _tmp15_;
	_tmp16_ = xmlNewNode (NULL, (xmlChar*) "groups");
	gs = _tmp16_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp17_ = FALSE;
			_tmp17_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp19_;
				Node* _tmp20_;
				NodeLinks* _tmp21_;
				NodeLinks* _tmp22_;
				xmlNode* _tmp23_;
				Node* _tmp24_;
				if (!_tmp17_) {
					gint _tmp18_;
					_tmp18_ = i;
					i = _tmp18_ + 1;
				}
				_tmp17_ = FALSE;
				if (!(((guint) i) < nodes->len)) {
					break;
				}
				_tmp19_ = cs;
				_tmp20_ = g_array_index (nodes, Node*, (guint) i);
				_tmp21_ = nodelinks;
				_tmp22_ = self->priv->_node_links;
				connections_save_if_in_node (conns, _tmp19_, _tmp20_, _tmp21_, _tmp22_);
				_tmp23_ = gs;
				_tmp24_ = g_array_index (nodes, Node*, (guint) i);
				node_groups_save_if_in_node (groups, _tmp23_, _tmp24_);
			}
		}
	}
	_tmp25_ = root;
	_tmp26_ = cs;
	xmlAddChild (_tmp25_, _tmp26_);
	_tmp27_ = root;
	_tmp28_ = gs;
	xmlAddChild (_tmp27_, _tmp28_);
	if (nodes->len > ((guint) 0)) {
		NodeLink* link = NULL;
		Node* _tmp29_;
		NodeLink* _tmp30_;
		xmlNode* _tmp31_;
		NodeLink* _tmp32_;
		xmlNode* _tmp33_;
		_tmp29_ = g_array_index (nodes, Node*, (guint) 0);
		_tmp30_ = node_link_new (_tmp29_);
		link = _tmp30_;
		_tmp31_ = root;
		_tmp32_ = link;
		_tmp33_ = node_link_save (_tmp32_);
		xmlAddChild (_tmp31_, _tmp33_);
		_node_link_unref0 (link);
	}
	_tmp34_ = nodelinks;
	if (node_links_num_links (_tmp34_) > 0) {
		xmlNode* _tmp35_;
		NodeLinks* _tmp36_;
		xmlNode* _tmp37_;
		_tmp35_ = root;
		_tmp36_ = nodelinks;
		_tmp37_ = node_links_save (_tmp36_);
		xmlAddChild (_tmp35_, _tmp37_);
	}
	_tmp38_ = doc;
	xmlDocDumpFormatMemory (_tmp38_, (xmlChar*) (&_tmp39_), NULL, TRUE);
	_g_free0 (str);
	str = _tmp39_;
	_tmp40_ = doc;
	_xmlFreeDoc0 (_tmp40_);
	result = str;
	_node_links_unref0 (nodelinks);
	return result;
}

void
map_model_deserialize_for_paste (MapModel* self,
                                 const gchar* str,
                                 GArray* nodes,
                                 GArray* conns,
                                 GArray* groups)
{
	xmlDoc* doc = NULL;
	xmlDoc* _tmp0_;
	xmlDoc* _tmp1_;
	xmlDoc* _tmp52_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (str != NULL);
	g_return_if_fail (nodes != NULL);
	g_return_if_fail (conns != NULL);
	g_return_if_fail (groups != NULL);
	_tmp0_ = xmlParseDoc ((xmlChar*) str);
	doc = _tmp0_;
	_tmp1_ = doc;
	if (_tmp1_ == NULL) {
		return;
	}
	{
		xmlNode* it = NULL;
		xmlDoc* _tmp2_;
		xmlNode* _tmp3_;
		xmlNode* _tmp4_;
		_tmp2_ = doc;
		_tmp3_ = xmlDocGetRootElement (_tmp2_);
		_tmp4_ = _tmp3_->children;
		it = _tmp4_;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp8_;
				xmlNode* _tmp9_;
				if (!_tmp5_) {
					xmlNode* _tmp6_;
					xmlNode* _tmp7_;
					_tmp6_ = it;
					_tmp7_ = _tmp6_->next;
					it = _tmp7_;
				}
				_tmp5_ = FALSE;
				_tmp8_ = it;
				if (!(_tmp8_ != NULL)) {
					break;
				}
				_tmp9_ = it;
				if (_tmp9_->type == XML_ELEMENT_NODE) {
					xmlNode* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					GQuark _tmp14_ = 0U;
					static GQuark _tmp13_label0 = 0;
					static GQuark _tmp13_label1 = 0;
					static GQuark _tmp13_label2 = 0;
					static GQuark _tmp13_label3 = 0;
					_tmp10_ = it;
					_tmp11_ = _tmp10_->name;
					_tmp12_ = _tmp11_;
					_tmp14_ = (NULL == _tmp12_) ? 0 : g_quark_from_string (_tmp12_);
					if (_tmp14_ == ((0 != _tmp13_label0) ? _tmp13_label0 : (_tmp13_label0 = g_quark_from_static_string ("connections")))) {
						switch (0) {
							default:
							{
								Connections* _tmp15_;
								MindMap* _tmp16_;
								xmlNode* _tmp17_;
								_tmp15_ = self->priv->_connections;
								_tmp16_ = self->priv->_map;
								_tmp17_ = it;
								connections_load (_tmp15_, _tmp16_, _tmp17_, conns, nodes);
								break;
							}
						}
					} else if (_tmp14_ == ((0 != _tmp13_label1) ? _tmp13_label1 : (_tmp13_label1 = g_quark_from_static_string ("groups")))) {
						switch (0) {
							default:
							{
								NodeGroups* _tmp18_;
								MindMap* _tmp19_;
								xmlNode* _tmp20_;
								_tmp18_ = self->priv->_groups;
								_tmp19_ = self->priv->_map;
								_tmp20_ = it;
								node_groups_load (_tmp18_, _tmp19_, _tmp20_, groups, nodes);
								break;
							}
						}
					} else if (_tmp14_ == ((0 != _tmp13_label2) ? _tmp13_label2 : (_tmp13_label2 = g_quark_from_static_string ("nodes")))) {
						switch (0) {
							default:
							{
								{
									xmlNode* it2 = NULL;
									xmlNode* _tmp21_;
									xmlNode* _tmp22_;
									_tmp21_ = it;
									_tmp22_ = _tmp21_->children;
									it2 = _tmp22_;
									{
										gboolean _tmp23_ = FALSE;
										_tmp23_ = TRUE;
										while (TRUE) {
											xmlNode* _tmp26_;
											gboolean _tmp27_ = FALSE;
											xmlNode* _tmp28_;
											if (!_tmp23_) {
												xmlNode* _tmp24_;
												xmlNode* _tmp25_;
												_tmp24_ = it2;
												_tmp25_ = _tmp24_->next;
												it2 = _tmp25_;
											}
											_tmp23_ = FALSE;
											_tmp26_ = it2;
											if (!(_tmp26_ != NULL)) {
												break;
											}
											_tmp28_ = it2;
											if (_tmp28_->type == XML_ELEMENT_NODE) {
												xmlNode* _tmp29_;
												const gchar* _tmp30_;
												_tmp29_ = it2;
												_tmp30_ = _tmp29_->name;
												_tmp27_ = g_strcmp0 (_tmp30_, "node") == 0;
											} else {
												_tmp27_ = FALSE;
											}
											if (_tmp27_) {
												GArray* siblings = NULL;
												GArray* _tmp31_;
												Node* node = NULL;
												MindMap* _tmp32_;
												xmlNode* _tmp33_;
												Node* _tmp34_;
												Node* _tmp35_;
												Node* _tmp36_;
												_tmp31_ = g_array_new (TRUE, TRUE, sizeof (Node*));
												g_array_set_clear_func (_tmp31_, (GDestroyNotify) _vala_Node_free_function_content_of);
												siblings = _tmp31_;
												_tmp32_ = self->priv->_map;
												_tmp33_ = it2;
												_tmp34_ = node_new_from_xml (_tmp32_, NULL, _tmp33_, TRUE, NULL, &siblings);
												node = _tmp34_;
												_tmp35_ = node;
												_tmp36_ = _g_object_ref0 (_tmp35_);
												g_array_append_val (nodes, _tmp36_);
												_g_object_unref0 (node);
												_g_array_unref0 (siblings);
											}
										}
									}
								}
								break;
							}
						}
					} else if (_tmp14_ == ((0 != _tmp13_label3) ? _tmp13_label3 : (_tmp13_label3 = g_quark_from_static_string ("nodelinks")))) {
						switch (0) {
							default:
							{
								NodeLinks* nodelinks = NULL;
								NodeLinks* _tmp37_;
								NodeLinks* _tmp38_;
								xmlNode* _tmp39_;
								_tmp37_ = node_links_new ();
								nodelinks = _tmp37_;
								_tmp38_ = nodelinks;
								_tmp39_ = it;
								node_links_load (_tmp38_, _tmp39_);
								{
									gint i = 0;
									i = 0;
									{
										gboolean _tmp40_ = FALSE;
										_tmp40_ = TRUE;
										while (TRUE) {
											NodeLinks* _tmp42_;
											Node* _tmp43_;
											NodeLinks* _tmp44_;
											Connections* _tmp45_;
											Node* _tmp46_;
											NodeLinks* _tmp47_;
											NodeLinks* _tmp48_;
											if (!_tmp40_) {
												gint _tmp41_;
												_tmp41_ = i;
												i = _tmp41_ + 1;
											}
											_tmp40_ = FALSE;
											if (!(((guint) i) < nodes->len)) {
												break;
											}
											_tmp42_ = nodelinks;
											_tmp43_ = g_array_index (nodes, Node*, (guint) i);
											_tmp44_ = self->priv->_node_links;
											node_links_set_links_in_node (_tmp42_, _tmp43_, _tmp44_);
											_tmp45_ = self->priv->_connections;
											_tmp46_ = g_array_index (nodes, Node*, (guint) i);
											_tmp47_ = nodelinks;
											_tmp48_ = self->priv->_node_links;
											connections_set_links_in_notes (_tmp45_, _tmp46_, _tmp47_, _tmp48_);
										}
									}
								}
								_node_links_unref0 (nodelinks);
								break;
							}
						}
					}
				}
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp49_ = FALSE;
			_tmp49_ = TRUE;
			while (TRUE) {
				Node* _tmp51_;
				if (!_tmp49_) {
					gint _tmp50_;
					_tmp50_ = i;
					i = _tmp50_ + 1;
				}
				_tmp49_ = FALSE;
				if (!(((guint) i) < nodes->len)) {
					break;
				}
				_tmp51_ = g_array_index (nodes, Node*, (guint) i);
				node_reassign_ids (_tmp51_);
			}
		}
	}
	_tmp52_ = doc;
	_xmlFreeDoc0 (_tmp52_);
}

NodeLink*
map_model_deserialize_for_node_link (const gchar* str)
{
	xmlDoc* doc = NULL;
	xmlDoc* _tmp0_;
	xmlDoc* _tmp1_;
	xmlDoc* _tmp16_;
	NodeLink* result;
	g_return_val_if_fail (str != NULL, NULL);
	_tmp0_ = xmlParseDoc ((xmlChar*) str);
	doc = _tmp0_;
	_tmp1_ = doc;
	if (_tmp1_ == NULL) {
		result = NULL;
		return result;
	}
	{
		xmlNode* it = NULL;
		xmlDoc* _tmp2_;
		xmlNode* _tmp3_;
		xmlNode* _tmp4_;
		_tmp2_ = doc;
		_tmp3_ = xmlDocGetRootElement (_tmp2_);
		_tmp4_ = _tmp3_->children;
		it = _tmp4_;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				xmlNode* _tmp8_;
				gboolean _tmp9_ = FALSE;
				xmlNode* _tmp10_;
				if (!_tmp5_) {
					xmlNode* _tmp6_;
					xmlNode* _tmp7_;
					_tmp6_ = it;
					_tmp7_ = _tmp6_->next;
					it = _tmp7_;
				}
				_tmp5_ = FALSE;
				_tmp8_ = it;
				if (!(_tmp8_ != NULL)) {
					break;
				}
				_tmp10_ = it;
				if (_tmp10_->type == XML_ELEMENT_NODE) {
					xmlNode* _tmp11_;
					const gchar* _tmp12_;
					_tmp11_ = it;
					_tmp12_ = _tmp11_->name;
					_tmp9_ = g_strcmp0 (_tmp12_, "nodelink") == 0;
				} else {
					_tmp9_ = FALSE;
				}
				if (_tmp9_) {
					NodeLink* link = NULL;
					xmlNode* _tmp13_;
					NodeLink* _tmp14_;
					xmlDoc* _tmp15_;
					_tmp13_ = it;
					_tmp14_ = node_link_new_from_xml (_tmp13_);
					link = _tmp14_;
					_tmp15_ = doc;
					_xmlFreeDoc0 (_tmp15_);
					result = link;
					return result;
				}
			}
		}
	}
	_tmp16_ = doc;
	_xmlFreeDoc0 (_tmp16_);
	result = NULL;
	return result;
}

static gpointer
_connections_ref0 (gpointer self)
{
	return self ? connections_ref (self) : NULL;
}

static gpointer
_node_groups_ref0 (gpointer self)
{
	return self ? node_groups_ref (self) : NULL;
}

void
map_model_get_nodes_for_clipboard (MapModel* self,
                                   GArray** nodes,
                                   Connections** conns,
                                   NodeGroups** groups)
{
	GArray* _vala_nodes = NULL;
	Connections* _vala_conns = NULL;
	NodeGroups* _vala_groups = NULL;
	GArray* _tmp0_;
	Connections* _tmp1_;
	Connections* _tmp2_;
	NodeGroups* _tmp3_;
	NodeGroups* _tmp4_;
	MindMap* _tmp5_;
	Selection* _tmp6_;
	Selection* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	_g_array_unref0 (_vala_nodes);
	_vala_nodes = _tmp0_;
	_tmp1_ = self->priv->_connections;
	_tmp2_ = _connections_ref0 (_tmp1_);
	_connections_unref0 (_vala_conns);
	_vala_conns = _tmp2_;
	_tmp3_ = self->priv->_groups;
	_tmp4_ = _node_groups_ref0 (_tmp3_);
	_node_groups_unref0 (_vala_groups);
	_vala_groups = _tmp4_;
	_tmp5_ = self->priv->_map;
	_tmp6_ = mind_map_get_selected (_tmp5_);
	_tmp7_ = _tmp6_;
	if (selection_num_nodes (_tmp7_) == 1) {
		GArray* _tmp8_;
		MindMap* _tmp9_;
		Node* _tmp10_;
		_tmp8_ = _vala_nodes;
		_tmp9_ = self->priv->_map;
		_tmp10_ = mind_map_get_current_node (_tmp9_);
		g_array_append_val (_tmp8_, _tmp10_);
	} else {
		MindMap* _tmp11_;
		Selection* _tmp12_;
		Selection* _tmp13_;
		ImageManager* _tmp14_;
		_tmp11_ = self->priv->_map;
		_tmp12_ = mind_map_get_selected (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = self->priv->_image_manager;
		selection_get_subtrees (_tmp13_, &_vala_nodes, _tmp14_);
	}
	if (nodes) {
		*nodes = _vala_nodes;
	} else {
		_g_array_unref0 (_vala_nodes);
	}
	if (conns) {
		*conns = _vala_conns;
	} else {
		_connections_unref0 (_vala_conns);
	}
	if (groups) {
		*groups = _vala_groups;
	} else {
		_node_groups_unref0 (_vala_groups);
	}
}

void
map_model_copy_selected_text (MapModel* self)
{
	CanvasText* text = NULL;
	MindMap* _tmp0_;
	CanvasText* _tmp1_;
	CanvasText* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_text (_tmp0_);
	text = _tmp1_;
	_tmp2_ = text;
	if (_tmp2_ != NULL) {
		CanvasText* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = text;
		_tmp4_ = canvas_text_get_selected_text (_tmp3_);
		_tmp5_ = _tmp4_;
		minder_clipboard_copy_text (_tmp5_);
		_g_free0 (_tmp5_);
	}
	_g_object_unref0 (text);
}

void
map_model_do_copy (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ != NULL) {
		Node* _tmp5_;
		NodeMode _tmp6_;
		NodeMode _tmp7_;
		_tmp5_ = current;
		_tmp6_ = node_get_mode (_tmp5_);
		_tmp7_ = _tmp6_;
		switch (_tmp7_) {
			case NODE_MODE_CURRENT:
			{
				MindMap* _tmp8_;
				_tmp8_ = self->priv->_map;
				minder_clipboard_copy_nodes (_tmp8_);
				break;
			}
			case NODE_MODE_EDITABLE:
			{
				map_model_copy_selected_text (self);
				break;
			}
			default:
			break;
		}
	} else {
		MindMap* _tmp9_;
		Selection* _tmp10_;
		Selection* _tmp11_;
		GArray* _tmp12_;
		GArray* _tmp13_;
		gboolean _tmp14_;
		_tmp9_ = self->priv->_map;
		_tmp10_ = mind_map_get_selected (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = selection_nodes (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = _tmp13_->len > ((guint) 1);
		_g_array_unref0 (_tmp13_);
		if (_tmp14_) {
			MindMap* _tmp15_;
			_tmp15_ = self->priv->_map;
			minder_clipboard_copy_nodes (_tmp15_);
		} else {
			gboolean _tmp16_ = FALSE;
			MindMap* _tmp17_;
			_tmp17_ = self->priv->_map;
			if (mind_map_is_connection_editable (_tmp17_)) {
				_tmp16_ = TRUE;
			} else {
				MindMap* _tmp18_;
				_tmp18_ = self->priv->_map;
				_tmp16_ = mind_map_is_callout_editable (_tmp18_);
			}
			if (_tmp16_) {
				map_model_copy_selected_text (self);
			}
		}
	}
	_g_object_unref0 (current);
}

void
map_model_cut_node_to_clipboard (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Node* _tmp1_;
	Node* _tmp2_;
	Node* next_node = NULL;
	MindMap* _tmp3_;
	Node* _tmp4_;
	GArray* conns = NULL;
	GArray* _tmp5_;
	UndoNodeGroups* undo_groups = NULL;
	MindMap* _tmp6_;
	Animator* _tmp7_;
	Animator* _tmp8_;
	GArray* _tmp9_;
	Connections* _tmp10_;
	Node* _tmp11_;
	GArray* _tmp12_;
	NodeGroups* _tmp13_;
	Node* _tmp14_;
	MindMap* _tmp15_;
	Node* _tmp16_;
	MindMap* _tmp40_;
	Selection* _tmp41_;
	Selection* _tmp42_;
	Node* _tmp43_;
	Node* _tmp44_;
	MindMap* _tmp51_;
	Node* _tmp52_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_node (_tmp0_);
	current = _tmp1_;
	_tmp2_ = current;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (current);
		return;
	}
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_next_node_to_select (_tmp3_);
	next_node = _tmp4_;
	_tmp5_ = g_array_new (TRUE, TRUE, sizeof (Connection*));
	g_array_set_clear_func (_tmp5_, (GDestroyNotify) _vala_Connection_free_function_content_of);
	conns = _tmp5_;
	undo_groups = NULL;
	_tmp6_ = self->priv->_map;
	_tmp7_ = mind_map_get_animator (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->_nodes;
	animator_add_nodes (_tmp8_, _tmp9_, TRUE, "cut nodes");
	_tmp10_ = self->priv->_connections;
	_tmp11_ = current;
	_tmp12_ = conns;
	connections_node_deleted (_tmp10_, _tmp11_, _tmp12_);
	_tmp13_ = self->priv->_groups;
	_tmp14_ = current;
	node_groups_remove_node (_tmp13_, _tmp14_, &undo_groups);
	_tmp15_ = self->priv->_map;
	minder_clipboard_copy_nodes (_tmp15_);
	_tmp16_ = current;
	if (node_is_root (_tmp16_)) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp17_ = FALSE;
				_tmp17_ = TRUE;
				while (TRUE) {
					GArray* _tmp19_;
					GArray* _tmp20_;
					Node* _tmp21_;
					Node* _tmp22_;
					if (!_tmp17_) {
						gint _tmp18_;
						_tmp18_ = i;
						i = _tmp18_ + 1;
					}
					_tmp17_ = FALSE;
					_tmp19_ = self->priv->_nodes;
					if (!(((guint) i) < _tmp19_->len)) {
						break;
					}
					_tmp20_ = self->priv->_nodes;
					_tmp21_ = g_array_index (_tmp20_, Node*, (guint) i);
					_tmp22_ = current;
					if (_tmp21_ == _tmp22_) {
						MindMap* _tmp23_;
						Node* _tmp24_;
						GArray* _tmp25_;
						UndoNodeGroups* _tmp26_;
						UndoNodeCut* _tmp27_;
						UndoNodeCut* _tmp28_;
						GArray* _tmp29_;
						Node* _tmp30_;
						Node* _tmp31_;
						_tmp23_ = self->priv->_map;
						_tmp24_ = current;
						_tmp25_ = conns;
						_tmp26_ = undo_groups;
						_tmp27_ = undo_node_cut_new (_tmp24_, i, _tmp25_, _tmp26_);
						_tmp28_ = _tmp27_;
						mind_map_add_undo (_tmp23_, (UndoItem*) _tmp28_);
						_g_object_unref0 (_tmp28_);
						_tmp29_ = self->priv->_nodes;
						_tmp30_ = vala_g_array_remove_index (_tmp29_, (guint) i);
						_tmp31_ = _tmp30_;
						_g_object_unref0 (_tmp31_);
						break;
					}
				}
			}
		}
	} else {
		MindMap* _tmp32_;
		Node* _tmp33_;
		Node* _tmp34_;
		GArray* _tmp35_;
		UndoNodeGroups* _tmp36_;
		UndoNodeCut* _tmp37_;
		UndoNodeCut* _tmp38_;
		Node* _tmp39_;
		_tmp32_ = self->priv->_map;
		_tmp33_ = current;
		_tmp34_ = current;
		_tmp35_ = conns;
		_tmp36_ = undo_groups;
		_tmp37_ = undo_node_cut_new (_tmp33_, node_index (_tmp34_), _tmp35_, _tmp36_);
		_tmp38_ = _tmp37_;
		mind_map_add_undo (_tmp32_, (UndoItem*) _tmp38_);
		_g_object_unref0 (_tmp38_);
		_tmp39_ = current;
		node_delete (_tmp39_);
	}
	_tmp40_ = self->priv->_map;
	_tmp41_ = mind_map_get_selected (_tmp40_);
	_tmp42_ = _tmp41_;
	_tmp43_ = current;
	selection_remove_node (_tmp42_, _tmp43_, 1.0, TRUE);
	_tmp44_ = current;
	if (!node_is_root (_tmp44_)) {
		MindMap* _tmp45_;
		Animator* _tmp46_;
		Animator* _tmp47_;
		_tmp45_ = self->priv->_map;
		_tmp46_ = mind_map_get_animator (_tmp45_);
		_tmp47_ = _tmp46_;
		animator_animate (_tmp47_);
	} else {
		MindMap* _tmp48_;
		Animator* _tmp49_;
		Animator* _tmp50_;
		_tmp48_ = self->priv->_map;
		_tmp49_ = mind_map_get_animator (_tmp48_);
		_tmp50_ = _tmp49_;
		animator_cancel_last_add (_tmp50_);
	}
	_tmp51_ = self->priv->_map;
	_tmp52_ = next_node;
	mind_map_select_node (_tmp51_, _tmp52_, TRUE);
	map_model_auto_save (self);
	_undo_node_groups_free0 (undo_groups);
	_g_array_unref0 (conns);
	_g_object_unref0 (next_node);
	_g_object_unref0 (current);
}

void
map_model_cut_selected_nodes_to_clipboard (MapModel* self)
{
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* nodes = NULL;
	MindMap* _tmp3_;
	Selection* _tmp4_;
	Selection* _tmp5_;
	GArray* _tmp6_;
	GArray* conns = NULL;
	GArray* _tmp7_;
	GArray* undo_groups = NULL;
	MindMap* _tmp8_;
	Animator* _tmp9_;
	Animator* _tmp10_;
	GArray* _tmp11_;
	NodeGroups* _tmp19_;
	GArray* _tmp20_;
	GArray* _tmp21_ = NULL;
	MindMap* _tmp22_;
	MindMap* _tmp23_;
	GArray* _tmp24_;
	GArray* _tmp25_;
	GArray* _tmp26_;
	UndoNodesCut* _tmp27_;
	UndoNodesCut* _tmp28_;
	MindMap* _tmp34_;
	Selection* _tmp35_;
	Selection* _tmp36_;
	MindMap* _tmp37_;
	Animator* _tmp38_;
	Animator* _tmp39_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	if (selection_num_nodes (_tmp2_) == 0) {
		return;
	}
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_selected (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = selection_ordered_nodes (_tmp5_);
	nodes = _tmp6_;
	_tmp7_ = g_array_new (TRUE, TRUE, sizeof (Connection*));
	g_array_set_clear_func (_tmp7_, (GDestroyNotify) _vala_Connection_free_function_content_of);
	conns = _tmp7_;
	undo_groups = NULL;
	_tmp8_ = self->priv->_map;
	_tmp9_ = mind_map_get_animator (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->_nodes;
	animator_add_nodes (_tmp10_, _tmp11_, TRUE, "cut nodes");
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				GArray* _tmp14_;
				Connections* _tmp15_;
				GArray* _tmp16_;
				Node* _tmp17_;
				GArray* _tmp18_;
				if (!_tmp12_) {
					gint _tmp13_;
					_tmp13_ = i;
					i = _tmp13_ + 1;
				}
				_tmp12_ = FALSE;
				_tmp14_ = nodes;
				if (!(((guint) i) < _tmp14_->len)) {
					break;
				}
				_tmp15_ = self->priv->_connections;
				_tmp16_ = nodes;
				_tmp17_ = g_array_index (_tmp16_, Node*, (guint) i);
				_tmp18_ = conns;
				connections_node_only_deleted (_tmp15_, _tmp17_, _tmp18_);
			}
		}
	}
	_tmp19_ = self->priv->_groups;
	_tmp20_ = nodes;
	node_groups_remove_nodes (_tmp19_, _tmp20_, &_tmp21_);
	_g_array_unref0 (undo_groups);
	undo_groups = _tmp21_;
	_tmp22_ = self->priv->_map;
	minder_clipboard_copy_nodes (_tmp22_);
	_tmp23_ = self->priv->_map;
	_tmp24_ = nodes;
	_tmp25_ = conns;
	_tmp26_ = undo_groups;
	_tmp27_ = undo_nodes_cut_new (_tmp24_, _tmp25_, _tmp26_);
	_tmp28_ = _tmp27_;
	mind_map_add_undo (_tmp23_, (UndoItem*) _tmp28_);
	_g_object_unref0 (_tmp28_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp29_ = FALSE;
			_tmp29_ = TRUE;
			while (TRUE) {
				GArray* _tmp31_;
				GArray* _tmp32_;
				Node* _tmp33_;
				if (!_tmp29_) {
					gint _tmp30_;
					_tmp30_ = i;
					i = _tmp30_ + 1;
				}
				_tmp29_ = FALSE;
				_tmp31_ = nodes;
				if (!(((guint) i) < _tmp31_->len)) {
					break;
				}
				_tmp32_ = nodes;
				_tmp33_ = g_array_index (_tmp32_, Node*, (guint) i);
				node_delete_only (_tmp33_);
			}
		}
	}
	_tmp34_ = self->priv->_map;
	_tmp35_ = mind_map_get_selected (_tmp34_);
	_tmp36_ = _tmp35_;
	selection_clear_nodes (_tmp36_, TRUE, 1.0);
	_tmp37_ = self->priv->_map;
	_tmp38_ = mind_map_get_animator (_tmp37_);
	_tmp39_ = _tmp38_;
	animator_animate (_tmp39_);
	map_model_auto_save (self);
	_g_array_unref0 (undo_groups);
	_g_array_unref0 (conns);
	_g_array_unref0 (nodes);
}

void
map_model_cut_selected_text (MapModel* self)
{
	CanvasText* text = NULL;
	MindMap* _tmp0_;
	CanvasText* _tmp1_;
	CanvasText* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_text (_tmp0_);
	text = _tmp1_;
	_tmp2_ = text;
	if (_tmp2_ != NULL) {
		CanvasText* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		CanvasText* _tmp6_;
		MindMap* _tmp7_;
		UndoTextBuffer* _tmp8_;
		UndoTextBuffer* _tmp9_;
		_tmp3_ = text;
		_tmp4_ = canvas_text_get_selected_text (_tmp3_);
		_tmp5_ = _tmp4_;
		minder_clipboard_copy_text (_tmp5_);
		_g_free0 (_tmp5_);
		_tmp6_ = text;
		_tmp7_ = self->priv->_map;
		_tmp8_ = mind_map_get_undo_text (_tmp7_);
		_tmp9_ = _tmp8_;
		canvas_text_insert (_tmp6_, "", _tmp9_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		map_model_auto_save (self);
	}
	_g_object_unref0 (text);
}

void
map_model_do_cut (MapModel* self)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ != NULL) {
		Node* _tmp5_;
		NodeMode _tmp6_;
		NodeMode _tmp7_;
		_tmp5_ = current;
		_tmp6_ = node_get_mode (_tmp5_);
		_tmp7_ = _tmp6_;
		switch (_tmp7_) {
			case NODE_MODE_CURRENT:
			{
				map_model_cut_node_to_clipboard (self);
				break;
			}
			case NODE_MODE_EDITABLE:
			{
				map_model_cut_selected_text (self);
				break;
			}
			default:
			break;
		}
	} else {
		MindMap* _tmp8_;
		Selection* _tmp9_;
		Selection* _tmp10_;
		GArray* _tmp11_;
		GArray* _tmp12_;
		gboolean _tmp13_;
		_tmp8_ = self->priv->_map;
		_tmp9_ = mind_map_get_selected (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = selection_nodes (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = _tmp12_->len > ((guint) 1);
		_g_array_unref0 (_tmp12_);
		if (_tmp13_) {
			map_model_cut_selected_nodes_to_clipboard (self);
		} else {
			gboolean _tmp14_ = FALSE;
			MindMap* _tmp15_;
			_tmp15_ = self->priv->_map;
			if (mind_map_is_connection_editable (_tmp15_)) {
				_tmp14_ = TRUE;
			} else {
				MindMap* _tmp16_;
				_tmp16_ = self->priv->_map;
				_tmp14_ = mind_map_is_callout_editable (_tmp16_);
			}
			if (_tmp14_) {
				map_model_cut_selected_text (self);
			}
		}
	}
	_g_object_unref0 (current);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
map_model_replace_node_text (MapModel* self,
                             Node* node,
                             const gchar* text)
{
	CanvasText* orig_text = NULL;
	MindMap* _tmp0_;
	CanvasText* _tmp1_;
	CanvasText* _tmp2_;
	CanvasText* _tmp3_;
	CanvasText* _tmp4_;
	CanvasText* _tmp5_;
	FormattedText* _tmp6_;
	FormattedText* _tmp7_;
	CanvasText* _tmp8_;
	CanvasText* _tmp9_;
	FormattedText* _tmp10_;
	FormattedText* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	MindMap* _tmp16_;
	MindMap* _tmp17_;
	UndoNodeName* _tmp18_;
	UndoNodeName* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = canvas_text_new (_tmp0_);
	orig_text = _tmp1_;
	_tmp2_ = node_get_name (node);
	_tmp3_ = _tmp2_;
	canvas_text_copy (orig_text, _tmp3_);
	_tmp4_ = node_get_name (node);
	_tmp5_ = _tmp4_;
	_tmp6_ = canvas_text_get_text (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = node_get_name (node);
	_tmp9_ = _tmp8_;
	_tmp10_ = canvas_text_get_text (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = formatted_text_get_text (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = string_strip (text);
	_tmp15_ = _tmp14_;
	formatted_text_replace_text (_tmp7_, 0, g_utf8_strlen (_tmp13_, (gssize) -1), _tmp15_);
	_g_free0 (_tmp15_);
	_tmp16_ = self->priv->_map;
	_tmp17_ = self->priv->_map;
	_tmp18_ = undo_node_name_new (_tmp17_, node, orig_text);
	_tmp19_ = _tmp18_;
	mind_map_add_undo (_tmp16_, (UndoItem*) _tmp19_);
	_g_object_unref0 (_tmp19_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	_g_object_unref0 (orig_text);
}

static void
map_model_replace_connection_text (MapModel* self,
                                   Connection* conn,
                                   const gchar* text)
{
	CanvasText* orig_title = NULL;
	MindMap* _tmp0_;
	CanvasText* _tmp1_;
	CanvasText* _tmp2_;
	CanvasText* _tmp3_;
	CanvasText* _tmp4_;
	CanvasText* _tmp5_;
	FormattedText* _tmp6_;
	FormattedText* _tmp7_;
	CanvasText* _tmp8_;
	CanvasText* _tmp9_;
	FormattedText* _tmp10_;
	FormattedText* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	MindMap* _tmp16_;
	MindMap* _tmp17_;
	UndoConnectionTitle* _tmp18_;
	UndoConnectionTitle* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conn != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = canvas_text_new (_tmp0_);
	orig_title = _tmp1_;
	_tmp2_ = connection_get_title (conn);
	_tmp3_ = _tmp2_;
	canvas_text_copy (orig_title, _tmp3_);
	_tmp4_ = connection_get_title (conn);
	_tmp5_ = _tmp4_;
	_tmp6_ = canvas_text_get_text (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = connection_get_title (conn);
	_tmp9_ = _tmp8_;
	_tmp10_ = canvas_text_get_text (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = formatted_text_get_text (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = string_strip (text);
	_tmp15_ = _tmp14_;
	formatted_text_replace_text (_tmp7_, 0, g_utf8_strlen (_tmp13_, (gssize) -1), _tmp15_);
	_g_free0 (_tmp15_);
	_tmp16_ = self->priv->_map;
	_tmp17_ = self->priv->_map;
	_tmp18_ = undo_connection_title_new (_tmp17_, conn, orig_title);
	_tmp19_ = _tmp18_;
	mind_map_add_undo (_tmp16_, (UndoItem*) _tmp19_);
	_g_object_unref0 (_tmp19_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	map_model_auto_save (self);
	_g_object_unref0 (orig_title);
}

static void
map_model_replace_callout_text (MapModel* self,
                                Callout* callout,
                                const gchar* text)
{
	CanvasText* orig_text = NULL;
	MindMap* _tmp0_;
	CanvasText* _tmp1_;
	CanvasText* _tmp2_;
	CanvasText* _tmp3_;
	CanvasText* _tmp4_;
	CanvasText* _tmp5_;
	FormattedText* _tmp6_;
	FormattedText* _tmp7_;
	CanvasText* _tmp8_;
	CanvasText* _tmp9_;
	FormattedText* _tmp10_;
	FormattedText* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	MindMap* _tmp16_;
	MindMap* _tmp17_;
	UndoCalloutText* _tmp18_;
	UndoCalloutText* _tmp19_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (callout != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = canvas_text_new (_tmp0_);
	orig_text = _tmp1_;
	_tmp2_ = callout_get_text (callout);
	_tmp3_ = _tmp2_;
	canvas_text_copy (orig_text, _tmp3_);
	_tmp4_ = callout_get_text (callout);
	_tmp5_ = _tmp4_;
	_tmp6_ = canvas_text_get_text (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = callout_get_text (callout);
	_tmp9_ = _tmp8_;
	_tmp10_ = canvas_text_get_text (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = formatted_text_get_text (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = string_strip (text);
	_tmp15_ = _tmp14_;
	formatted_text_replace_text (_tmp7_, 0, g_utf8_strlen (_tmp13_, (gssize) -1), _tmp15_);
	_g_free0 (_tmp15_);
	_tmp16_ = self->priv->_map;
	_tmp17_ = self->priv->_map;
	_tmp18_ = undo_callout_text_new (_tmp17_, callout, orig_text);
	_tmp19_ = _tmp18_;
	mind_map_add_undo (_tmp16_, (UndoItem*) _tmp19_);
	_g_object_unref0 (_tmp19_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	map_model_auto_save (self);
	_g_object_unref0 (orig_text);
}

static void
map_model_replace_node_image (MapModel* self,
                              Node* node,
                              GdkPixbuf* image)
{
	NodeImage* ni = NULL;
	ImageManager* _tmp0_;
	Style* _tmp1_;
	Style* _tmp2_;
	gint* _tmp3_;
	gint* _tmp4_;
	NodeImage* _tmp5_;
	NodeImage* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	g_return_if_fail (image != NULL);
	_tmp0_ = self->priv->_image_manager;
	_tmp1_ = node_get_style (node);
	_tmp2_ = _tmp1_;
	_tmp3_ = style_get_node_width (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = node_image_new_from_pixbuf (_tmp0_, image, *_tmp4_);
	ni = _tmp5_;
	_tmp6_ = ni;
	_tmp7_ = node_image_get_valid (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_) {
		NodeImage* orig_image = NULL;
		NodeImage* _tmp9_;
		NodeImage* _tmp10_;
		NodeImage* _tmp11_;
		ImageManager* _tmp12_;
		NodeImage* _tmp13_;
		MindMap* _tmp14_;
		NodeImage* _tmp15_;
		UndoNodeImage* _tmp16_;
		UndoNodeImage* _tmp17_;
		_tmp9_ = node_get_image (node);
		_tmp10_ = _tmp9_;
		_tmp11_ = _node_image_ref0 (_tmp10_);
		orig_image = _tmp11_;
		_tmp12_ = self->priv->_image_manager;
		_tmp13_ = ni;
		node_set_image (node, _tmp12_, _tmp13_);
		_tmp14_ = self->priv->_map;
		_tmp15_ = orig_image;
		_tmp16_ = undo_node_image_new (node, _tmp15_);
		_tmp17_ = _tmp16_;
		mind_map_add_undo (_tmp14_, (UndoItem*) _tmp17_);
		_g_object_unref0 (_tmp17_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
		map_model_auto_save (self);
		_node_image_unref0 (orig_image);
	}
	_node_image_unref0 (ni);
}

static void
_vala_NodeGroup_free_function_content_of (gpointer data)
{
	NodeGroup* self;
	self = *((NodeGroup**) data);
	_g_object_unref0_ (self);
}

static void
map_model_replace_node_xml (MapModel* self,
                            Node* node,
                            const gchar* text)
{
	GArray* nodes = NULL;
	GArray* _tmp0_;
	GArray* conns = NULL;
	GArray* _tmp1_;
	GArray* groups = NULL;
	GArray* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	GArray* _tmp5_;
	GArray* _tmp6_;
	GArray* _tmp7_;
	Node* _tmp8_;
	MindMap* _tmp14_;
	GArray* _tmp15_;
	UndoNodesReplace* _tmp16_;
	UndoNodesReplace* _tmp17_;
	MindMap* _tmp18_;
	GArray* _tmp19_;
	Node* _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	nodes = _tmp0_;
	_tmp1_ = g_array_new (TRUE, TRUE, sizeof (Connection*));
	g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_Connection_free_function_content_of);
	conns = _tmp1_;
	_tmp2_ = g_array_new (TRUE, TRUE, sizeof (NodeGroup*));
	g_array_set_clear_func (_tmp2_, (GDestroyNotify) _vala_NodeGroup_free_function_content_of);
	groups = _tmp2_;
	_tmp3_ = nodes;
	_tmp4_ = conns;
	_tmp5_ = groups;
	map_model_deserialize_for_paste (self, text, _tmp3_, _tmp4_, _tmp5_);
	_tmp6_ = nodes;
	if (_tmp6_->len == ((guint) 0)) {
		_g_array_unref0 (groups);
		_g_array_unref0 (conns);
		_g_array_unref0 (nodes);
		return;
	}
	_tmp7_ = nodes;
	_tmp8_ = g_array_index (_tmp7_, Node*, (guint) 0);
	map_model_replace_node (self, node, _tmp8_);
	{
		gint i = 0;
		i = 1;
		{
			gboolean _tmp9_ = FALSE;
			_tmp9_ = TRUE;
			while (TRUE) {
				GArray* _tmp11_;
				GArray* _tmp12_;
				Node* _tmp13_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp11_ = nodes;
				if (!(((guint) i) < _tmp11_->len)) {
					break;
				}
				_tmp12_ = nodes;
				_tmp13_ = g_array_index (_tmp12_, Node*, (guint) i);
				map_model_add_root (self, _tmp13_, -1);
			}
		}
	}
	_tmp14_ = self->priv->_map;
	_tmp15_ = nodes;
	_tmp16_ = undo_nodes_replace_new (node, _tmp15_);
	_tmp17_ = _tmp16_;
	mind_map_add_undo (_tmp14_, (UndoItem*) _tmp17_);
	_g_object_unref0 (_tmp17_);
	_tmp18_ = self->priv->_map;
	_tmp19_ = nodes;
	_tmp20_ = g_array_index (_tmp19_, Node*, (guint) 0);
	mind_map_select_node (_tmp18_, _tmp20_, TRUE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (groups);
	_g_array_unref0 (conns);
	_g_array_unref0 (nodes);
}

gboolean
map_model_insert_text_as_node (MapModel* self,
                               Node* node,
                               const gchar* text)
{
	GArray* nodes = NULL;
	GArray* _tmp0_;
	ExportText* export = NULL;
	MindMap* _tmp1_;
	MainWindow* _tmp2_;
	MainWindow* _tmp3_;
	Exports* _tmp4_;
	Exports* _tmp5_;
	Export* _tmp6_;
	ExportText* _tmp7_;
	MindMap* _tmp8_;
	GArray* _tmp9_;
	GArray* _tmp10_;
	MindMap* _tmp11_;
	MindMap* _tmp12_;
	GArray* _tmp13_;
	UndoNodesInsert* _tmp14_;
	UndoNodesInsert* _tmp15_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (text != NULL, FALSE);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	nodes = _tmp0_;
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_win (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = main_window_get_exports (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = exports_get_by_name (_tmp5_, "text");
	export = G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, TYPE_EXPORT_TEXT, ExportText);
	_tmp7_ = export;
	_tmp8_ = self->priv->_map;
	_tmp9_ = nodes;
	export_text_import_text (_tmp7_, text, 0, _tmp8_, FALSE, _tmp9_);
	_tmp10_ = nodes;
	if (_tmp10_->len == ((guint) 0)) {
		result = FALSE;
		_export_unref0 (export);
		_g_array_unref0 (nodes);
		return result;
	}
	_tmp11_ = self->priv->_map;
	_tmp12_ = self->priv->_map;
	_tmp13_ = nodes;
	_tmp14_ = undo_nodes_insert_new (_tmp12_, _tmp13_);
	_tmp15_ = _tmp14_;
	mind_map_add_undo (_tmp11_, (UndoItem*) _tmp15_);
	_g_object_unref0 (_tmp15_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	result = TRUE;
	_export_unref0 (export);
	_g_array_unref0 (nodes);
	return result;
}

gboolean
map_model_replace_text_as_node (MapModel* self,
                                Node* node,
                                const gchar* text)
{
	GArray* nodes = NULL;
	GArray* _tmp0_;
	ExportText* export = NULL;
	MindMap* _tmp1_;
	MainWindow* _tmp2_;
	MainWindow* _tmp3_;
	Exports* _tmp4_;
	Exports* _tmp5_;
	Export* _tmp6_;
	ExportText* _tmp7_;
	MindMap* _tmp8_;
	GArray* _tmp9_;
	GArray* _tmp10_;
	MindMap* _tmp11_;
	GArray* _tmp12_;
	UndoNodesReplace* _tmp13_;
	UndoNodesReplace* _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (node != NULL, FALSE);
	g_return_val_if_fail (text != NULL, FALSE);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	nodes = _tmp0_;
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_win (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = main_window_get_exports (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = exports_get_by_name (_tmp5_, "text");
	export = G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, TYPE_EXPORT_TEXT, ExportText);
	_tmp7_ = export;
	_tmp8_ = self->priv->_map;
	_tmp9_ = nodes;
	export_text_import_text (_tmp7_, text, 0, _tmp8_, TRUE, _tmp9_);
	_tmp10_ = nodes;
	if (_tmp10_->len == ((guint) 0)) {
		result = FALSE;
		_export_unref0 (export);
		_g_array_unref0 (nodes);
		return result;
	}
	_tmp11_ = self->priv->_map;
	_tmp12_ = nodes;
	_tmp13_ = undo_nodes_replace_new (node, _tmp12_);
	_tmp14_ = _tmp13_;
	mind_map_add_undo (_tmp11_, (UndoItem*) _tmp14_);
	_g_object_unref0 (_tmp14_);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	map_model_auto_save (self);
	result = TRUE;
	_export_unref0 (export);
	_g_array_unref0 (nodes);
	return result;
}

static void
map_model_paste_image_as_node (MapModel* self,
                               Node* node,
                               GdkPixbuf* image)
{
	Node* _tmp0_ = NULL;
	Node* new_node = NULL;
	Node* _tmp3_;
	NodeImage* ni = NULL;
	ImageManager* _tmp4_;
	NodeImage* _tmp5_;
	NodeImage* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	gint _tmp12_ = 0;
	MindMap* _tmp15_;
	Node* _tmp16_;
	UndoNodeInsert* _tmp17_;
	UndoNodeInsert* _tmp18_;
	MindMap* _tmp19_;
	Node* _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (image != NULL);
	if (node == NULL) {
		Node* _tmp1_;
		_tmp1_ = map_model_create_root_node (self, "");
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp1_;
	} else {
		Node* _tmp2_;
		_tmp2_ = map_model_create_child_node (self, node, "");
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp2_;
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	new_node = _tmp3_;
	_tmp4_ = self->priv->_image_manager;
	_tmp5_ = node_image_new_from_pixbuf (_tmp4_, image, 200);
	ni = _tmp5_;
	_tmp6_ = ni;
	_tmp7_ = node_image_get_valid (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_) {
		Node* _tmp9_;
		ImageManager* _tmp10_;
		NodeImage* _tmp11_;
		_tmp9_ = new_node;
		_tmp10_ = self->priv->_image_manager;
		_tmp11_ = ni;
		node_set_image (_tmp9_, _tmp10_, _tmp11_);
	}
	if (node == NULL) {
		GArray* _tmp13_;
		_tmp13_ = self->priv->_nodes;
		_tmp12_ = (gint) (_tmp13_->len - 1);
	} else {
		Node* _tmp14_;
		_tmp14_ = new_node;
		_tmp12_ = node_index (_tmp14_);
	}
	_tmp15_ = self->priv->_map;
	_tmp16_ = new_node;
	_tmp17_ = undo_node_insert_new (_tmp16_, _tmp12_);
	_tmp18_ = _tmp17_;
	mind_map_add_undo (_tmp15_, (UndoItem*) _tmp18_);
	_g_object_unref0 (_tmp18_);
	_tmp19_ = self->priv->_map;
	_tmp20_ = new_node;
	mind_map_select_node (_tmp19_, _tmp20_, TRUE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	map_model_auto_save (self);
	_node_image_unref0 (ni);
	_g_object_unref0 (new_node);
	_g_object_unref0 (_tmp0_);
}

static void
map_model_paste_as_nodes (MapModel* self,
                          Node* node,
                          const gchar* text)
{
	GArray* nodes = NULL;
	GArray* _tmp0_;
	GArray* conns = NULL;
	GArray* _tmp1_;
	GArray* groups = NULL;
	GArray* _tmp2_;
	GArray* _tmp3_;
	GArray* _tmp4_;
	GArray* _tmp5_;
	GArray* _tmp6_;
	MindMap* _tmp7_;
	Animator* _tmp8_;
	Animator* _tmp9_;
	GArray* _tmp10_;
	MindMap* _tmp70_;
	GArray* _tmp71_;
	GArray* _tmp72_;
	GArray* _tmp73_;
	UndoNodePaste* _tmp74_;
	UndoNodePaste* _tmp75_;
	MindMap* _tmp76_;
	Animator* _tmp77_;
	Animator* _tmp78_;
	MindMap* _tmp79_;
	GArray* _tmp80_;
	Node* _tmp81_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = g_array_new (TRUE, TRUE, sizeof (Node*));
	g_array_set_clear_func (_tmp0_, (GDestroyNotify) _vala_Node_free_function_content_of);
	nodes = _tmp0_;
	_tmp1_ = g_array_new (TRUE, TRUE, sizeof (Connection*));
	g_array_set_clear_func (_tmp1_, (GDestroyNotify) _vala_Connection_free_function_content_of);
	conns = _tmp1_;
	_tmp2_ = g_array_new (TRUE, TRUE, sizeof (NodeGroup*));
	g_array_set_clear_func (_tmp2_, (GDestroyNotify) _vala_NodeGroup_free_function_content_of);
	groups = _tmp2_;
	_tmp3_ = nodes;
	_tmp4_ = conns;
	_tmp5_ = groups;
	map_model_deserialize_for_paste (self, text, _tmp3_, _tmp4_, _tmp5_);
	_tmp6_ = nodes;
	if (_tmp6_->len == ((guint) 0)) {
		_g_array_unref0 (groups);
		_g_array_unref0 (conns);
		_g_array_unref0 (nodes);
		return;
	}
	_tmp7_ = self->priv->_map;
	_tmp8_ = mind_map_get_animator (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->priv->_nodes;
	animator_add_nodes (_tmp9_, _tmp10_, FALSE, "paste nodes");
	if (node == NULL) {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					GArray* _tmp13_;
					GArray* _tmp14_;
					Node* _tmp15_;
					GArray* _tmp16_;
					Node* _tmp17_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = i;
						i = _tmp12_ + 1;
					}
					_tmp11_ = FALSE;
					_tmp13_ = nodes;
					if (!(((guint) i) < _tmp13_->len)) {
						break;
					}
					_tmp14_ = nodes;
					_tmp15_ = g_array_index (_tmp14_, Node*, (guint) i);
					map_model_position_root_node (self, _tmp15_);
					_tmp16_ = nodes;
					_tmp17_ = g_array_index (_tmp16_, Node*, (guint) i);
					map_model_add_root (self, _tmp17_, -1);
				}
			}
		}
	} else {
		if (node_is_root (node)) {
			guint num_children = 0U;
			GArray* _tmp18_;
			GArray* _tmp19_;
			guint _tmp20_;
			_tmp18_ = node_children (node);
			_tmp19_ = _tmp18_;
			_tmp20_ = _tmp19_->len;
			_g_array_unref0 (_tmp19_);
			num_children = _tmp20_;
			if (num_children > ((guint) 0)) {
				{
					gint i = 0;
					i = 0;
					{
						gboolean _tmp21_ = FALSE;
						_tmp21_ = TRUE;
						while (TRUE) {
							GArray* _tmp23_;
							GArray* _tmp24_;
							Node* _tmp25_;
							GArray* _tmp26_;
							GArray* _tmp27_;
							Node* _tmp28_;
							NodeSide _tmp29_;
							NodeSide _tmp30_;
							GArray* _tmp31_;
							Node* _tmp32_;
							Layout* _tmp33_;
							Layout* _tmp34_;
							GArray* _tmp35_;
							Node* _tmp36_;
							GArray* _tmp37_;
							Node* _tmp38_;
							NodeSide _tmp39_;
							NodeSide _tmp40_;
							GArray* _tmp41_;
							Node* _tmp42_;
							Theme* _tmp43_;
							if (!_tmp21_) {
								gint _tmp22_;
								_tmp22_ = i;
								i = _tmp22_ + 1;
							}
							_tmp21_ = FALSE;
							_tmp23_ = nodes;
							if (!(((guint) i) < _tmp23_->len)) {
								break;
							}
							_tmp24_ = nodes;
							_tmp25_ = g_array_index (_tmp24_, Node*, (guint) i);
							_tmp26_ = node_children (node);
							_tmp27_ = _tmp26_;
							_tmp28_ = g_array_index (_tmp27_, Node*, num_children - 1);
							_tmp29_ = node_get_side (_tmp28_);
							_tmp30_ = _tmp29_;
							node_set_side (_tmp25_, _tmp30_);
							_g_array_unref0 (_tmp27_);
							_tmp31_ = nodes;
							_tmp32_ = g_array_index (_tmp31_, Node*, (guint) i);
							_tmp33_ = node_get_layout (_tmp32_);
							_tmp34_ = _tmp33_;
							_tmp35_ = nodes;
							_tmp36_ = g_array_index (_tmp35_, Node*, (guint) i);
							_tmp37_ = nodes;
							_tmp38_ = g_array_index (_tmp37_, Node*, (guint) i);
							_tmp39_ = node_get_side (_tmp38_);
							_tmp40_ = _tmp39_;
							layout_propagate_side (_tmp34_, _tmp36_, _tmp40_);
							_tmp41_ = nodes;
							_tmp42_ = g_array_index (_tmp41_, Node*, (guint) i);
							_tmp43_ = self->priv->_theme;
							node_attach (_tmp42_, node, -1, _tmp43_, TRUE);
						}
					}
				}
			} else {
				{
					gint i = 0;
					i = 0;
					{
						gboolean _tmp44_ = FALSE;
						_tmp44_ = TRUE;
						while (TRUE) {
							GArray* _tmp46_;
							GArray* _tmp47_;
							Node* _tmp48_;
							Theme* _tmp49_;
							if (!_tmp44_) {
								gint _tmp45_;
								_tmp45_ = i;
								i = _tmp45_ + 1;
							}
							_tmp44_ = FALSE;
							_tmp46_ = nodes;
							if (!(((guint) i) < _tmp46_->len)) {
								break;
							}
							_tmp47_ = nodes;
							_tmp48_ = g_array_index (_tmp47_, Node*, (guint) i);
							_tmp49_ = self->priv->_theme;
							node_attach (_tmp48_, node, -1, _tmp49_, TRUE);
						}
					}
				}
			}
		} else {
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp50_ = FALSE;
					_tmp50_ = TRUE;
					while (TRUE) {
						GArray* _tmp52_;
						GArray* _tmp53_;
						Node* _tmp54_;
						NodeSide _tmp55_;
						NodeSide _tmp56_;
						GArray* _tmp57_;
						Node* _tmp58_;
						Layout* _tmp59_;
						Layout* _tmp60_;
						GArray* _tmp61_;
						Node* _tmp62_;
						GArray* _tmp63_;
						Node* _tmp64_;
						NodeSide _tmp65_;
						NodeSide _tmp66_;
						GArray* _tmp67_;
						Node* _tmp68_;
						Theme* _tmp69_;
						if (!_tmp50_) {
							gint _tmp51_;
							_tmp51_ = i;
							i = _tmp51_ + 1;
						}
						_tmp50_ = FALSE;
						_tmp52_ = nodes;
						if (!(((guint) i) < _tmp52_->len)) {
							break;
						}
						_tmp53_ = nodes;
						_tmp54_ = g_array_index (_tmp53_, Node*, (guint) i);
						_tmp55_ = node_get_side (node);
						_tmp56_ = _tmp55_;
						node_set_side (_tmp54_, _tmp56_);
						_tmp57_ = nodes;
						_tmp58_ = g_array_index (_tmp57_, Node*, (guint) i);
						_tmp59_ = node_get_layout (_tmp58_);
						_tmp60_ = _tmp59_;
						_tmp61_ = nodes;
						_tmp62_ = g_array_index (_tmp61_, Node*, (guint) i);
						_tmp63_ = nodes;
						_tmp64_ = g_array_index (_tmp63_, Node*, (guint) i);
						_tmp65_ = node_get_side (_tmp64_);
						_tmp66_ = _tmp65_;
						layout_propagate_side (_tmp60_, _tmp62_, _tmp66_);
						_tmp67_ = nodes;
						_tmp68_ = g_array_index (_tmp67_, Node*, (guint) i);
						_tmp69_ = self->priv->_theme;
						node_attach (_tmp68_, node, -1, _tmp69_, TRUE);
					}
				}
			}
		}
	}
	_tmp70_ = self->priv->_map;
	_tmp71_ = nodes;
	_tmp72_ = conns;
	_tmp73_ = groups;
	_tmp74_ = undo_node_paste_new (_tmp71_, _tmp72_, _tmp73_);
	_tmp75_ = _tmp74_;
	mind_map_add_undo (_tmp70_, (UndoItem*) _tmp75_);
	_g_object_unref0 (_tmp75_);
	_tmp76_ = self->priv->_map;
	_tmp77_ = mind_map_get_animator (_tmp76_);
	_tmp78_ = _tmp77_;
	animator_animate (_tmp78_);
	_tmp79_ = self->priv->_map;
	_tmp80_ = nodes;
	_tmp81_ = g_array_index (_tmp80_, Node*, (guint) 0);
	mind_map_select_node (_tmp79_, _tmp81_, TRUE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
	map_model_auto_save (self);
	_g_array_unref0 (groups);
	_g_array_unref0 (conns);
	_g_array_unref0 (nodes);
}

void
map_model_paste_text (MapModel* self,
                      const gchar* text,
                      gboolean shift)
{
	Node* node = NULL;
	MindMap* _tmp0_;
	Node* _tmp1_;
	Connection* conn = NULL;
	MindMap* _tmp2_;
	Connection* _tmp3_;
	Callout* callout = NULL;
	MindMap* _tmp4_;
	Callout* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_node (_tmp0_);
	node = _tmp1_;
	_tmp2_ = self->priv->_map;
	_tmp3_ = mind_map_get_current_connection (_tmp2_);
	conn = _tmp3_;
	_tmp4_ = self->priv->_map;
	_tmp5_ = mind_map_get_current_callout (_tmp4_);
	callout = _tmp5_;
	if (shift) {
		gboolean _tmp6_ = FALSE;
		Node* _tmp7_;
		_tmp7_ = node;
		if (_tmp7_ != NULL) {
			Node* _tmp8_;
			NodeMode _tmp9_;
			NodeMode _tmp10_;
			_tmp8_ = node;
			_tmp9_ = node_get_mode (_tmp8_);
			_tmp10_ = _tmp9_;
			_tmp6_ = _tmp10_ == NODE_MODE_CURRENT;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			Node* _tmp11_;
			_tmp11_ = node;
			map_model_replace_node_text (self, _tmp11_, text);
		} else {
			gboolean _tmp12_ = FALSE;
			Connection* _tmp13_;
			_tmp13_ = conn;
			if (_tmp13_ != NULL) {
				Connection* _tmp14_;
				ConnMode _tmp15_;
				ConnMode _tmp16_;
				_tmp14_ = conn;
				_tmp15_ = connection_get_mode (_tmp14_);
				_tmp16_ = _tmp15_;
				_tmp12_ = _tmp16_ == CONN_MODE_SELECTED;
			} else {
				_tmp12_ = FALSE;
			}
			if (_tmp12_) {
				Connection* _tmp17_;
				_tmp17_ = conn;
				map_model_replace_connection_text (self, _tmp17_, text);
			} else {
				gboolean _tmp18_ = FALSE;
				Callout* _tmp19_;
				_tmp19_ = callout;
				if (_tmp19_ != NULL) {
					Callout* _tmp20_;
					CalloutMode _tmp21_;
					CalloutMode _tmp22_;
					_tmp20_ = callout;
					_tmp21_ = callout_get_mode (_tmp20_);
					_tmp22_ = _tmp21_;
					_tmp18_ = _tmp22_ == CALLOUT_MODE_SELECTED;
				} else {
					_tmp18_ = FALSE;
				}
				if (_tmp18_) {
					Callout* _tmp23_;
					_tmp23_ = callout;
					map_model_replace_callout_text (self, _tmp23_, text);
				}
			}
		}
	} else {
		CanvasText* ct = NULL;
		MindMap* _tmp24_;
		CanvasText* _tmp25_;
		CanvasText* _tmp26_;
		_tmp24_ = self->priv->_map;
		_tmp25_ = mind_map_get_current_text (_tmp24_);
		ct = _tmp25_;
		_tmp26_ = ct;
		if (_tmp26_ != NULL) {
			CanvasText* _tmp27_;
			MindMap* _tmp28_;
			UndoTextBuffer* _tmp29_;
			UndoTextBuffer* _tmp30_;
			_tmp27_ = ct;
			_tmp28_ = self->priv->_map;
			_tmp29_ = mind_map_get_undo_text (_tmp28_);
			_tmp30_ = _tmp29_;
			canvas_text_insert (_tmp27_, text, _tmp30_);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		} else {
			Connection* _tmp31_;
			_tmp31_ = conn;
			if (_tmp31_ == NULL) {
				Node* _tmp32_;
				_tmp32_ = node;
				map_model_insert_text_as_node (self, _tmp32_, text);
			}
		}
		_g_object_unref0 (ct);
	}
	_g_object_unref0 (callout);
	_g_object_unref0 (conn);
	_g_object_unref0 (node);
}

static gpointer
_node_link_ref0 (gpointer self)
{
	return self ? node_link_ref (self) : NULL;
}

void
map_model_paste_node_link (MapModel* self,
                           const gchar* text)
{
	MindMap* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->_map;
	if (mind_map_is_node_selected (_tmp0_)) {
		Node* current = NULL;
		MindMap* _tmp1_;
		Selection* _tmp2_;
		Selection* _tmp3_;
		Node* _tmp4_;
		NodeLink* old_link = NULL;
		Node* _tmp5_;
		NodeLink* _tmp6_;
		NodeLink* _tmp7_;
		NodeLink* _tmp8_;
		NodeLink* new_link = NULL;
		NodeLink* _tmp9_;
		NodeLink* _tmp10_;
		_tmp1_ = self->priv->_map;
		_tmp2_ = mind_map_get_selected (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = selection_current_node (_tmp3_);
		current = _tmp4_;
		_tmp5_ = current;
		_tmp6_ = node_get_linked_node (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = _node_link_ref0 (_tmp7_);
		old_link = _tmp8_;
		_tmp9_ = map_model_deserialize_for_node_link (text);
		new_link = _tmp9_;
		_tmp10_ = new_link;
		if (_tmp10_ != NULL) {
			Node* _tmp11_;
			NodeLink* _tmp12_;
			MindMap* _tmp13_;
			Node* _tmp14_;
			NodeLink* _tmp15_;
			UndoNodeLink* _tmp16_;
			UndoNodeLink* _tmp17_;
			_tmp11_ = current;
			_tmp12_ = new_link;
			node_set_linked_node (_tmp11_, _tmp12_);
			_tmp13_ = self->priv->_map;
			_tmp14_ = current;
			_tmp15_ = old_link;
			_tmp16_ = undo_node_link_new (_tmp14_, _tmp15_);
			_tmp17_ = _tmp16_;
			mind_map_add_undo (_tmp13_, (UndoItem*) _tmp17_);
			_g_object_unref0 (_tmp17_);
			map_model_auto_save (self);
			g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		}
		_node_link_unref0 (new_link);
		_node_link_unref0 (old_link);
		_g_object_unref0 (current);
	}
}

void
map_model_paste_image (MapModel* self,
                       GdkPixbuf* image,
                       gboolean shift)
{
	Node* node = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (image != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	node = _tmp3_;
	if (shift) {
		gboolean _tmp4_ = FALSE;
		Node* _tmp5_;
		_tmp5_ = node;
		if (_tmp5_ != NULL) {
			Node* _tmp6_;
			NodeMode _tmp7_;
			NodeMode _tmp8_;
			_tmp6_ = node;
			_tmp7_ = node_get_mode (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp4_ = _tmp8_ == NODE_MODE_CURRENT;
		} else {
			_tmp4_ = FALSE;
		}
		if (_tmp4_) {
			Node* _tmp9_;
			_tmp9_ = node;
			map_model_replace_node_image (self, _tmp9_, image);
		}
	} else {
		Node* _tmp10_;
		_tmp10_ = node;
		map_model_paste_image_as_node (self, _tmp10_, image);
	}
	_g_object_unref0 (node);
}

void
map_model_paste_nodes (MapModel* self,
                       const gchar* text,
                       gboolean shift)
{
	Node* node = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	node = _tmp3_;
	if (shift) {
		gboolean _tmp4_ = FALSE;
		Node* _tmp5_;
		_tmp5_ = node;
		if (_tmp5_ != NULL) {
			Node* _tmp6_;
			NodeMode _tmp7_;
			NodeMode _tmp8_;
			_tmp6_ = node;
			_tmp7_ = node_get_mode (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp4_ = _tmp8_ == NODE_MODE_CURRENT;
		} else {
			_tmp4_ = FALSE;
		}
		if (_tmp4_) {
			Node* _tmp9_;
			_tmp9_ = node;
			map_model_replace_node_xml (self, _tmp9_, text);
		}
	} else {
		Node* _tmp10_;
		_tmp10_ = node;
		map_model_paste_as_nodes (self, _tmp10_, text);
	}
	_g_object_unref0 (node);
}

static gboolean
_map_model_do_auto_save_gsource_func (gpointer self)
{
	gboolean result;
	result = map_model_do_auto_save ((MapModel*) self);
	return result;
}

static guint*
_uint_dup (guint* self)
{
	guint* dup;
	dup = g_new0 (guint, 1);
	memcpy (dup, self, sizeof (guint));
	return dup;
}

static gpointer
__uint_dup0 (gpointer self)
{
	return self ? _uint_dup (self) : NULL;
}

void
map_model_auto_save (MapModel* self)
{
	MindMap* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_editable (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		guint* _tmp3_;
		guint _tmp5_;
		guint* _tmp6_;
		_tmp3_ = self->priv->_auto_save_id;
		if (_tmp3_ != NULL) {
			guint* _tmp4_;
			_tmp4_ = self->priv->_auto_save_id;
			g_source_remove (*_tmp4_);
		}
		_tmp5_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _map_model_do_auto_save_gsource_func, map_model_ref (self), map_model_unref);
		_tmp6_ = __uint_dup0 (&_tmp5_);
		_g_free0 (self->priv->_auto_save_id);
		self->priv->_auto_save_id = _tmp6_;
	}
}

static gboolean
map_model_do_auto_save (MapModel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_g_free0 (self->priv->_auto_save_id);
	self->priv->_auto_save_id = NULL;
	map_model_set_is_loaded (self, TRUE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_CHANGED_SIGNAL], 0);
	result = FALSE;
	return result;
}

gboolean
map_model_update_current_image (MapModel* self,
                                const gchar* uri)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	NodeImage* image = NULL;
	ImageManager* _tmp4_;
	Node* _tmp5_;
	Style* _tmp6_;
	Style* _tmp7_;
	gint* _tmp8_;
	gint* _tmp9_;
	NodeImage* _tmp10_;
	NodeImage* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (uri != NULL, FALSE);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	_tmp4_ = self->priv->_image_manager;
	_tmp5_ = current;
	_tmp6_ = node_get_style (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = style_get_node_width (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = node_image_new_from_uri (_tmp4_, uri, *_tmp9_);
	image = _tmp10_;
	_tmp11_ = image;
	_tmp12_ = node_image_get_valid (_tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_) {
		NodeImage* orig_image = NULL;
		Node* _tmp14_;
		NodeImage* _tmp15_;
		NodeImage* _tmp16_;
		NodeImage* _tmp17_;
		Node* _tmp18_;
		ImageManager* _tmp19_;
		NodeImage* _tmp20_;
		MindMap* _tmp21_;
		Node* _tmp22_;
		NodeImage* _tmp23_;
		UndoNodeImage* _tmp24_;
		UndoNodeImage* _tmp25_;
		_tmp14_ = current;
		_tmp15_ = node_get_image (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = _node_image_ref0 (_tmp16_);
		orig_image = _tmp17_;
		_tmp18_ = current;
		_tmp19_ = self->priv->_image_manager;
		_tmp20_ = image;
		node_set_image (_tmp18_, _tmp19_, _tmp20_);
		_tmp21_ = self->priv->_map;
		_tmp22_ = current;
		_tmp23_ = orig_image;
		_tmp24_ = undo_node_image_new (_tmp22_, _tmp23_);
		_tmp25_ = _tmp24_;
		mind_map_add_undo (_tmp21_, (UndoItem*) _tmp25_);
		_g_object_unref0 (_tmp25_);
		g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
		g_signal_emit (self, map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL], 0);
		map_model_auto_save (self);
		result = TRUE;
		_node_image_unref0 (orig_image);
		_node_image_unref0 (image);
		_g_object_unref0 (current);
		return result;
	}
	result = FALSE;
	_node_image_unref0 (image);
	_g_object_unref0 (current);
	return result;
}

void
map_model_start_connection (MapModel* self,
                            gboolean key,
                            gboolean link)
{
	Node* current_node = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	gboolean _tmp4_ = FALSE;
	Node* _tmp5_;
	Connection* conn = NULL;
	MindMap* _tmp9_;
	Node* _tmp10_;
	Connection* _tmp11_;
	MindMap* _tmp12_;
	Connection* _tmp13_;
	ConnMode _tmp14_ = 0;
	Connection* _tmp15_;
	Node* _tmp34_;
	Node* _tmp35_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current_node = _tmp3_;
	_tmp5_ = current_node;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		Connections* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp6_ = self->priv->_connections;
		_tmp7_ = connections_get_hide (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = _tmp8_;
	}
	if (_tmp4_) {
		_g_object_unref0 (current_node);
		return;
	}
	_tmp9_ = self->priv->_map;
	_tmp10_ = current_node;
	_tmp11_ = connection_new (_tmp9_, _tmp10_);
	conn = _tmp11_;
	_tmp12_ = self->priv->_map;
	_tmp13_ = conn;
	mind_map_set_current_connection (_tmp12_, _tmp13_);
	if (link) {
		_tmp14_ = CONN_MODE_LINKING;
	} else {
		_tmp14_ = CONN_MODE_CONNECTING;
	}
	_tmp15_ = conn;
	connection_set_mode (_tmp15_, _tmp14_);
	if (key) {
		gdouble x = 0.0;
		gdouble y = 0.0;
		gdouble w = 0.0;
		gdouble h = 0.0;
		Node* _tmp16_;
		gdouble _tmp17_ = 0.0;
		gdouble _tmp18_ = 0.0;
		gdouble _tmp19_ = 0.0;
		gdouble _tmp20_ = 0.0;
		Connection* _tmp21_;
		Node* _tmp22_;
		_tmp16_ = current_node;
		node_bbox (_tmp16_, &_tmp17_, &_tmp18_, &_tmp19_, &_tmp20_);
		x = _tmp17_;
		y = _tmp18_;
		w = _tmp19_;
		h = _tmp20_;
		_tmp21_ = conn;
		connection_draw_to (_tmp21_, x + (w / 2), y + (h / 2));
		_tmp22_ = current_node;
		map_model_set_attach_node (self, _tmp22_, NODE_MODE_ATTACHABLE);
	} else {
		Connection* _tmp23_;
		MindMap* _tmp24_;
		DrawArea* _tmp25_;
		DrawArea* _tmp26_;
		gdouble _tmp27_;
		gdouble _tmp28_;
		MindMap* _tmp29_;
		DrawArea* _tmp30_;
		DrawArea* _tmp31_;
		gdouble _tmp32_;
		gdouble _tmp33_;
		_tmp23_ = conn;
		_tmp24_ = self->priv->_map;
		_tmp25_ = mind_map_get_canvas (_tmp24_);
		_tmp26_ = _tmp25_;
		_tmp27_ = draw_area_get_press_x (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = self->priv->_map;
		_tmp30_ = mind_map_get_canvas (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = draw_area_get_press_y (_tmp31_);
		_tmp33_ = _tmp32_;
		connection_draw_to (_tmp23_, _tmp28_, _tmp33_);
	}
	_tmp34_ = current_node;
	_tmp35_ = _g_object_ref0 (_tmp34_);
	_g_object_unref0 (self->priv->_last_node);
	self->priv->_last_node = _tmp35_;
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_object_unref0 (conn);
	_g_object_unref0 (current_node);
}

void
map_model_update_connection_by_node (MapModel* self,
                                     Node* node)
{
	gdouble x = 0.0;
	gdouble y = 0.0;
	gdouble w = 0.0;
	gdouble h = 0.0;
	gdouble _tmp0_ = 0.0;
	gdouble _tmp1_ = 0.0;
	gdouble _tmp2_ = 0.0;
	gdouble _tmp3_ = 0.0;
	MindMap* _tmp4_;
	Selection* _tmp5_;
	Selection* _tmp6_;
	Connection* _tmp7_;
	Connection* _tmp8_;
	g_return_if_fail (self != NULL);
	if (node == NULL) {
		return;
	}
	node_bbox (node, &_tmp0_, &_tmp1_, &_tmp2_, &_tmp3_);
	x = _tmp0_;
	y = _tmp1_;
	w = _tmp2_;
	h = _tmp3_;
	_tmp4_ = self->priv->_map;
	_tmp5_ = mind_map_get_selected (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = selection_current_connection (_tmp6_);
	_tmp8_ = _tmp7_;
	connection_draw_to (_tmp8_, x + (w / 2), y + (h / 2));
	_g_object_unref0 (_tmp8_);
	map_model_set_attach_node (self, node, NODE_MODE_ATTACHABLE);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
}

void
map_model_end_connection (MapModel* self,
                          Node* n)
{
	Connection* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Connection* _tmp3_;
	Connection* _tmp4_;
	Connection* _tmp5_;
	Connections* _tmp6_;
	Connection* _tmp7_;
	MindMap* _tmp8_;
	Connection* _tmp9_;
	UndoConnectionAdd* _tmp10_;
	UndoConnectionAdd* _tmp11_;
	MindMap* _tmp12_;
	Connection* _tmp13_;
	Connection* _tmp14_;
	MindMap* _tmp15_;
	DrawArea* _tmp16_;
	DrawArea* _tmp17_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (n != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_connection (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (current);
		return;
	}
	_tmp5_ = current;
	connection_connect_to (_tmp5_, n);
	_tmp6_ = self->priv->_connections;
	_tmp7_ = current;
	connections_add_connection (_tmp6_, _tmp7_);
	_tmp8_ = self->priv->_map;
	_tmp9_ = current;
	_tmp10_ = undo_connection_add_new (_tmp9_);
	_tmp11_ = _tmp10_;
	mind_map_add_undo (_tmp8_, (UndoItem*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	_tmp12_ = self->priv->_map;
	_tmp13_ = current;
	mind_map_set_current_connection (_tmp12_, _tmp13_);
	_tmp14_ = current;
	map_model_handle_connection_edit_on_creation (self, _tmp14_);
	_tmp15_ = self->priv->_map;
	_tmp16_ = mind_map_get_canvas (_tmp15_);
	_tmp17_ = _tmp16_;
	draw_area_set_last_connection (_tmp17_, NULL);
	_g_object_unref0 (self->priv->_last_node);
	self->priv->_last_node = NULL;
	map_model_set_attach_node (self, NULL, NODE_MODE_ATTACHABLE);
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_object_unref0 (current);
}

void
map_model_create_connection (MapModel* self)
{
	gboolean _tmp0_ = FALSE;
	MindMap* _tmp1_;
	Selection* _tmp2_;
	Selection* _tmp3_;
	gdouble x = 0.0;
	gdouble y = 0.0;
	gdouble w = 0.0;
	gdouble h = 0.0;
	GArray* nodes = NULL;
	MindMap* _tmp7_;
	Selection* _tmp8_;
	Selection* _tmp9_;
	GArray* _tmp10_;
	Connection* conn = NULL;
	MindMap* _tmp11_;
	GArray* _tmp12_;
	Node* _tmp13_;
	Connection* _tmp14_;
	Connection* _tmp15_;
	GArray* _tmp16_;
	Node* _tmp17_;
	GArray* _tmp18_;
	Node* _tmp19_;
	gdouble _tmp20_ = 0.0;
	gdouble _tmp21_ = 0.0;
	gdouble _tmp22_ = 0.0;
	gdouble _tmp23_ = 0.0;
	Connection* _tmp24_;
	Connections* _tmp25_;
	Connection* _tmp26_;
	MindMap* _tmp27_;
	Connection* _tmp28_;
	MindMap* _tmp29_;
	Connection* _tmp30_;
	UndoConnectionAdd* _tmp31_;
	UndoConnectionAdd* _tmp32_;
	Connection* _tmp33_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_map;
	_tmp2_ = mind_map_get_selected (_tmp1_);
	_tmp3_ = _tmp2_;
	if (selection_num_nodes (_tmp3_) != 2) {
		_tmp0_ = TRUE;
	} else {
		Connections* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = self->priv->_connections;
		_tmp5_ = connections_get_hide (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_;
	}
	if (_tmp0_) {
		return;
	}
	_tmp7_ = self->priv->_map;
	_tmp8_ = mind_map_get_selected (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = selection_nodes (_tmp9_);
	nodes = _tmp10_;
	_tmp11_ = self->priv->_map;
	_tmp12_ = nodes;
	_tmp13_ = g_array_index (_tmp12_, Node*, (guint) 0);
	_tmp14_ = connection_new (_tmp11_, _tmp13_);
	conn = _tmp14_;
	_tmp15_ = conn;
	_tmp16_ = nodes;
	_tmp17_ = g_array_index (_tmp16_, Node*, (guint) 1);
	connection_connect_to (_tmp15_, _tmp17_);
	_tmp18_ = nodes;
	_tmp19_ = g_array_index (_tmp18_, Node*, (guint) 1);
	node_bbox (_tmp19_, &_tmp20_, &_tmp21_, &_tmp22_, &_tmp23_);
	x = _tmp20_;
	y = _tmp21_;
	w = _tmp22_;
	h = _tmp23_;
	_tmp24_ = conn;
	connection_draw_to (_tmp24_, x + (w / 2), y + (h / 2));
	_tmp25_ = self->priv->_connections;
	_tmp26_ = conn;
	connections_add_connection (_tmp25_, _tmp26_);
	_tmp27_ = self->priv->_map;
	_tmp28_ = conn;
	mind_map_set_current_connection (_tmp27_, _tmp28_);
	_tmp29_ = self->priv->_map;
	_tmp30_ = conn;
	_tmp31_ = undo_connection_add_new (_tmp30_);
	_tmp32_ = _tmp31_;
	mind_map_add_undo (_tmp29_, (UndoItem*) _tmp32_);
	_g_object_unref0 (_tmp32_);
	_tmp33_ = conn;
	map_model_handle_connection_edit_on_creation (self, _tmp33_);
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_object_unref0 (conn);
	_g_array_unref0 (nodes);
}

void
map_model_delete_connection (MapModel* self)
{
	Connection* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Connection* _tmp3_;
	Connection* _tmp4_;
	MindMap* _tmp5_;
	Connection* _tmp6_;
	UndoConnectionDelete* _tmp7_;
	UndoConnectionDelete* _tmp8_;
	Connections* _tmp9_;
	Connection* _tmp10_;
	MindMap* _tmp11_;
	Selection* _tmp12_;
	Selection* _tmp13_;
	Connection* _tmp14_;
	MindMap* _tmp15_;
	DrawArea* _tmp16_;
	DrawArea* _tmp17_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_connection (_tmp2_);
	current = _tmp3_;
	_tmp4_ = current;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (current);
		return;
	}
	_tmp5_ = self->priv->_map;
	_tmp6_ = current;
	_tmp7_ = undo_connection_delete_new (_tmp6_);
	_tmp8_ = _tmp7_;
	mind_map_add_undo (_tmp5_, (UndoItem*) _tmp8_);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = self->priv->_connections;
	_tmp10_ = current;
	connections_remove_connection (_tmp9_, _tmp10_, FALSE);
	_tmp11_ = self->priv->_map;
	_tmp12_ = mind_map_get_selected (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = current;
	selection_remove_connection (_tmp13_, _tmp14_, 1.0);
	_tmp15_ = self->priv->_map;
	_tmp16_ = mind_map_get_canvas (_tmp15_);
	_tmp17_ = _tmp16_;
	draw_area_set_last_connection (_tmp17_, NULL);
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_object_unref0 (current);
}

void
map_model_delete_connections (MapModel* self)
{
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	GArray* conns = NULL;
	MindMap* _tmp3_;
	Selection* _tmp4_;
	Selection* _tmp5_;
	GArray* _tmp6_;
	MindMap* _tmp7_;
	GArray* _tmp8_;
	UndoConnectionsDelete* _tmp9_;
	UndoConnectionsDelete* _tmp10_;
	MindMap* _tmp17_;
	Selection* _tmp18_;
	Selection* _tmp19_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	if (selection_num_connections (_tmp2_) == 0) {
		return;
	}
	_tmp3_ = self->priv->_map;
	_tmp4_ = mind_map_get_selected (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = selection_connections (_tmp5_);
	conns = _tmp6_;
	_tmp7_ = self->priv->_map;
	_tmp8_ = conns;
	_tmp9_ = undo_connections_delete_new (_tmp8_);
	_tmp10_ = _tmp9_;
	mind_map_add_undo (_tmp7_, (UndoItem*) _tmp10_);
	_g_object_unref0 (_tmp10_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp11_ = FALSE;
			_tmp11_ = TRUE;
			while (TRUE) {
				GArray* _tmp13_;
				Connections* _tmp14_;
				GArray* _tmp15_;
				Connection* _tmp16_;
				if (!_tmp11_) {
					gint _tmp12_;
					_tmp12_ = i;
					i = _tmp12_ + 1;
				}
				_tmp11_ = FALSE;
				_tmp13_ = conns;
				if (!(((guint) i) < _tmp13_->len)) {
					break;
				}
				_tmp14_ = self->priv->_connections;
				_tmp15_ = conns;
				_tmp16_ = g_array_index (_tmp15_, Connection*, (guint) i);
				connections_remove_connection (_tmp14_, _tmp16_, FALSE);
			}
		}
	}
	_tmp17_ = self->priv->_map;
	_tmp18_ = mind_map_get_selected (_tmp17_);
	_tmp19_ = _tmp18_;
	selection_clear_connections (_tmp19_, TRUE, 1.0);
	map_model_auto_save (self);
	g_signal_emit (self, map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL], 0);
	_g_array_unref0 (conns);
}

void
map_model_handle_connection_edit_on_creation (MapModel* self,
                                              Connection* conn)
{
	gboolean _tmp0_ = FALSE;
	CanvasText* _tmp1_;
	CanvasText* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (conn != NULL);
	_tmp1_ = connection_get_title (conn);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == NULL) {
		MindMap* _tmp3_;
		GSettings* _tmp4_;
		GSettings* _tmp5_;
		_tmp3_ = self->priv->_map;
		_tmp4_ = mind_map_get_settings (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp0_ = g_settings_get_boolean (_tmp5_, "edit-connection-title-on-creation");
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		MindMap* _tmp6_;
		_tmp6_ = self->priv->_map;
		connection_change_title (conn, _tmp6_, "", TRUE);
		map_model_set_connection_mode (self, conn, CONN_MODE_EDITABLE, FALSE);
	}
}

static Block42Data*
block42_data_ref (Block42Data* _data42_)
{
	g_atomic_int_inc (&_data42_->_ref_count_);
	return _data42_;
}

static void
block42_data_unref (void * _userdata_)
{
	Block42Data* _data42_;
	_data42_ = (Block42Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data42_->_ref_count_)) {
		MapModel* self;
		self = _data42_->self;
		_g_object_unref0 (_data42_->parent);
		_map_model_unref0 (self);
		g_slice_free (Block42Data, _data42_);
	}
}

static void
__lambda110_ (MapModel* self,
              Node* child)
{
	NodeSide _tmp0_;
	NodeSide _tmp1_;
	g_return_if_fail (child != NULL);
	_tmp0_ = node_get_side (child);
	_tmp1_ = _tmp0_;
	node_detach (child, _tmp1_);
}

static void
___lambda110__gfunc (gconstpointer data,
                     gpointer self)
{
	__lambda110_ ((MapModel*) self, (Node*) data);
}

static void
__lambda111_ (Block42Data* _data42_,
              Node* child)
{
	MapModel* self;
	self = _data42_->self;
	g_return_if_fail (child != NULL);
	node_attach (child, _data42_->parent, -1, NULL, FALSE);
}

static void
___lambda111__gfunc (gconstpointer data,
                     gpointer self)
{
	__lambda111_ (self, (Node*) data);
}

static inline void
_g_slist_free__g_object_unref0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
map_model_sort_children (MapModel* self,
                         Node* parent,
                         GCompareFunc sort_fn)
{
	Block42Data* _data42_;
	Node* _tmp0_;
	GSList* children = NULL;
	MindMap* _tmp1_;
	UndoNodeSort* _tmp2_;
	UndoNodeSort* _tmp3_;
	MindMap* _tmp4_;
	Animator* _tmp5_;
	Animator* _tmp6_;
	GArray* _tmp7_;
	GSList* _tmp17_;
	GSList* _tmp18_;
	MindMap* _tmp19_;
	Animator* _tmp20_;
	Animator* _tmp21_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (parent != NULL);
	_data42_ = g_slice_new0 (Block42Data);
	_data42_->_ref_count_ = 1;
	_data42_->self = map_model_ref (self);
	_tmp0_ = _g_object_ref0 (parent);
	_g_object_unref0 (_data42_->parent);
	_data42_->parent = _tmp0_;
	children = NULL;
	_tmp1_ = self->priv->_map;
	_tmp2_ = undo_node_sort_new (_data42_->parent);
	_tmp3_ = _tmp2_;
	mind_map_add_undo (_tmp1_, (UndoItem*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = self->priv->_map;
	_tmp5_ = mind_map_get_animator (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->_nodes;
	animator_add_nodes (_tmp6_, _tmp7_, FALSE, "sort nodes");
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp8_ = FALSE;
			_tmp8_ = TRUE;
			while (TRUE) {
				GArray* _tmp10_;
				GArray* _tmp11_;
				gboolean _tmp12_;
				GArray* _tmp13_;
				GArray* _tmp14_;
				Node* _tmp15_;
				Node* _tmp16_;
				if (!_tmp8_) {
					gint _tmp9_;
					_tmp9_ = i;
					i = _tmp9_ + 1;
				}
				_tmp8_ = FALSE;
				_tmp10_ = node_children (_data42_->parent);
				_tmp11_ = _tmp10_;
				_tmp12_ = !(((guint) i) < _tmp11_->len);
				_g_array_unref0 (_tmp11_);
				if (_tmp12_) {
					break;
				}
				_tmp13_ = node_children (_data42_->parent);
				_tmp14_ = _tmp13_;
				_tmp15_ = g_array_index (_tmp14_, Node*, (guint) i);
				_tmp16_ = _g_object_ref0 (_tmp15_);
				children = g_slist_append (children, _tmp16_);
				_g_array_unref0 (_tmp14_);
			}
		}
	}
	_tmp17_ = children;
	g_slist_foreach (_tmp17_, ___lambda110__gfunc, self);
	children = g_slist_sort (children, sort_fn);
	_tmp18_ = children;
	g_slist_foreach (_tmp18_, ___lambda111__gfunc, _data42_);
	_tmp19_ = self->priv->_map;
	_tmp20_ = mind_map_get_animator (_tmp19_);
	_tmp21_ = _tmp20_;
	animator_animate (_tmp21_);
	map_model_auto_save (self);
	(children == NULL) ? NULL : (children = (_g_slist_free__g_object_unref0_ (children), NULL));
	block42_data_unref (_data42_);
	_data42_ = NULL;
}

static gint
__lambda109_ (Node* a,
              Node* b)
{
	GCompareFunc _tmp0_;
	CanvasText* _tmp1_;
	CanvasText* _tmp2_;
	FormattedText* _tmp3_;
	FormattedText* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	CanvasText* _tmp7_;
	CanvasText* _tmp8_;
	FormattedText* _tmp9_;
	FormattedText* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = ((GCompareFunc) g_strcmp0);
	_tmp1_ = node_get_name (a);
	_tmp2_ = _tmp1_;
	_tmp3_ = canvas_text_get_text (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = formatted_text_get_text (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = node_get_name (b);
	_tmp8_ = _tmp7_;
	_tmp9_ = canvas_text_get_text (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = formatted_text_get_text (_tmp10_);
	_tmp12_ = _tmp11_;
	result = _tmp0_ (_tmp6_, _tmp12_);
	return result;
}

static gint
___lambda109__gcompare_func (gconstpointer a,
                             gconstpointer b)
{
	gint result;
	result = __lambda109_ ((Node*) a, (Node*) b);
	return result;
}

void
map_model_sort_alphabetically (MapModel* self)
{
	GCompareFunc sort_fn = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	g_return_if_fail (self != NULL);
	sort_fn = ___lambda109__gcompare_func;
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	_tmp4_ = _tmp3_;
	map_model_sort_children (self, _tmp4_, sort_fn);
	_g_object_unref0 (_tmp4_);
}

static gint
__lambda112_ (Node* a,
              Node* b)
{
	gint _tmp0_ = 0;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	if (g_random_int_range ((gint32) 0, (gint32) 2) == ((gint32) 0)) {
		_tmp0_ = -1;
	} else {
		_tmp0_ = 1;
	}
	result = _tmp0_;
	return result;
}

static gint
___lambda112__gcompare_func (gconstpointer a,
                             gconstpointer b)
{
	gint result;
	result = __lambda112_ ((Node*) a, (Node*) b);
	return result;
}

void
map_model_sort_randomly (MapModel* self)
{
	GCompareFunc sort_fn = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	Node* _tmp4_;
	g_return_if_fail (self != NULL);
	sort_fn = ___lambda112__gcompare_func;
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	_tmp4_ = _tmp3_;
	map_model_sort_children (self, _tmp4_, sort_fn);
	_g_object_unref0 (_tmp4_);
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

void
map_model_handle_tree_overlap (MapModel* self,
                               NodeBounds* prev)
{
	Node* current = NULL;
	MindMap* _tmp0_;
	Selection* _tmp1_;
	Selection* _tmp2_;
	Node* _tmp3_;
	GList* visited = NULL;
	Node* _tmp4_;
	Node* _tmp5_;
	Node* _tmp6_;
	Node* _tmp7_;
	GList* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (prev != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_selected (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = selection_current_node (_tmp2_);
	current = _tmp3_;
	visited = NULL;
	_tmp4_ = current;
	if (_tmp4_ == NULL) {
		(visited == NULL) ? NULL : (visited = (_g_list_free__g_object_unref0_ (visited), NULL));
		_g_object_unref0 (current);
		return;
	}
	_tmp5_ = current;
	_tmp6_ = node_get_root (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = visited;
	map_model_handle_tree_overlap_helper (self, _tmp7_, prev, _tmp8_);
	_g_object_unref0 (_tmp7_);
	(visited == NULL) ? NULL : (visited = (_g_list_free__g_object_unref0_ (visited), NULL));
	_g_object_unref0 (current);
}

void
map_model_handle_tree_overlap_helper (MapModel* self,
                                      Node* root,
                                      NodeBounds* prev,
                                      GList* visited)
{
	NodeBounds* curr = NULL;
	NodeBounds* _tmp0_;
	NodeBounds* _tmp1_;
	NodeBounds* _tmp2_;
	gdouble ldiff = 0.0;
	NodeBounds* _tmp3_;
	gdouble _tmp4_;
	gdouble _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	gdouble rdiff = 0.0;
	NodeBounds* _tmp8_;
	gdouble _tmp9_;
	gdouble _tmp10_;
	NodeBounds* _tmp11_;
	gdouble _tmp12_;
	gdouble _tmp13_;
	gdouble _tmp14_;
	gdouble _tmp15_;
	gdouble _tmp16_;
	gdouble _tmp17_;
	gdouble adiff = 0.0;
	NodeBounds* _tmp18_;
	gdouble _tmp19_;
	gdouble _tmp20_;
	gdouble _tmp21_;
	gdouble _tmp22_;
	gdouble bdiff = 0.0;
	NodeBounds* _tmp23_;
	gdouble _tmp24_;
	gdouble _tmp25_;
	NodeBounds* _tmp26_;
	gdouble _tmp27_;
	gdouble _tmp28_;
	gdouble _tmp29_;
	gdouble _tmp30_;
	gdouble _tmp31_;
	gdouble _tmp32_;
	Node* _tmp33_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (root != NULL);
	g_return_if_fail (prev != NULL);
	_tmp0_ = node_get_tree_bbox (root);
	_tmp1_ = _tmp0_;
	_tmp2_ = _node_bounds_ref0 (_tmp1_);
	curr = _tmp2_;
	_tmp3_ = curr;
	_tmp4_ = node_bounds_get_x (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = node_bounds_get_x (prev);
	_tmp7_ = _tmp6_;
	ldiff = _tmp5_ - _tmp7_;
	_tmp8_ = curr;
	_tmp9_ = node_bounds_get_x (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = curr;
	_tmp12_ = node_bounds_get_width (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = node_bounds_get_x (prev);
	_tmp15_ = _tmp14_;
	_tmp16_ = node_bounds_get_width (prev);
	_tmp17_ = _tmp16_;
	rdiff = (_tmp10_ + _tmp13_) - (_tmp15_ + _tmp17_);
	_tmp18_ = curr;
	_tmp19_ = node_bounds_get_y (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = node_bounds_get_y (prev);
	_tmp22_ = _tmp21_;
	adiff = _tmp20_ - _tmp22_;
	_tmp23_ = curr;
	_tmp24_ = node_bounds_get_y (_tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = curr;
	_tmp27_ = node_bounds_get_height (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = node_bounds_get_y (prev);
	_tmp30_ = _tmp29_;
	_tmp31_ = node_bounds_get_height (prev);
	_tmp32_ = _tmp31_;
	bdiff = (_tmp25_ + _tmp28_) - (_tmp30_ + _tmp32_);
	_tmp33_ = _g_object_ref0 (root);
	visited = g_list_append (visited, _tmp33_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp34_ = FALSE;
			_tmp34_ = TRUE;
			while (TRUE) {
				GArray* _tmp36_;
				Node* node = NULL;
				GArray* _tmp37_;
				Node* _tmp38_;
				Node* _tmp39_;
				gboolean _tmp40_ = FALSE;
				Node* _tmp41_;
				GList* _tmp42_;
				if (!_tmp34_) {
					gint _tmp35_;
					_tmp35_ = i;
					i = _tmp35_ + 1;
				}
				_tmp34_ = FALSE;
				_tmp36_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp36_->len)) {
					break;
				}
				_tmp37_ = self->priv->_nodes;
				_tmp38_ = g_array_index (_tmp37_, Node*, (guint) i);
				_tmp39_ = _g_object_ref0 (_tmp38_);
				node = _tmp39_;
				_tmp41_ = node;
				_tmp42_ = g_list_find (visited, _tmp41_);
				if (g_list_length (_tmp42_) == ((guint) 0)) {
					NodeBounds* _tmp43_;
					Node* _tmp44_;
					NodeBounds* _tmp45_;
					NodeBounds* _tmp46_;
					_tmp43_ = curr;
					_tmp44_ = node;
					_tmp45_ = node_get_tree_bbox (_tmp44_);
					_tmp46_ = _tmp45_;
					_tmp40_ = node_bounds_overlaps (_tmp43_, _tmp46_);
				} else {
					_tmp40_ = FALSE;
				}
				if (_tmp40_) {
					NodeBounds* node_prev = NULL;
					Node* _tmp47_;
					NodeBounds* _tmp48_;
					NodeBounds* _tmp49_;
					NodeBounds* _tmp50_;
					Node* _tmp51_;
					Node* _tmp56_;
					Node* _tmp61_;
					Node* _tmp66_;
					Node* _tmp71_;
					NodeBounds* _tmp72_;
					_tmp47_ = node;
					_tmp48_ = node_get_tree_bbox (_tmp47_);
					_tmp49_ = _tmp48_;
					_tmp50_ = node_bounds_new_copy (_tmp49_);
					node_prev = _tmp50_;
					_tmp51_ = node;
					if (node_is_left_of (_tmp51_, prev)) {
						Node* _tmp52_;
						Node* _tmp53_;
						gdouble _tmp54_;
						gdouble _tmp55_;
						_tmp52_ = node;
						_tmp53_ = node;
						_tmp54_ = node_get_posx (_tmp53_);
						_tmp55_ = _tmp54_;
						node_set_posx (_tmp53_, _tmp55_ + ldiff);
					}
					_tmp56_ = node;
					if (node_is_right_of (_tmp56_, prev)) {
						Node* _tmp57_;
						Node* _tmp58_;
						gdouble _tmp59_;
						gdouble _tmp60_;
						_tmp57_ = node;
						_tmp58_ = node;
						_tmp59_ = node_get_posx (_tmp58_);
						_tmp60_ = _tmp59_;
						node_set_posx (_tmp58_, _tmp60_ + rdiff);
					}
					_tmp61_ = node;
					if (node_is_above (_tmp61_, prev)) {
						Node* _tmp62_;
						Node* _tmp63_;
						gdouble _tmp64_;
						gdouble _tmp65_;
						_tmp62_ = node;
						_tmp63_ = node;
						_tmp64_ = node_get_posy (_tmp63_);
						_tmp65_ = _tmp64_;
						node_set_posy (_tmp63_, _tmp65_ + adiff);
					}
					_tmp66_ = node;
					if (node_is_below (_tmp66_, prev)) {
						Node* _tmp67_;
						Node* _tmp68_;
						gdouble _tmp69_;
						gdouble _tmp70_;
						_tmp67_ = node;
						_tmp68_ = node;
						_tmp69_ = node_get_posy (_tmp68_);
						_tmp70_ = _tmp69_;
						node_set_posy (_tmp68_, _tmp70_ + bdiff);
					}
					_tmp71_ = node;
					_tmp72_ = node_prev;
					map_model_handle_tree_overlap_helper (self, _tmp71_, _tmp72_, visited);
					_node_bounds_unref0 (node_prev);
				}
				_g_object_unref0 (node);
			}
		}
	}
	_node_bounds_unref0 (curr);
}

Node*
map_model_get_droppable_node (MapModel* self,
                              gdouble x,
                              gdouble y)
{
	Node* result;
	g_return_val_if_fail (self != NULL, NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GArray* _tmp2_;
				Node* node = NULL;
				GArray* _tmp3_;
				Node* _tmp4_;
				Node* _tmp5_;
				Node* _tmp6_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->_nodes;
				if (!(((guint) i) < _tmp2_->len)) {
					break;
				}
				_tmp3_ = self->priv->_nodes;
				_tmp4_ = g_array_index (_tmp3_, Node*, (guint) i);
				_tmp5_ = node_contains (_tmp4_, x, y, TRUE);
				node = _tmp5_;
				_tmp6_ = node;
				if (_tmp6_ != NULL) {
					result = node;
					return result;
				}
				_g_object_unref0 (node);
			}
		}
	}
	result = NULL;
	return result;
}

void
map_model_get_droppable (MapModel* self,
                         gdouble x,
                         gdouble y,
                         Node** node,
                         Connection** conn,
                         Sticker** sticker)
{
	Node* _vala_node = NULL;
	Connection* _vala_conn = NULL;
	Sticker* _vala_sticker = NULL;
	Node* _tmp0_;
	Node* _tmp1_;
	Connections* _tmp2_;
	Connection* _tmp3_;
	Connection* _tmp4_;
	Connections* _tmp5_;
	Connection* _tmp6_;
	Connection* _tmp7_;
	Stickers* _tmp8_;
	Sticker* _tmp9_;
	g_return_if_fail (self != NULL);
	_g_object_unref0 (_vala_conn);
	_vala_conn = NULL;
	_g_object_unref0 (_vala_sticker);
	_vala_sticker = NULL;
	_tmp0_ = map_model_get_droppable_node (self, x, y);
	_g_object_unref0 (_vala_node);
	_vala_node = _tmp0_;
	_tmp1_ = _vala_node;
	if (_tmp1_ != NULL) {
		if (node) {
			*node = _vala_node;
		} else {
			_g_object_unref0 (_vala_node);
		}
		if (conn) {
			*conn = _vala_conn;
		} else {
			_g_object_unref0 (_vala_conn);
		}
		if (sticker) {
			*sticker = _vala_sticker;
		} else {
			_g_object_unref0 (_vala_sticker);
		}
		return;
	}
	_tmp2_ = self->priv->_connections;
	_tmp3_ = connections_within_title_box (_tmp2_, x, y);
	_g_object_unref0 (_vala_conn);
	_vala_conn = _tmp3_;
	_tmp4_ = _vala_conn;
	if (_tmp4_ != NULL) {
		if (node) {
			*node = _vala_node;
		} else {
			_g_object_unref0 (_vala_node);
		}
		if (conn) {
			*conn = _vala_conn;
		} else {
			_g_object_unref0 (_vala_conn);
		}
		if (sticker) {
			*sticker = _vala_sticker;
		} else {
			_g_object_unref0 (_vala_sticker);
		}
		return;
	}
	_tmp5_ = self->priv->_connections;
	_tmp6_ = connections_on_curve (_tmp5_, x, y);
	_g_object_unref0 (_vala_conn);
	_vala_conn = _tmp6_;
	_tmp7_ = _vala_conn;
	if (_tmp7_ != NULL) {
		if (node) {
			*node = _vala_node;
		} else {
			_g_object_unref0 (_vala_node);
		}
		if (conn) {
			*conn = _vala_conn;
		} else {
			_g_object_unref0 (_vala_conn);
		}
		if (sticker) {
			*sticker = _vala_sticker;
		} else {
			_g_object_unref0 (_vala_sticker);
		}
		return;
	}
	_tmp8_ = self->priv->_stickers;
	_tmp9_ = stickers_is_within (_tmp8_, x, y);
	_g_object_unref0 (_vala_sticker);
	_vala_sticker = _tmp9_;
	if (node) {
		*node = _vala_node;
	} else {
		_g_object_unref0 (_vala_node);
	}
	if (conn) {
		*conn = _vala_conn;
	} else {
		_g_object_unref0 (_vala_conn);
	}
	if (sticker) {
		*sticker = _vala_sticker;
	} else {
		_g_object_unref0 (_vala_sticker);
	}
}

Layouts*
map_model_get_layouts (MapModel* self)
{
	Layouts* result;
	Layouts* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_layouts;
	result = _tmp0_;
	return result;
}

void
map_model_set_layouts (MapModel* self,
                       Layouts* value)
{
	Layouts* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_layouts);
	self->priv->_layouts = _tmp0_;
}

ImageManager*
map_model_get_image_manager (MapModel* self)
{
	ImageManager* result;
	ImageManager* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_image_manager;
	result = _tmp0_;
	return result;
}

static gpointer
_image_manager_ref0 (gpointer self)
{
	return self ? image_manager_ref (self) : NULL;
}

void
map_model_set_image_manager (MapModel* self,
                             ImageManager* value)
{
	ImageManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _image_manager_ref0 (value);
	_image_manager_unref0 (self->priv->_image_manager);
	self->priv->_image_manager = _tmp0_;
}

gboolean
map_model_get_is_loaded (MapModel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_loaded;
	return result;
}

static void
map_model_set_is_loaded (MapModel* self,
                         gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_is_loaded = value;
}

gboolean
map_model_get_braindump_shown (MapModel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_braindump_shown;
	return result;
}

void
map_model_set_braindump_shown (MapModel* self,
                               gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_braindump_shown = value;
}

MindMap*
map_model_get_map (MapModel* self)
{
	MindMap* result;
	MindMap* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_map;
	result = _tmp0_;
	return result;
}

Connections*
map_model_get_connections (MapModel* self)
{
	Connections* result;
	Connections* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_connections;
	result = _tmp0_;
	return result;
}

Stickers*
map_model_get_stickers (MapModel* self)
{
	Stickers* result;
	Stickers* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stickers;
	result = _tmp0_;
	return result;
}

NodeGroups*
map_model_get_groups (MapModel* self)
{
	NodeGroups* result;
	NodeGroups* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_groups;
	result = _tmp0_;
	return result;
}

NodeLinks*
map_model_get_node_links (MapModel* self)
{
	NodeLinks* result;
	NodeLinks* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_node_links;
	result = _tmp0_;
	return result;
}

gint
map_model_get_next_node_id (MapModel* self)
{
	gint result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_next_node_id;
	self->priv->_next_node_id = _tmp0_ + 1;
	result = self->priv->_next_node_id;
	return result;
}

void
map_model_set_next_node_id (MapModel* self,
                            gint value)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_is_loaded;
	if (!_tmp1_) {
		_tmp0_ = self->priv->_next_node_id < value;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		self->priv->_next_node_id = value;
	}
}

gboolean
map_model_get_hide_callouts (MapModel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_hide_callouts;
	return result;
}

void
map_model_set_hide_callouts (MapModel* self,
                             gboolean value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_hide_callouts != value) {
		MindMap* _tmp0_;
		MindMap* _tmp9_;
		Animator* _tmp10_;
		Animator* _tmp11_;
		GArray* _tmp12_;
		MindMap* _tmp13_;
		Animator* _tmp14_;
		Animator* _tmp15_;
		_tmp0_ = self->priv->_map;
		if (mind_map_is_callout_editable (_tmp0_)) {
			MindMap* _tmp1_;
			Selection* _tmp2_;
			Selection* _tmp3_;
			Callout* _tmp4_;
			Callout* _tmp5_;
			MindMap* _tmp6_;
			Selection* _tmp7_;
			Selection* _tmp8_;
			_tmp1_ = self->priv->_map;
			_tmp2_ = mind_map_get_selected (_tmp1_);
			_tmp3_ = _tmp2_;
			_tmp4_ = selection_current_callout (_tmp3_);
			_tmp5_ = _tmp4_;
			map_model_set_callout_mode (self, _tmp5_, CALLOUT_MODE_NONE, TRUE);
			_g_object_unref0 (_tmp5_);
			_tmp6_ = self->priv->_map;
			_tmp7_ = mind_map_get_selected (_tmp6_);
			_tmp8_ = _tmp7_;
			selection_clear_callouts (_tmp8_, FALSE, 1.0);
		}
		_tmp9_ = self->priv->_map;
		_tmp10_ = mind_map_get_animator (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = self->priv->_nodes;
		animator_add_callouts_fade (_tmp11_, _tmp12_, value, "hide callouts");
		self->priv->_hide_callouts = value;
		map_model_auto_save (self);
		_tmp13_ = self->priv->_map;
		_tmp14_ = mind_map_get_animator (_tmp13_);
		_tmp15_ = _tmp14_;
		animator_animate (_tmp15_);
	}
}

Node*
map_model_get_attach_node (MapModel* self)
{
	Node* result;
	Node* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_attach_node;
	result = _tmp0_;
	return result;
}

SummaryNode*
map_model_get_attach_summary (MapModel* self)
{
	SummaryNode* result;
	SummaryNode* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_attach_summary;
	result = _tmp0_;
	return result;
}

Connection*
map_model_get_attach_conn (MapModel* self)
{
	Connection* result;
	Connection* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_attach_conn;
	result = _tmp0_;
	return result;
}

Sticker*
map_model_get_attach_sticker (MapModel* self)
{
	Sticker* result;
	Sticker* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_attach_sticker;
	result = _tmp0_;
	return result;
}

GArray*
map_model_get_braindump (MapModel* self)
{
	GArray* result;
	GArray* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_braindump;
	result = _tmp0_;
	return result;
}

Node*
map_model_get_last_node (MapModel* self)
{
	Node* result;
	Node* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_last_node;
	result = _tmp0_;
	return result;
}

void
map_model_set_last_node (MapModel* self,
                         Node* value)
{
	Node* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_last_node);
	self->priv->_last_node = _tmp0_;
}

Tags*
map_model_get_tags (MapModel* self)
{
	Tags* result;
	Tags* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tags;
	result = _tmp0_;
	return result;
}

static void
g_cclosure_user_marshal_VOID__BOOLEAN_DOUBLE_DOUBLE (GClosure * closure,
                                                     GValue * return_value,
                                                     guint n_param_values,
                                                     const GValue * param_values,
                                                     gpointer invocation_hint,
                                                     gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__BOOLEAN_DOUBLE_DOUBLE) (gpointer data1, gboolean arg_1, gdouble arg_2, gdouble arg_3, gpointer data2);
	register GMarshalFunc_VOID__BOOLEAN_DOUBLE_DOUBLE callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__BOOLEAN_DOUBLE_DOUBLE) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_boolean (param_values + 1), g_value_get_double (param_values + 2), g_value_get_double (param_values + 3), data2);
}

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

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

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

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

static gchar*
value_map_model_collect_value (GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		MapModel * 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 = map_model_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_map_model_lcopy_value (const GValue* value,
                             guint n_collect_values,
                             GTypeCValue* collect_values,
                             guint collect_flags)
{
	MapModel ** 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 = map_model_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_map_model (const gchar* name,
                      const gchar* nick,
                      const gchar* blurb,
                      GType object_type,
                      GParamFlags flags)
{
	ParamSpecMapModel* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAP_MODEL), 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_map_model (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP_MODEL), NULL);
	return value->data[0].v_pointer;
}

void
value_set_map_model (GValue* value,
                     gpointer v_object)
{
	MapModel * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP_MODEL));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAP_MODEL));
		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;
		map_model_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		map_model_unref (old);
	}
}

void
value_take_map_model (GValue* value,
                      gpointer v_object)
{
	MapModel * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAP_MODEL));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAP_MODEL));
		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) {
		map_model_unref (old);
	}
}

static void
map_model_class_init (MapModelClass * klass,
                      gpointer klass_data)
{
	map_model_parent_class = g_type_class_peek_parent (klass);
	((MapModelClass *) klass)->finalize = map_model_finalize;
	g_type_class_adjust_private_offset (klass, &MapModel_private_offset);
	map_model_signals[MAP_MODEL_CHANGED_SIGNAL] = g_signal_new ("changed", TYPE_MAP_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	map_model_signals[MAP_MODEL_CURRENT_CHANGED_SIGNAL] = g_signal_new ("current-changed", TYPE_MAP_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	map_model_signals[MAP_MODEL_THEME_CHANGED_SIGNAL] = g_signal_new ("theme-changed", TYPE_MAP_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	map_model_signals[MAP_MODEL_LOADED_SIGNAL] = g_signal_new ("loaded", TYPE_MAP_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	map_model_signals[MAP_MODEL_QUEUE_DRAW_SIGNAL] = g_signal_new ("queue-draw", TYPE_MAP_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	map_model_signals[MAP_MODEL_SEE_SIGNAL] = g_signal_new ("see", TYPE_MAP_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOOLEAN_DOUBLE_DOUBLE, G_TYPE_NONE, 3, G_TYPE_BOOLEAN, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
}

static void
map_model_instance_init (MapModel * self,
                         gpointer klass)
{
	Layouts* _tmp0_;
	ImageManager* _tmp1_;
	self->priv = map_model_get_instance_private (self);
	self->priv->_last_node = NULL;
	self->priv->_last_match = NULL;
	self->priv->_attach_node = NULL;
	self->priv->_attach_summary = NULL;
	self->priv->_attach_conn = NULL;
	self->priv->_attach_sticker = NULL;
	self->priv->_auto_save_id = NULL;
	self->priv->_debug = TRUE;
	self->priv->_next_node_id = -1;
	self->priv->_hide_callouts = FALSE;
	self->priv->_modifiable = TRUE;
	_tmp0_ = layouts_new ();
	self->priv->_layouts = _tmp0_;
	_tmp1_ = image_manager_new ();
	self->priv->_image_manager = _tmp1_;
	self->priv->_is_loaded = FALSE;
	self->priv->_braindump_shown = FALSE;
	self->ref_count = 1;
}

static void
map_model_finalize (MapModel * obj)
{
	MapModel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAP_MODEL, MapModel);
	g_signal_handlers_destroy (self);
	_mind_map_unref0 (self->priv->_map);
	_g_object_unref0 (self->priv->_last_node);
	_g_array_unref0 (self->priv->_nodes);
	_connections_unref0 (self->priv->_connections);
	_stickers_unref0 (self->priv->_stickers);
	_g_object_unref0 (self->priv->_theme);
	_g_object_unref0 (self->priv->_last_match);
	_g_object_unref0 (self->priv->_attach_node);
	_g_object_unref0 (self->priv->_attach_summary);
	_g_object_unref0 (self->priv->_attach_conn);
	_g_object_unref0 (self->priv->_attach_sticker);
	_g_free0 (self->priv->_auto_save_id);
	_node_groups_unref0 (self->priv->_groups);
	_node_links_unref0 (self->priv->_node_links);
	_g_array_unref0 (self->priv->_braindump);
	_tags_unref0 (self->priv->_tags);
	_g_object_unref0 (self->priv->_layouts);
	_image_manager_unref0 (self->priv->_image_manager);
}

static GType
map_model_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_map_model_init, value_map_model_free_value, value_map_model_copy_value, value_map_model_peek_pointer, "p", value_map_model_collect_value, "p", value_map_model_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (MapModelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) map_model_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MapModel), 0, (GInstanceInitFunc) map_model_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 map_model_type_id;
	map_model_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MapModel", &g_define_type_info, &g_define_type_fundamental_info, 0);
	MapModel_private_offset = g_type_add_instance_private (map_model_type_id, sizeof (MapModelPrivate));
	return map_model_type_id;
}

GType
map_model_get_type (void)
{
	static volatile gsize map_model_type_id__once = 0;
	if (g_once_init_enter (&map_model_type_id__once)) {
		GType map_model_type_id;
		map_model_type_id = map_model_get_type_once ();
		g_once_init_leave (&map_model_type_id__once, map_model_type_id);
	}
	return map_model_type_id__once;
}

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

void
map_model_unref (gpointer instance)
{
	MapModel * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MAP_MODEL_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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

