[gnumeric] new files



commit 81d3e65f74430029cad68e74fc091c22c74953d0
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Jun 25 04:11:57 2010 -0600

    new files
    
    2010-06-25  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/undo.[ch]: new

 ChangeLog  |    1 +
 src/undo.c |  144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/undo.h |   72 ++++++++++++++++++++++++++++++
 3 files changed, 217 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6f91247..d59f599 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
 	  Adjust all callers
 	(colrow_get_sizes): new
 	(colrow_index_list_copy): new
+	* src/undo.[ch]: new
 
 2010-06-24  Andreas J. Guelzow <aguelzow pyrshep ca>
 
diff --git a/src/undo.c b/src/undo.c
new file mode 100644
index 0000000..9228fd5
--- /dev/null
+++ b/src/undo.c
@@ -0,0 +1,144 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * undo.c:
+ *
+ * Authors:
+  *  Andreas J. Guelzow  <aguelzow pyrshep ca>
+ *
+ * (C) Copyright 2010 by Andreas J. Guelzow  <aguelzow pyrshep ca>
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "undo.h"
+#include <gsf/gsf-impl-utils.h>
+
+/* ------------------------------------------------------------------------- */
+
+static GObjectClass *gnm_undo_colrow_restore_state_group_parent_class;
+
+static void
+gnm_undo_colrow_restore_state_group_finalize (GObject *o)
+{
+	GNMUndoColrowRestoreStateGroup *ua = (GNMUndoColrowRestoreStateGroup *)o;
+
+	colrow_state_group_destroy (ua->saved_state);
+	ua->saved_state = NULL;
+	colrow_index_list_destroy (ua->selection);
+	ua->selection = NULL;
+}
+
+static void
+gnm_undo_colrow_restore_state_group_undo (GOUndo *u, gpointer data)
+{
+	GNMUndoColrowRestoreStateGroup *ua = (GNMUndoColrowRestoreStateGroup *)u;
+
+	colrow_restore_state_group (ua->sheet, ua->is_cols, ua->selection, ua->saved_state);
+}
+
+static void
+gnm_undo_colrow_restore_state_group_class_init (GObjectClass *gobject_class)
+{
+	GOUndoClass *uclass = (GOUndoClass *)gobject_class;
+
+	gnm_undo_colrow_restore_state_group_parent_class = g_type_class_peek_parent (gobject_class);
+
+	gobject_class->finalize = gnm_undo_colrow_restore_state_group_finalize;
+	uclass->undo = gnm_undo_colrow_restore_state_group_undo;
+}
+
+
+GSF_CLASS (GNMUndoColrowRestoreStateGroup, gnm_undo_colrow_restore_state_group,
+	   gnm_undo_colrow_restore_state_group_class_init, NULL, GO_TYPE_UNDO)
+
+/**
+ * gnm_undo_colrow_restore_state_group_new:
+ *
+ * Returns: a new undo object.
+ **/
+
+GOUndo *
+gnm_undo_colrow_restore_state_group_new (Sheet *sheet, gboolean is_cols,
+					ColRowIndexList *selection,
+					ColRowStateGroup *saved_state)
+{
+	GNMUndoColrowRestoreStateGroup *ua = g_object_new (GNM_TYPE_UNDO_COLROW_RESTORE_STATE_GROUP, NULL);
+
+	ua->sheet = sheet;
+	ua->is_cols = is_cols;
+	ua->selection = selection;
+	ua->saved_state = saved_state;
+
+	return (GOUndo *)ua;
+}
+
+/* ------------------------------------------------------------------------- */
+
+static GObjectClass *gnm_undo_colrow_set_sizes_parent_class;
+
+static void
+gnm_undo_colrow_set_sizes_finalize (GObject *o)
+{
+	GNMUndoColrowSetSizes *ua = (GNMUndoColrowSetSizes *)o;
+
+	colrow_index_list_destroy (ua->selection);
+	ua->selection = NULL;
+}
+
+static void
+gnm_undo_colrow_set_sizes_undo (GOUndo *u, gpointer data)
+{
+	GNMUndoColrowSetSizes *ua = (GNMUndoColrowSetSizes *)u;
+
+	colrow_set_sizes (ua->sheet, ua->is_cols, ua->selection, ua->new_size);
+}
+
+static void
+gnm_undo_colrow_set_sizes_class_init (GObjectClass *gobject_class)
+{
+	GOUndoClass *uclass = (GOUndoClass *)gobject_class;
+
+	gnm_undo_colrow_set_sizes_parent_class = g_type_class_peek_parent (gobject_class);
+
+	gobject_class->finalize = gnm_undo_colrow_set_sizes_finalize;
+	uclass->undo = gnm_undo_colrow_set_sizes_undo;
+}
+
+
+GSF_CLASS (GNMUndoColrowSetSizes, gnm_undo_colrow_set_sizes,
+	   gnm_undo_colrow_set_sizes_class_init, NULL, GO_TYPE_UNDO)
+
+/**
+ * gnm_undo_colrow_set_sizes_new:
+ *
+ * Returns: a new undo object.
+ **/
+
+GOUndo *
+gnm_undo_colrow_set_sizes_new (Sheet *sheet, gboolean is_cols,
+			       ColRowIndexList *selection,
+			       int new_size)
+{
+	GNMUndoColrowSetSizes *ua = g_object_new (GNM_TYPE_UNDO_COLROW_SET_SIZES, NULL);
+
+	ua->sheet = sheet;
+	ua->is_cols = is_cols;
+	ua->selection = selection;
+	ua->new_size = new_size;
+
+	return (GOUndo *)ua;
+}
+
+/* ------------------------------------------------------------------------- */
diff --git a/src/undo.h b/src/undo.h
new file mode 100644
index 0000000..90aca8b
--- /dev/null
+++ b/src/undo.h
@@ -0,0 +1,72 @@
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+#ifndef _GNM_UNDO_H_
+#define _GNM_UNDO_H_
+
+#include "gnumeric.h"
+#include "sheet.h"
+#include "colrow.h"
+#include <goffice/goffice.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* ------------------------------------------------------------------------- */
+
+#define GNM_TYPE_UNDO_COLROW_RESTORE_STATE_GROUP  (gnm_undo_colrow_restore_state_group_get_type ())
+#define GNM_UNDO_COLROW_RESTORE_STATE_GROUP(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_TYPE_UNDO_COLROW_RESTORE_STATE_GROUP, GNMUndoColrowRestoreStateGroup))
+#define GNM_IS_UNDO_COLROW_RESTORE_STATE_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_TYPE_UNDO_COLROW_RESTORE_STATE_GROUP))
+
+GType gnm_undo_colrow_restore_state_group_get_type (void);
+
+typedef struct _GNMUndoColrowRestoreStateGroup GNMUndoColrowRestoreStateGroup;
+typedef struct _GNMUndoColrowRestoreStateGroupClass GNMUndoColrowRestoreStateGroupClass;
+
+struct _GNMUndoColrowRestoreStateGroup {
+	GOUndo base;
+	Sheet *sheet;
+	gboolean is_cols;
+	ColRowIndexList *selection;
+	ColRowStateGroup *saved_state;
+};
+
+struct _GNMUndoColrowRestoreStateGroupClass {
+	GOUndoClass base;
+};
+
+GOUndo *gnm_undo_colrow_restore_state_group_new (Sheet *sheet, gboolean is_cols,
+						  ColRowIndexList *selection,
+						  ColRowStateGroup *saved_state);
+
+/* ------------------------------------------------------------------------- */
+
+#define GNM_TYPE_UNDO_COLROW_SET_SIZES  (gnm_undo_colrow_set_sizes_get_type ())
+#define GNM_UNDO_COLROW_SET_SIZES(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_TYPE_UNDO_COLROW_SET_SIZES, GNMUndoColrowSetSizes))
+#define GNM_IS_UNDO_COLROW_SET_SIZES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_TYPE_UNDO_COLROW_SET_SIZES))
+
+GType gnm_undo_colrow_set_sizes_get_type (void);
+
+typedef struct _GNMUndoColrowSetSizes GNMUndoColrowSetSizes;
+typedef struct _GNMUndoColrowSetSizesClass GNMUndoColrowSetSizesClass;
+
+struct _GNMUndoColrowSetSizes {
+	GOUndo base;
+	Sheet *sheet;
+	gboolean is_cols;
+	ColRowIndexList *selection;
+	int new_size;
+};
+
+struct _GNMUndoColrowSetSizesClass {
+	GOUndoClass base;
+};
+
+GOUndo *gnm_undo_colrow_set_sizes_new (Sheet *sheet, gboolean is_cols,
+				       ColRowIndexList *selection,
+				       int new_size);
+
+/* ------------------------------------------------------------------------- */
+
+
+G_END_DECLS
+
+#endif /* _GNM_UNDO_H_ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]