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 */
48 UndoStack
*new_undo_stack(Diagram
*dia
);
49 void undo_destroy(UndoStack
*stack
);
50 void undo_push_change(UndoStack
*stack
, Change
*change
);
51 void undo_set_transactionpoint(UndoStack
*stack
);
52 void undo_revert_to_last_tp(UndoStack
*stack
);
53 void undo_apply_to_next_tp(UndoStack
*stack
);
54 void undo_clear(UndoStack
*stack
);
56 /* Specific undo functions: */
58 Change
*undo_move_objects(Diagram
*dia
, Point
*orig_pos
,
59 Point
*dest_pos
, GList
*obj_list
);
60 Change
*undo_move_handle(Diagram
*dia
,
61 Handle
*handle
, Object
*obj
,
62 Point orig_pos
, Point dest_pos
);
63 Change
*undo_connect(Diagram
*dia
, Object
*obj
, Handle
*handle
,
64 ConnectionPoint
*connectionpoint
);
65 Change
*undo_unconnect(Diagram
*dia
, Object
*obj
, Handle
*handle
);
66 Change
*undo_delete_objects(Diagram
*dia
, GList
*obj_list
); /* Reads current obj list */
67 Change
*undo_insert_objects(Diagram
*dia
, GList
*obj_list
,
69 Change
*undo_reorder_objects(Diagram
*dia
, GList
*changed_list
,
70 GList
*orig_list
); /* Reads current obj list */
71 Change
*undo_object_change(Diagram
*dia
, Object
*obj
,
72 ObjectChange
*obj_change
);
73 Change
*undo_group_objects(Diagram
*dia
, GList
*obj_list
,
74 Object
*group
, GList
*orig_list
);
75 Change
*undo_ungroup_objects(Diagram
*dia
, GList
*obj_list
,
76 Object
*group
, int group_index
);