1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1999 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 typedef struct _UndoStack UndoStack
;
23 typedef struct _Change Change
;
26 #include "objchange.h"
28 typedef void (*UndoApplyFunc
)(Change
*change
, Diagram
*dia
);
29 typedef void (*UndoRevertFunc
)(Change
*change
, Diagram
*dia
);
30 typedef void (*UndoFreeFunc
)(Change
*change
);
33 /* If apply == transaction_point_pointer then this is a transaction
36 UndoRevertFunc revert
;
37 UndoFreeFunc free
; /* Remove extra data. Then this object is freed */
43 Change
*last_change
; /* Points to the object on the top of stack. */
44 Change
*current_change
; /* Points to the last object currently applied */
45 Change
*last_save
; /* Points to current_change at the time of last save. */
49 UndoStack
*new_undo_stack(Diagram
*dia
);
50 void undo_destroy(UndoStack
*stack
);
51 void undo_push_change(UndoStack
*stack
, Change
*change
);
52 void undo_set_transactionpoint(UndoStack
*stack
);
53 void undo_revert_to_last_tp(UndoStack
*stack
);
54 void undo_apply_to_next_tp(UndoStack
*stack
);
55 void undo_clear(UndoStack
*stack
);
56 void undo_mark_save(UndoStack
*stack
);
57 gboolean
undo_is_saved(UndoStack
*stack
);
59 /* Specific undo functions: */
61 Change
*undo_move_objects(Diagram
*dia
, Point
*orig_pos
,
62 Point
*dest_pos
, GList
*obj_list
);
63 Change
*undo_move_handle(Diagram
*dia
,
64 Handle
*handle
, DiaObject
*obj
,
65 Point orig_pos
, Point dest_pos
);
66 Change
*undo_connect(Diagram
*dia
, DiaObject
*obj
, Handle
*handle
,
67 ConnectionPoint
*connectionpoint
);
68 Change
*undo_unconnect(Diagram
*dia
, DiaObject
*obj
, Handle
*handle
);
70 undo_delete_objects_children(Diagram
*dia
, GList
*obj_list
);
71 Change
*undo_delete_objects(Diagram
*dia
, GList
*obj_list
); /* Reads current obj list */
72 Change
*undo_insert_objects(Diagram
*dia
, GList
*obj_list
,
74 Change
*undo_reorder_objects(Diagram
*dia
, GList
*changed_list
,
75 GList
*orig_list
); /* Reads current obj list */
76 Change
*undo_object_change(Diagram
*dia
, DiaObject
*obj
,
77 ObjectChange
*obj_change
);
78 Change
*undo_group_objects(Diagram
*dia
, GList
*obj_list
,
79 DiaObject
*group
, GList
*orig_list
);
80 Change
*undo_ungroup_objects(Diagram
*dia
, GList
*obj_list
,
81 DiaObject
*group
, int group_index
);
82 Change
*undo_parenting(Diagram
*dia
, DiaObject
*parentobj
, DiaObject
*childobj
,