/* GroupInspector.c generated by valac 0.56.19, the Vala compiler
 * generated from GroupInspector.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 <gtk/gtk.h>
#include <glib-object.h>
#include <gtksourceview/gtksource.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.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

#define TYPE_GROUP_INSPECTOR (group_inspector_get_type ())
#define GROUP_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GROUP_INSPECTOR, GroupInspector))
#define GROUP_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GROUP_INSPECTOR, GroupInspectorClass))
#define IS_GROUP_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GROUP_INSPECTOR))
#define IS_GROUP_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GROUP_INSPECTOR))
#define GROUP_INSPECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GROUP_INSPECTOR, GroupInspectorClass))

typedef struct _GroupInspector GroupInspector;
typedef struct _GroupInspectorClass GroupInspectorClass;
typedef struct _GroupInspectorPrivate GroupInspectorPrivate;

#define TYPE_NOTE_VIEW (note_view_get_type ())
#define NOTE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_NOTE_VIEW, NoteView))
#define NOTE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_NOTE_VIEW, NoteViewClass))
#define IS_NOTE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_NOTE_VIEW))
#define IS_NOTE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_NOTE_VIEW))
#define NOTE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_NOTE_VIEW, NoteViewClass))

typedef struct _NoteView NoteView;
typedef struct _NoteViewClass NoteViewClass;

#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_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;
enum  {
	GROUP_INSPECTOR_0_PROPERTY,
	GROUP_INSPECTOR_NOTE_PROPERTY,
	GROUP_INSPECTOR_NUM_PROPERTIES
};
static GParamSpec* group_inspector_properties[GROUP_INSPECTOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _mind_map_unref0(var) ((var == NULL) ? NULL : (var = (mind_map_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (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_UNICODE_INSERT (unicode_insert_get_type ())
#define UNICODE_INSERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNICODE_INSERT, UnicodeInsert))
#define UNICODE_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNICODE_INSERT, UnicodeInsertClass))
#define IS_UNICODE_INSERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNICODE_INSERT))
#define IS_UNICODE_INSERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNICODE_INSERT))
#define UNICODE_INSERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNICODE_INSERT, UnicodeInsertClass))

typedef struct _UnicodeInsert UnicodeInsert;
typedef struct _UnicodeInsertClass UnicodeInsertClass;

#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 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_GROUP_NOTE (undo_group_note_get_type ())
#define UNDO_GROUP_NOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UNDO_GROUP_NOTE, UndoGroupNote))
#define UNDO_GROUP_NOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UNDO_GROUP_NOTE, UndoGroupNoteClass))
#define IS_UNDO_GROUP_NOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UNDO_GROUP_NOTE))
#define IS_UNDO_GROUP_NOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UNDO_GROUP_NOTE))
#define UNDO_GROUP_NOTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UNDO_GROUP_NOTE, UndoGroupNoteClass))

typedef struct _UndoGroupNote UndoGroupNote;
typedef struct _UndoGroupNoteClass UndoGroupNoteClass;

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

#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 _node_link_unref0(var) ((var == NULL) ? NULL : (var = (node_link_unref (var), NULL)))
enum  {
	GROUP_INSPECTOR_EDITABLE_CHANGED_SIGNAL,
	GROUP_INSPECTOR_NUM_SIGNALS
};
static guint group_inspector_signals[GROUP_INSPECTOR_NUM_SIGNALS] = {0};

struct _GroupInspector {
	GtkBox parent_instance;
	GroupInspectorPrivate * priv;
};

struct _GroupInspectorClass {
	GtkBoxClass parent_class;
};

struct _GroupInspectorPrivate {
	GtkScrolledWindow* _sw;
	NoteView* _note;
	MindMap* _map;
	gchar* _orig_note;
	NodeGroup* _group;
};

static gint GroupInspector_private_offset;
static gpointer group_inspector_parent_class = NULL;

VALA_EXTERN GType group_inspector_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GroupInspector, g_object_unref)
VALA_EXTERN GType note_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NoteView, g_object_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_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeGroup, g_object_unref)
VALA_EXTERN GType main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MainWindow, g_object_unref)
VALA_EXTERN GroupInspector* group_inspector_new (MainWindow* win);
VALA_EXTERN GroupInspector* group_inspector_construct (GType object_type,
                                           MainWindow* win);
static void group_inspector_create_title (GroupInspector* self);
static void group_inspector_create_note (GroupInspector* self,
                                  MainWindow* win);
static void group_inspector_tab_changed (GroupInspector* self,
                                  MindMap* map);
static void _group_inspector_tab_changed_main_window_canvas_changed (MainWindow* _sender,
                                                              MindMap* map,
                                                              gpointer self);
static void group_inspector_group_changed (GroupInspector* self);
static void _group_inspector_group_changed_group_inspector_editable_changed (GroupInspector* _sender,
                                                                      gpointer self);
static void _group_inspector_group_changed_mind_map_current_changed (MindMap* _sender,
                                                              MindMap* map,
                                                              gpointer self);
VALA_EXTERN void group_inspector_set_width (GroupInspector* self,
                                gint width);
VALA_EXTERN NoteView* note_view_new (MainWindow* win);
VALA_EXTERN NoteView* note_view_construct (GType object_type,
                               MainWindow* win);
VALA_EXTERN gpointer unicode_insert_ref (gpointer instance);
VALA_EXTERN void unicode_insert_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_unicode_insert (const gchar* name,
                                       const gchar* nick,
                                       const gchar* blurb,
                                       GType object_type,
                                       GParamFlags flags);
VALA_EXTERN void value_set_unicode_insert (GValue* value,
                               gpointer v_object);
VALA_EXTERN void value_take_unicode_insert (GValue* value,
                                gpointer v_object);
VALA_EXTERN gpointer value_get_unicode_insert (const GValue* value);
VALA_EXTERN GType unicode_insert_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UnicodeInsert, unicode_insert_unref)
VALA_EXTERN void note_view_add_unicode_completion (NoteView* self,
                                       MainWindow* win,
                                       UnicodeInsert* unicoder);
VALA_EXTERN UnicodeInsert* main_window_get_unicoder (MainWindow* self);
static void group_inspector_note_focus_in (GroupInspector* self);
static void _group_inspector_note_focus_in_gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                      gpointer self);
static void group_inspector_note_focus_out (GroupInspector* self);
static void _group_inspector_note_focus_out_gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                       gpointer self);
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)
static gint group_inspector_note_node_link_added (GroupInspector* self,
                                           NodeLink* link,
                                           gchar** text);
static gint _group_inspector_note_node_link_added_note_view_node_link_added (NoteView* _sender,
                                                                      NodeLink* link,
                                                                      gchar** text,
                                                                      gpointer self);
static void group_inspector_note_node_link_clicked (GroupInspector* self,
                                             gint id);
static void _group_inspector_note_node_link_clicked_note_view_node_link_clicked (NoteView* _sender,
                                                                          gint id,
                                                                          gpointer self);
static void group_inspector_note_node_link_hover (GroupInspector* self,
                                           gint id);
static void _group_inspector_note_node_link_hover_note_view_node_link_hover (NoteView* _sender,
                                                                      gint id,
                                                                      gpointer self);
VALA_EXTERN NodeGroup* mind_map_get_current_group (MindMap* self);
VALA_EXTERN void mind_map_unedit_text (MindMap* self);
VALA_EXTERN void node_group_set_note (NodeGroup* self,
                          const gchar* value);
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 UndoGroupNote* undo_group_note_new (NodeGroup* g,
                                    const gchar* old_note);
VALA_EXTERN UndoGroupNote* undo_group_note_construct (GType object_type,
                                          NodeGroup* g,
                                          const gchar* old_note);
VALA_EXTERN GType undo_group_note_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoGroupNote, g_object_unref)
VALA_EXTERN void mind_map_auto_save (MindMap* 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 MapModel* mind_map_get_model (MindMap* self);
VALA_EXTERN gint map_model_add_note_node_link (MapModel* self,
                                   NodeLink* link,
                                   gchar** text);
VALA_EXTERN void map_model_note_node_link_clicked (MapModel* self,
                                       gint id);
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 NodeLinks* map_model_get_node_links (MapModel* self);
VALA_EXTERN NodeLink* node_links_get_node_link (NodeLinks* self,
                                    gint id);
VALA_EXTERN void note_view_show_tooltip (NoteView* self,
                             const gchar* tooltip);
VALA_EXTERN gchar* node_link_get_tooltip (NodeLink* self,
                              MindMap* map);
VALA_EXTERN void group_inspector_grab_note (GroupInspector* self);
VALA_EXTERN const gchar* node_group_get_note (NodeGroup* self);
VALA_EXTERN gboolean mind_map_get_editable (MindMap* self);
VALA_EXTERN void group_inspector_grab_first (GroupInspector* self);
VALA_EXTERN NoteView* group_inspector_get_note (GroupInspector* self);
static void group_inspector_finalize (GObject * obj);
static GType group_inspector_get_type_once (void);
static void _vala_group_inspector_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
group_inspector_get_instance_private (GroupInspector* self)
{
	return G_STRUCT_MEMBER_P (self, GroupInspector_private_offset);
}

static void
_group_inspector_tab_changed_main_window_canvas_changed (MainWindow* _sender,
                                                         MindMap* map,
                                                         gpointer self)
{
	group_inspector_tab_changed ((GroupInspector*) self, map);
}

static void
_group_inspector_group_changed_group_inspector_editable_changed (GroupInspector* _sender,
                                                                 gpointer self)
{
	group_inspector_group_changed ((GroupInspector*) self);
}

GroupInspector*
group_inspector_construct (GType object_type,
                           MainWindow* win)
{
	GroupInspector * self = NULL;
	g_return_val_if_fail (win != NULL, NULL);
	self = (GroupInspector*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 10, NULL);
	group_inspector_create_title (self);
	group_inspector_create_note (self, win);
	g_signal_connect_object (win, "canvas-changed", (GCallback) _group_inspector_tab_changed_main_window_canvas_changed, self, 0);
	g_signal_connect_object (self, "editable-changed", (GCallback) _group_inspector_group_changed_group_inspector_editable_changed, self, 0);
	return self;
}

GroupInspector*
group_inspector_new (MainWindow* win)
{
	return group_inspector_construct (TYPE_GROUP_INSPECTOR, win);
}

static void
_group_inspector_group_changed_mind_map_current_changed (MindMap* _sender,
                                                         MindMap* map,
                                                         gpointer self)
{
	group_inspector_group_changed ((GroupInspector*) self);
}

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

static void
group_inspector_tab_changed (GroupInspector* self,
                             MindMap* map)
{
	MindMap* _tmp0_;
	MindMap* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	if (_tmp0_ != NULL) {
		MindMap* _tmp1_;
		guint _tmp2_;
		_tmp1_ = self->priv->_map;
		g_signal_parse_name ("current-changed", TYPE_MIND_MAP, &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _group_inspector_group_changed_mind_map_current_changed, self);
	}
	_tmp3_ = _mind_map_ref0 (map);
	_mind_map_unref0 (self->priv->_map);
	self->priv->_map = _tmp3_;
	if (map != NULL) {
		g_signal_connect_object (map, "current-changed", (GCallback) _group_inspector_group_changed_mind_map_current_changed, self, 0);
	}
}

void
group_inspector_set_width (GroupInspector* self,
                           gint width)
{
	GtkScrolledWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_sw;
	g_object_set ((GtkWidget*) _tmp0_, "width-request", width, NULL);
}

static void
group_inspector_create_title (GroupInspector* self)
{
	GtkLabel* title = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GtkLabel* _tmp4_ = NULL;
	GtkLabel* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strconcat ("<big>", _ ("Group"), NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat (_tmp1_, "</big>", NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = (GtkLabel*) gtk_label_new (_tmp3_);
	gtk_label_set_use_markup (_tmp4_, TRUE);
	gtk_label_set_justify (_tmp4_, GTK_JUSTIFY_CENTER);
	g_object_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	title = _tmp5_;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) title);
	_g_object_unref0 (title);
}

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

static void
_group_inspector_note_focus_in_gtk_event_controller_focus_enter (GtkEventControllerFocus* _sender,
                                                                 gpointer self)
{
	group_inspector_note_focus_in ((GroupInspector*) self);
}

static void
_group_inspector_note_focus_out_gtk_event_controller_focus_leave (GtkEventControllerFocus* _sender,
                                                                  gpointer self)
{
	group_inspector_note_focus_out ((GroupInspector*) self);
}

static gint
_group_inspector_note_node_link_added_note_view_node_link_added (NoteView* _sender,
                                                                 NodeLink* link,
                                                                 gchar** text,
                                                                 gpointer self)
{
	gint result;
	result = group_inspector_note_node_link_added ((GroupInspector*) self, link, text);
	return result;
}

static void
_group_inspector_note_node_link_clicked_note_view_node_link_clicked (NoteView* _sender,
                                                                     gint id,
                                                                     gpointer self)
{
	group_inspector_note_node_link_clicked ((GroupInspector*) self, id);
}

static void
_group_inspector_note_node_link_hover_note_view_node_link_hover (NoteView* _sender,
                                                                 gint id,
                                                                 gpointer self)
{
	group_inspector_note_node_link_hover ((GroupInspector*) self, id);
}

static void
group_inspector_create_note (GroupInspector* self,
                             MainWindow* win)
{
	GtkLabel* lbl = NULL;
	GtkLabel* _tmp0_ = NULL;
	NoteView* _tmp1_ = NULL;
	NoteView* _tmp2_;
	UnicodeInsert* _tmp3_;
	UnicodeInsert* _tmp4_;
	NoteView* _tmp5_;
	GtkTextBuffer* _tmp6_;
	GtkTextBuffer* _tmp7_;
	GtkEventControllerFocus* focus = NULL;
	GtkEventControllerFocus* _tmp8_;
	NoteView* _tmp9_;
	GtkEventController* _tmp10_;
	NoteView* _tmp11_;
	NoteView* _tmp12_;
	NoteView* _tmp13_;
	NoteView* _tmp14_;
	GtkWidget* _tmp15_;
	GtkScrolledWindow* _tmp16_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp17_ = NULL;
	GtkScrolledWindow* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (win != NULL);
	_tmp0_ = (GtkLabel*) gtk_label_new (_ ("Note"));
	gtk_label_set_xalign (_tmp0_, (gfloat) 0);
	g_object_ref_sink (_tmp0_);
	lbl = _tmp0_;
	gtk_widget_add_css_class ((GtkWidget*) lbl, "titled");
	_tmp1_ = note_view_new (win);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp1_, TRUE);
	gtk_text_view_set_wrap_mode ((GtkTextView*) _tmp1_, GTK_WRAP_WORD);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->_note);
	self->priv->_note = _tmp1_;
	_tmp2_ = self->priv->_note;
	_tmp3_ = main_window_get_unicoder (win);
	_tmp4_ = _tmp3_;
	note_view_add_unicode_completion (_tmp2_, win, _tmp4_);
	_tmp5_ = self->priv->_note;
	_tmp6_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp5_);
	_tmp7_ = _tmp6_;
	g_object_set (_tmp7_, "text", "", NULL);
	_tmp8_ = (GtkEventControllerFocus*) gtk_event_controller_focus_new ();
	focus = _tmp8_;
	_tmp9_ = self->priv->_note;
	_tmp10_ = _g_object_ref0 ((GtkEventController*) focus);
	gtk_widget_add_controller ((GtkWidget*) _tmp9_, _tmp10_);
	g_signal_connect_object (focus, "enter", (GCallback) _group_inspector_note_focus_in_gtk_event_controller_focus_enter, self, 0);
	g_signal_connect_object (focus, "leave", (GCallback) _group_inspector_note_focus_out_gtk_event_controller_focus_leave, self, 0);
	_tmp11_ = self->priv->_note;
	g_signal_connect_object (_tmp11_, "node-link-added", (GCallback) _group_inspector_note_node_link_added_note_view_node_link_added, self, 0);
	_tmp12_ = self->priv->_note;
	g_signal_connect_object (_tmp12_, "node-link-clicked", (GCallback) _group_inspector_note_node_link_clicked_note_view_node_link_clicked, self, 0);
	_tmp13_ = self->priv->_note;
	g_signal_connect_object (_tmp13_, "node-link-hover", (GCallback) _group_inspector_note_node_link_hover_note_view_node_link_hover, self, 0);
	_tmp14_ = self->priv->_note;
	_tmp15_ = _g_object_ref0 ((GtkWidget*) _tmp14_);
	_tmp16_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_min_content_width (_tmp16_, 300);
	gtk_scrolled_window_set_min_content_height (_tmp16_, 100);
	gtk_scrolled_window_set_child (_tmp16_, _tmp15_);
	_g_object_unref0 (_tmp15_);
	g_object_ref_sink (_tmp16_);
	_g_object_unref0 (self->priv->_sw);
	self->priv->_sw = _tmp16_;
	_tmp17_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp17_, 5);
	g_object_ref_sink (_tmp17_);
	box = _tmp17_;
	gtk_box_append (box, (GtkWidget*) lbl);
	_tmp18_ = self->priv->_sw;
	gtk_box_append (box, (GtkWidget*) _tmp18_);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) box);
	_g_object_unref0 (box);
	_g_object_unref0 (focus);
	_g_object_unref0 (lbl);
}

static void
group_inspector_note_focus_in (GroupInspector* self)
{
	MindMap* _tmp0_;
	NodeGroup* _tmp1_;
	NoteView* _tmp2_;
	GtkTextBuffer* _tmp3_;
	GtkTextBuffer* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	MindMap* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_group (_tmp0_);
	_g_object_unref0 (self->priv->_group);
	self->priv->_group = _tmp1_;
	_tmp2_ = self->priv->_note;
	_tmp3_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp2_);
	_tmp4_ = _tmp3_;
	g_object_get (_tmp4_, "text", &_tmp5_, NULL);
	_tmp6_ = _tmp5_;
	_g_free0 (self->priv->_orig_note);
	self->priv->_orig_note = _tmp6_;
	_tmp7_ = self->priv->_map;
	mind_map_unedit_text (_tmp7_);
}

static void
group_inspector_note_focus_out (GroupInspector* self)
{
	gboolean _tmp0_ = FALSE;
	NodeGroup* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->_group;
	if (_tmp1_ != NULL) {
		NoteView* _tmp2_;
		GtkTextBuffer* _tmp3_;
		GtkTextBuffer* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		const gchar* _tmp8_;
		_tmp2_ = self->priv->_note;
		_tmp3_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp2_);
		_tmp4_ = _tmp3_;
		g_object_get (_tmp4_, "text", &_tmp5_, NULL);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp8_ = self->priv->_orig_note;
		_tmp0_ = g_strcmp0 (_tmp7_, _tmp8_) != 0;
		_g_free0 (_tmp7_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		NodeGroup* _tmp9_;
		NoteView* _tmp10_;
		GtkTextBuffer* _tmp11_;
		GtkTextBuffer* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		MindMap* _tmp16_;
		NodeGroup* _tmp17_;
		const gchar* _tmp18_;
		UndoGroupNote* _tmp19_;
		UndoGroupNote* _tmp20_;
		MindMap* _tmp21_;
		_tmp9_ = self->priv->_group;
		_tmp10_ = self->priv->_note;
		_tmp11_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp10_);
		_tmp12_ = _tmp11_;
		g_object_get (_tmp12_, "text", &_tmp13_, NULL);
		_tmp14_ = _tmp13_;
		_tmp15_ = _tmp14_;
		node_group_set_note (_tmp9_, _tmp15_);
		_g_free0 (_tmp15_);
		_tmp16_ = self->priv->_map;
		_tmp17_ = self->priv->_group;
		_tmp18_ = self->priv->_orig_note;
		_tmp19_ = undo_group_note_new (_tmp17_, _tmp18_);
		_tmp20_ = _tmp19_;
		mind_map_add_undo (_tmp16_, (UndoItem*) _tmp20_);
		_g_object_unref0 (_tmp20_);
		_tmp21_ = self->priv->_map;
		mind_map_auto_save (_tmp21_);
	}
}

static gint
group_inspector_note_node_link_added (GroupInspector* self,
                                      NodeLink* link,
                                      gchar** text)
{
	gchar* _vala_text = NULL;
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	gchar* _tmp3_ = NULL;
	gint _tmp4_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (link != NULL, -1);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp4_ = map_model_add_note_node_link (_tmp2_, link, &_tmp3_);
	_g_free0 (_vala_text);
	_vala_text = _tmp3_;
	result = _tmp4_;
	if (text) {
		*text = _vala_text;
	} else {
		_g_free0 (_vala_text);
	}
	return result;
}

static void
group_inspector_note_node_link_clicked (GroupInspector* self,
                                        gint id)
{
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	map_model_note_node_link_clicked (_tmp2_, id);
}

static void
group_inspector_note_node_link_hover (GroupInspector* self,
                                      gint id)
{
	NodeLink* link = NULL;
	MindMap* _tmp0_;
	MapModel* _tmp1_;
	MapModel* _tmp2_;
	NodeLinks* _tmp3_;
	NodeLinks* _tmp4_;
	NodeLink* _tmp5_;
	NodeLink* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_model (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = map_model_get_node_links (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = node_links_get_node_link (_tmp4_, id);
	link = _tmp5_;
	_tmp6_ = link;
	if (_tmp6_ != NULL) {
		NoteView* _tmp7_;
		NodeLink* _tmp8_;
		MindMap* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp7_ = self->priv->_note;
		_tmp8_ = link;
		_tmp9_ = self->priv->_map;
		_tmp10_ = node_link_get_tooltip (_tmp8_, _tmp9_);
		_tmp11_ = _tmp10_;
		note_view_show_tooltip (_tmp7_, _tmp11_);
		_g_free0 (_tmp11_);
	}
	_node_link_unref0 (link);
}

void
group_inspector_grab_note (GroupInspector* self)
{
	NoteView* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_note;
	gtk_widget_grab_focus ((GtkWidget*) _tmp0_);
}

static void
group_inspector_group_changed (GroupInspector* self)
{
	NodeGroup* current = NULL;
	MindMap* _tmp0_;
	NodeGroup* _tmp1_;
	NodeGroup* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_map;
	_tmp1_ = mind_map_get_current_group (_tmp0_);
	current = _tmp1_;
	_tmp2_ = current;
	if (_tmp2_ != NULL) {
		gchar* note = NULL;
		NodeGroup* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		NoteView* _tmp7_;
		GtkTextBuffer* _tmp8_;
		GtkTextBuffer* _tmp9_;
		const gchar* _tmp10_;
		NoteView* _tmp11_;
		MindMap* _tmp12_;
		gboolean _tmp13_;
		gboolean _tmp14_;
		_tmp3_ = current;
		_tmp4_ = node_group_get_note (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strdup (_tmp5_);
		note = _tmp6_;
		_tmp7_ = self->priv->_note;
		_tmp8_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = note;
		g_object_set (_tmp9_, "text", _tmp10_, NULL);
		_tmp11_ = self->priv->_note;
		_tmp12_ = self->priv->_map;
		_tmp13_ = mind_map_get_editable (_tmp12_);
		_tmp14_ = _tmp13_;
		gtk_text_view_set_editable ((GtkTextView*) _tmp11_, _tmp14_);
		_g_free0 (note);
	}
	_g_object_unref0 (current);
}

void
group_inspector_grab_first (GroupInspector* self)
{
	g_return_if_fail (self != NULL);
	group_inspector_grab_note (self);
}

NoteView*
group_inspector_get_note (GroupInspector* self)
{
	NoteView* result;
	NoteView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_note;
	result = _tmp0_;
	return result;
}

static void
group_inspector_class_init (GroupInspectorClass * klass,
                            gpointer klass_data)
{
	group_inspector_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GroupInspector_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_group_inspector_get_property;
	G_OBJECT_CLASS (klass)->finalize = group_inspector_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GROUP_INSPECTOR_NOTE_PROPERTY, group_inspector_properties[GROUP_INSPECTOR_NOTE_PROPERTY] = g_param_spec_object ("note", "note", "note", TYPE_NOTE_VIEW, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	group_inspector_signals[GROUP_INSPECTOR_EDITABLE_CHANGED_SIGNAL] = g_signal_new ("editable-changed", TYPE_GROUP_INSPECTOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
group_inspector_instance_init (GroupInspector * self,
                               gpointer klass)
{
	gchar* _tmp0_;
	self->priv = group_inspector_get_instance_private (self);
	self->priv->_map = NULL;
	_tmp0_ = g_strdup ("");
	self->priv->_orig_note = _tmp0_;
	self->priv->_group = NULL;
}

static void
group_inspector_finalize (GObject * obj)
{
	GroupInspector * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GROUP_INSPECTOR, GroupInspector);
	_g_object_unref0 (self->priv->_sw);
	_g_object_unref0 (self->priv->_note);
	_mind_map_unref0 (self->priv->_map);
	_g_free0 (self->priv->_orig_note);
	_g_object_unref0 (self->priv->_group);
	G_OBJECT_CLASS (group_inspector_parent_class)->finalize (obj);
}

static GType
group_inspector_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GroupInspectorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) group_inspector_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GroupInspector), 0, (GInstanceInitFunc) group_inspector_instance_init, NULL };
	GType group_inspector_type_id;
	group_inspector_type_id = g_type_register_static (gtk_box_get_type (), "GroupInspector", &g_define_type_info, 0);
	GroupInspector_private_offset = g_type_add_instance_private (group_inspector_type_id, sizeof (GroupInspectorPrivate));
	return group_inspector_type_id;
}

GType
group_inspector_get_type (void)
{
	static volatile gsize group_inspector_type_id__once = 0;
	if (g_once_init_enter (&group_inspector_type_id__once)) {
		GType group_inspector_type_id;
		group_inspector_type_id = group_inspector_get_type_once ();
		g_once_init_leave (&group_inspector_type_id__once, group_inspector_type_id);
	}
	return group_inspector_type_id__once;
}

static void
_vala_group_inspector_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	GroupInspector * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_GROUP_INSPECTOR, GroupInspector);
	switch (property_id) {
		case GROUP_INSPECTOR_NOTE_PROPERTY:
		g_value_set_object (value, group_inspector_get_note (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

