2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
25 * $XConsortium: abobj_edit.h /main/3 1995/11/06 17:15:39 rswiston $
27 * @(#)abobj_edit.h 1.1 15 Feb 1994
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special
32 * restrictions in a confidential disclosure agreement between
33 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 * document outside HP, IBM, Sun, USL, SCO, or Univel without
35 * Sun's specific written approval. This document and all copies
36 * and derivative works thereof must be returned or destroyed at
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
43 #ifndef _ABOBJ_EDIT_H_
44 #define _ABOBJ_EDIT_H_
46 #include <ab_private/abobj.h>
49 * Declarations for edit features
53 * Size of each malloc'd block for clipboard/undo buffer
55 #define ABOBJ_CLIPBOARD_BLOCK_SIZE 10
56 #define ABOBJ_UNDO_BLOCK_SIZE 10
71 * Supported actions that can be undone
87 ** Supported initiator locations of a paste operation
91 AB_PASTE_INITIATOR_NO_TYPE = 0,
92 AB_PASTE_INITIATOR_OBJ_MENU, /* Object popup menu */
93 AB_PASTE_INITIATOR_BRWS_MENU, /* Browser popup menu */
94 AB_PASTE_INITIATOR_BRWS_EDIT_MENU, /* Browser's edit menu */
95 AB_PASTE_INITIATOR_PAL_EDIT_MENU, /* Palette's edit menu */
96 AB_PASTE_INITIATOR_NUM_VALUES
97 } AB_PASTE_INITIATOR_TYPE;
101 * Data structures for clipboard/undo
102 * What follows are data structures that are used to store
103 * ABOBj's and related data for undo and the clipboard.
105 * The two main data structures are:
106 * AB_CLIPBOARD_REC and
109 * AB_UNDO_REC is a bit complicated because it consists
110 * of data for cut/delete/paste/move/resize/group/ungroup
111 * which are all contained in a union.
115 * Additional info needed for clipboard
117 typedef struct _AB_CLIPB_INFO
119 ABObj dup_obj; /* duplicated object, not just ptr to */
120 ABObj action_list; /* duplicated ACTIONS for object and it's descendants */
121 char *other_stuff; /* placeholder for now, will be filled
123 }AB_CLIPB_INFO, *ABClipbInfo;
126 * Additional info needed for undoing cut
128 typedef struct _AB_UNDO_CUT_INFO
131 ABObj from_action_list; /* duplicated ACTIONS for object (object == source) */
132 ABObj to_action_list; /* duplicated ACTIONS for object (object == target) */
133 ABObj parent; /* POINTER to parent */
134 ABObj pane_sibling; /* POINTER to sibling - used for layers */
135 } AB_UNDO_CUT_INFO, *ABUndoCutInfo;
138 * Additional info needed for undoing move
140 typedef struct _AB_UNDO_MOVE_INFO
144 } AB_UNDO_MOVE_INFO, *ABUndoMoveInfo;
147 * Additional info needed for undoing resize
149 typedef struct _AB_UNDO_RESIZE_INFO
153 } AB_UNDO_RESIZE_INFO, *ABUndoResizeInfo;
156 * Additional info needed for undoing ungroup
158 typedef struct _AB_UNDO_UNGROUP_INFO
160 ABObj dup_old_group; /* DUPLICATE of ungrouped group */
161 ABObj *member_list; /* List of POINTERS to members */
163 } AB_UNDO_UNGROUP_INFO, *ABUndoUngroupInfo;
166 * Union of additional info for undo actions
168 typedef union _AB_UNDO_EXTRA_INFO
170 AB_UNDO_CUT_INFO cut;
171 /* undo for cut == undo for delete */
172 /* don't need special info for undoing paste */
173 AB_UNDO_MOVE_INFO move;
174 AB_UNDO_RESIZE_INFO resize;
175 AB_UNDO_UNGROUP_INFO ungroup;
176 /* don't need special info for undoing group */
177 }AB_UNDO_EXTRA_INFO, *ABUndoExtraInfo;
180 * Info for undoing an action on ONE object
182 typedef struct _AB_UNDO_INFO
185 AB_UNDO_EXTRA_INFO info;
186 }AB_UNDO_INFO, *ABUndoInfo;
189 * Data structure for clipboard
191 typedef struct _AB_CLIPBOARD_REC{
192 ABObj *list; /* List of POINTERS to copied/cut objects */
193 AB_CLIPB_INFO *info_list;
197 } AB_CLIPBOARD_REC, *ABClipboardRec;
200 * Type for ABUndoFunc
202 struct _AB_UNDO_REC; /* forward ref for ABUndoFunc */
203 typedef void AB_UNDO_FUNC(struct _AB_UNDO_REC *undo_rec);
204 typedef AB_UNDO_FUNC *ABUndoFunc;
207 * Data structure for undo buffer
209 typedef struct _AB_UNDO_REC{
211 AB_UNDO_INFO *info_list;
212 ABUndoFunc undo_func;
216 } AB_UNDO_REC, *ABUndoRec;
222 extern void abobj_edit_init(
225 extern int abobj_cut(
228 extern int abobj_copy(
231 extern int abobj_paste(
232 AB_PASTE_INITIATOR_TYPE initiator
235 extern int abobj_delete(void);
237 extern int abobj_undo(void);
239 extern int abobj_cancel_undo(void);
241 extern BOOL abobj_undo_active(
245 * CLIPBOARD manipulating functions
247 extern BOOL abobj_clipboard_is_empty(
250 extern BOOL abobj_in_clipboard(
254 extern void abobj_clipboard_clear(
257 extern void abobj_clipboard_set(
262 extern void abobj_clipboard_add(
268 * Function to set undo buffer
270 extern int abobj_set_undo(
273 ABUndoFunc undo_func,
274 AB_UNDO_TYPE undo_type
277 extern void abobj_setup_undo_cut_layer(
283 * Xt Callbacks for editing functions:
290 extern void abobj_undo_cb(
292 XtPointer client_data,
296 extern void abobj_cut_cb(
298 XtPointer client_data,
302 extern void abobj_copy_cb(
304 XtPointer client_data,
308 extern void abobj_paste_cb(
310 XtPointer client_data,
314 extern void abobj_delete_cb(
316 XtPointer client_data,
320 #endif /* _ABOBJ_EDIT_H_ */