/* UndoNodesCut.c generated by valac 0.56.19, the Vala compiler
 * generated from UndoNodesCut.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 <glib/gi18n-lib.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_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;
typedef struct _UndoItemPrivate UndoItemPrivate;

#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_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;
typedef struct _UndoNodesDeletePrivate UndoNodesDeletePrivate;

#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;
typedef struct _UndoNodesCutPrivate UndoNodesCutPrivate;
enum  {
	UNDO_NODES_CUT_0_PROPERTY,
	UNDO_NODES_CUT_NUM_PROPERTIES
};
static GParamSpec* undo_nodes_cut_properties[UNDO_NODES_CUT_NUM_PROPERTIES];

#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_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_UNDO_NODE_GROUPS (undo_node_groups_get_type ())
typedef struct _UndoNodeGroups UndoNodeGroups;

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

struct _UndoItem {
	GObject parent_instance;
	UndoItemPrivate * priv;
};

struct _UndoItemClass {
	GObjectClass parent_class;
	void (*undo) (UndoItem* self, MindMap* map);
	void (*redo) (UndoItem* self, MindMap* map);
	gboolean (*matches) (UndoItem* self, UndoItem* item);
	void (*replace_with_item) (UndoItem* self, UndoItem* item);
	gchar* (*to_string) (UndoItem* self);
};

struct _UndoNodesDelete {
	UndoItem parent_instance;
	UndoNodesDeletePrivate * priv;
};

struct _UndoNodesDeleteClass {
	UndoItemClass parent_class;
};

struct _UndoNodesCut {
	UndoNodesDelete parent_instance;
	UndoNodesCutPrivate * priv;
};

struct _UndoNodesCutClass {
	UndoNodesDeleteClass parent_class;
};

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

static gpointer undo_nodes_cut_parent_class = NULL;

VALA_EXTERN GType undo_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoItem, 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 undo_nodes_delete_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesDelete, g_object_unref)
VALA_EXTERN GType undo_nodes_cut_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (UndoNodesCut, g_object_unref)
VALA_EXTERN void undo_item_redo (UndoItem* self,
                     MindMap* map);
VALA_EXTERN GType node_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Node, 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 undo_node_groups_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType node_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (NodeGroup, g_object_unref)
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 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 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);
static void undo_nodes_cut_real_redo (UndoItem* base,
                               MindMap* map);
VALA_EXTERN void minder_clipboard_copy_nodes (MindMap* map);
static GType undo_nodes_cut_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

UndoNodesCut*
undo_nodes_cut_construct (GType object_type,
                          GArray* nodes,
                          GArray* conns,
                          GArray* groups)
{
	UndoNodesCut * self = 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);
	self = (UndoNodesCut*) undo_nodes_delete_construct (object_type, nodes, conns, groups, _ ("cut nodes"));
	return self;
}

UndoNodesCut*
undo_nodes_cut_new (GArray* nodes,
                    GArray* conns,
                    GArray* groups)
{
	return undo_nodes_cut_construct (TYPE_UNDO_NODES_CUT, nodes, conns, groups);
}

static void
undo_nodes_cut_real_redo (UndoItem* base,
                          MindMap* map)
{
	UndoNodesCut * self;
	self = (UndoNodesCut*) base;
	g_return_if_fail (map != NULL);
	minder_clipboard_copy_nodes (map);
	UNDO_ITEM_CLASS (undo_nodes_cut_parent_class)->redo ((UndoItem*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_UNDO_NODES_DELETE, UndoNodesDelete), map);
}

static void
undo_nodes_cut_class_init (UndoNodesCutClass * klass,
                           gpointer klass_data)
{
	undo_nodes_cut_parent_class = g_type_class_peek_parent (klass);
	((UndoItemClass *) klass)->redo = (void (*) (UndoItem*, MindMap*)) undo_nodes_cut_real_redo;
}

static void
undo_nodes_cut_instance_init (UndoNodesCut * self,
                              gpointer klass)
{
}

static GType
undo_nodes_cut_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (UndoNodesCutClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) undo_nodes_cut_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UndoNodesCut), 0, (GInstanceInitFunc) undo_nodes_cut_instance_init, NULL };
	GType undo_nodes_cut_type_id;
	undo_nodes_cut_type_id = g_type_register_static (TYPE_UNDO_NODES_DELETE, "UndoNodesCut", &g_define_type_info, 0);
	return undo_nodes_cut_type_id;
}

GType
undo_nodes_cut_get_type (void)
{
	static volatile gsize undo_nodes_cut_type_id__once = 0;
	if (g_once_init_enter (&undo_nodes_cut_type_id__once)) {
		GType undo_nodes_cut_type_id;
		undo_nodes_cut_type_id = undo_nodes_cut_get_type_once ();
		g_once_init_leave (&undo_nodes_cut_type_id__once, undo_nodes_cut_type_id);
	}
	return undo_nodes_cut_type_id__once;
}

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

