1 /*  objmgr.h
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name:  objmgr.h
27 *
28 * Author:  James Ostell
29 *
30 * Version Creation Date: 9/94
31 *
32 * $Revision: 6.43 $
33 *
34 * File Description:  Manager for Bioseqs and BioseqSets
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date	   Name        Description of modification
39 * -------  ----------  -----------------------------------------------------
40 *
41 *
42 *
43 *
44 * ==========================================================================
45 */
46 
47 #ifndef _NCBI_ObjMgr_
48 #define _NCBI_ObjMgr_
49 
50 #ifndef _ASNTOOL_
51 #include <asn.h>
52 #endif
53 
54 #ifndef _NCBI_Seqfeat_
55 #include <objfeat.h>
56 #endif
57 
58 #undef NLM_EXTERN
59 #ifdef NLM_IMPORT
60 #define NLM_EXTERN NLM_IMPORT
61 #else
62 #define NLM_EXTERN extern
63 #endif
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 /*****************************************************************************
70 *
71 *   ObjMgr manipulates the "registry" of Objects in memory
72 *       assigns "EntityID" to Objects loaded in memory..
73 *   		only top level Object gets an EntityID
74 *   		caching and locking also done on top level Object
75 *
76 *   WARNING: This system currently only supports the predefined types here.
77 *       new types can be added with some limited recoding, but cannot be
78 *          added on the fly until additional work is done.
79 *
80 *****************************************************************************/
81 
82 #define OBJ_ALL              0   /* object manager itself */
83 #define OBJ_SEQENTRY         1
84 #define OBJ_BIOSEQ		     2
85 #define OBJ_BIOSEQSET		 3
86 #define OBJ_SEQDESC			 4
87 #define OBJ_SEQANNOT		 5
88 #define OBJ_ANNOTDESC		 6
89 #define OBJ_SEQFEAT		     7
90 #define OBJ_SEQALIGN		 8
91 #define OBJ_SEQGRAPH		 9
92 #define OBJ_SEQSUB	        10
93 #define OBJ_SUBMIT_BLOCK	11
94 #define OBJ_SEQSUB_CONTACT  12   /* used by gather.c */
95 #define OBJ_BIOSEQ_MAPFEAT  14   /* used by gather.c */
96 #define OBJ_BIOSEQ_SEG      15   /* used by gather.c */
97 #define OBJ_SEQHIST         16   /* used by gather.c */
98 #define OBJ_SEQHIST_ALIGN   17   /* used by gather.c */
99 #define OBJ_BIOSEQ_DELTA    18   /* used by gather.c */
100 
101 #define OBJ_PUB             20
102 #define OBJ_SEQFEAT_CIT     21  /* used by gather.c */
103 #define OBJ_SEQSUB_CIT      22  /* used by gather.c */
104 #define OBJ_MEDLINE_ENTRY   23  /* converted to a Pub on input */
105 
106 #define OBJ_PUB_SET         24
107 
108 #define OBJ_SEQLOC          25
109 #define OBJ_SEQID           26
110 
111 #define OBJ_SEQCODE         27
112 #define OBJ_SEQCODE_SET     28
113 #define OBJ_GENETIC_CODE    29
114 #define OBJ_GENETIC_CODE_SET 30
115 
116 #define OBJ_TEXT_REPORT		31
117 #define OBJ_FASTA			32
118 #define OBJ_VIBRANT_PICTURE 33
119 
120 #define OBJ_PROJECT         34
121 
122 #define OBJ_MAX            35    /* number of predefined types including 0 */
123 
124 
125 /*****************************************************************************
126 *
127 *   OMNewFunc()
128 *   	allocates an object of type
129 *   	sets default values if any
130 *   	this will not necessarily be ready for AsnWrite (may be lacking
131 *            required elements)
132 *       this will be suitable for input to editors or OMFreeFunc()
133 *
134 *****************************************************************************/
135 typedef Pointer (LIBCALLBACK *OMNewFunc) PROTO((void));
136 
137 /*****************************************************************************
138 *
139 *   OMFreeFunc(data)
140 *   	frees datapointer passed to it.
141 *   	supplied to several functions
142 *   	callback must know what type of pointer is expected
143 *
144 *****************************************************************************/
145 typedef Pointer (LIBCALLBACK *OMFreeFunc) PROTO((Pointer data));
146 
147 /*****************************************************************************
148 *
149 *   OMLabelFunc(data, buffer, buflen, content)
150 *   	returns a short label of content=
151 *   		OM_LABEL_TYPE = definition of data type.
152 *   		OM_LABEL_CONTENT = short label based on content
153 *   		OM_LABEL_BOTH = TYPE: CONTENT
154 *   		OM_LABEL_SUMMARY = produce a one line summary of content
155 *   	fills supplied buffer up to buflen chars.
156 *
157 *   NOTE:
158 *   	this means buf MUST be (buflen+1) chars long.
159 *
160 *   	adds the terminating \0
161 *   	returns number of characters in buffer not counting the \0
162 *
163 *****************************************************************************/
164 typedef Int2 (LIBCALLBACK *OMLabelFunc) PROTO((Pointer data, CharPtr buffer, Int2 buflen, Uint1 content));
165 
166 #define OM_LABEL_TYPE 0
167 #define OM_LABEL_CONTENT 1
168 #define OM_LABEL_BOTH    2
169 #define OM_LABEL_SUMMARY 3
170 
171 /*****************************************************************************
172 *
173 *   OMSubTypeFunc(Pointer)
174 *   	returns the proper subtype value given the data pointer
175 *   	default is to return 0
176 *       This is used for procedures that support a particular subtype
177 *         (a certain feature type or descriptor type)
178 *
179 *****************************************************************************/
180 typedef Uint2 (LIBCALLBACK *OMSubTypeFunc) PROTO((Pointer ptr));
181 
182 
183 /*****************************************************************************
184 *
185 *   OMMessageFunc(message)
186 *   	when a proc registers a message function with an entity, it will
187 *   	 recieve all messages emenating from that entity.
188 *
189 *****************************************************************************/
190 typedef struct ommsgstruct {
191 	Int2 message;    /* the message code, defined below */
192 	Uint2 entityID,
193 		itemtype,
194 		rowID;
195     Uint4 itemID;
196 	Uint2 fromProcID,
197 		toProcID;         /* allows communication to and from particular procs */
198 	Pointer procmsgdata;  /* procedure specific data to be sent, assumes toProcID set */
199 	Pointer omuserdata;	  /* this is really an OMUserDataPtr */
200 	Pointer region;       /* this restricts the message to a region. See below */
201 	Uint1 regiontype;     /*  see define below */
202 	Uint1 rgb [3];        /* for set color message */
203 } OMMsgStruct, PNTR OMMsgStructPtr;
204 
205 	/**** defines for regiontype (above) *****/
206 
207 #define OM_REGION_SEQLOC	1    /* region is a SeqLocPtr of type SEQLOC_INT */
208 
209     /**** From of message callback supplied by user ******/
210 
211 typedef Int2 (LIBCALLBACK *OMMessageFunc) PROTO((OMMsgStructPtr message));
212 
213 	/**** defines for message function return values ******/
214 
215 #define OM_MSG_RET_ERROR   0	  /* an error occurred handling this message */
216 #define OM_MSG_RET_OK      1      /* message handled ok */
217 #define OM_MSG_RET_DEL     2      /* due to message, remove this handler */
218 #define OM_MSG_RET_DONE    3      /* handled, do not send message further */
219 #define OM_MSG_RET_NOPROC  4      /* specified procedure was not found */
220 
221     /**** defines for message value (OMMsgStruct.message) *******/
222 
223 #define OM_MSG_DEL         1      /* this item is being deleted */
224 #define OM_MSG_CREATE      2      /* this item was just created */
225 #define OM_MSG_UPDATE      3      /* this item was updated */
226 #define OM_MSG_SELECT      4      /* this item selected */
227 #define OM_MSG_DESELECT    5      /* this item deselected */
228 #define OM_MSG_CACHED      6      /* item was cached */
229 #define OM_MSG_UNCACHED    7      /* item reloaded from cache */
230 #define OM_MSG_TO_CLIPBOARD 8     /* object put in clipboard */
231 #define OM_MSG_CONNECT      9      /* registered entity being incorporated into
232 		                               another. */
233 #define OM_MSG_SETCOLOR    10     /* set color of region */
234 #define OM_MSG_HIDE        11     /* hide sequence */
235 #define OM_MSG_SHOW        12     /* show sequence */
236 #define OM_MSG_PROCESS     13     /* process-specific message */
237 #define OM_MSG_FLUSH       14     /* close all existed windows */
238 #define OM_MSG_MOUSEUP     15     /* mouse up on selection has occurred */
239 
240 /*****************************************************************************
241 *
242 *  data type used to send additional information for an update msg
243 *
244 *****************************************************************************/
245 #define UPDATE_TYPE_LAYOUT       (1)
246 #define UPDATE_TYPE_COLOR        (2)
247 #define UPDATE_TYPE_EDIT_DELBSP  (3)
248 #define UPDATE_TYPE_CARETPOS     (4)
249 #define UPDATE_TYPE_VIEWMGR      (5)
250 #define UPDATE_TYPE_RECOLOR      (6)
251 #define UPDATE_TYPE_NEWSEQ       (7)
252 
253 typedef struct ddvupdatemsg{
254 	Uint1   type;
255 	Pointer data;
256 	}DDVUpdateMSG, PNTR DDVUpdateMSGPtr;
257 
258 
259 /*****************************************************************************
260 *
261 *   ObjMgrSendMsg(msg, entityID, itemID, itemtype)
262 *       Directly invokes the objmgr messaging system
263 *       should be used cautiously as most objmgr calls do their own messaging
264 *
265 *
266 *   ObjMgrSendProcMsg(msg, entityID, itemID, itemtype, fromProcID, toProcID)
267 *       Allows messages to be sent to particular procs
268 *
269 *****************************************************************************/
270 NLM_EXTERN Boolean LIBCALL ObjMgrSendMsg PROTO((Uint2 msg, Uint2 entityID, Uint4 itemID, Uint2 itemtype));
271 NLM_EXTERN Boolean LIBCALL ObjMgrSendMsgNoFeatureChange PROTO((Uint2 msg, Uint2 entityID, Uint4 itemID, Uint2 itemtype));
272 NLM_EXTERN Boolean LIBCALL ObjMgrSendMsgOnlyFeatLabelChange PROTO((Uint2 msg, Uint2 entityID, Uint4 itemID, Uint2 itemtype));
273 
274 NLM_EXTERN Boolean LIBCALL ObjMgrSendProcMsg PROTO((Uint2 msg, Uint2 entityID, Uint4 itemID, Uint2 itemtype,
275                                                     Uint2 fromProcID, Uint2 toProcID, Pointer procmsgdata));
276 
277 NLM_EXTERN Boolean LIBCALL ObjMgrSendRowMsg PROTO((Uint2 msg, Uint2 entityID, Uint4 itemID, Uint2 itemtype, Uint2 rowID));
278 
279 	                              /* user supplied data on entity */
280 typedef struct omuserdata {
281 	Uint2 procid,                 /* proc that put userdata here */
282 		proctype,                 /* OMPROC_... */
283 		userkey;                  /* user supplied key */
284 	DataVal userdata;             /* user supplied data */
285 	OMFreeFunc freefunc;      /* function to free user supplied data.ptrvalue */
286 	OMMessageFunc messagefunc;    /* function to recieve OM messages */
287 	struct omuserdata PNTR next;
288 } OMUserData, PNTR OMUserDataPtr;
289 
290 typedef struct objmgrdata {
291 	Uint2 datatype;
292 	Pointer dataptr;
293 	Uint2 parenttype;
294 	Pointer parentptr;
295 	Uint2 choicetype;
296 	ValNodePtr choice;           /* CHOICE wrapper (if datatype=Bioseq or Set) */
297 	Uint2 lockcnt;             /* count of locks */
298 	Uint1 tempload;
299 	Uint4 touch;                /* last time this was unlocked */
300 	Uint2 EntityID;             /* arbitrary ID assigned to complete entity */
301 	Boolean clipboard;         /* is this in the clipboard? */
302 	Boolean dirty;             /* updated without a save? */
303 	Boolean being_freed;       /* in-process of being freed, set by ObjMgrDel */
304 	Boolean free;
305 	Boolean bulkIndexFree;     /* used to suppress individual SeqMgrDeleteFromBioseqIndex */
306 	OMUserDataPtr userdata;    /* for user supplied data */
307 	Uint2 options;             /* options set with bit flags, defined below */
308 	Uint4 lastDescrItemID;     /* for new seqmgr extra bioseq exploration functions */
309 	time_t indexed;            /* time that entity was seqmgr indexed */
310 	Pointer extradata;         /* used (initially) for extra bioseq feature indices */
311 	OMFreeFunc reapextra;      /* function to call when caching out, passed extradata */
312 	OMFreeFunc reloadextra;    /* function to call when reloading, passed extradata */
313 	OMFreeFunc freeextra;      /* function to call when deleting, passed extradata */
314 } ObjMgrData, PNTR ObjMgrDataPtr;
315 
316 /** values for tempload (above) **/
317 #define TL_NOT_TEMP     0   /* not a temporarily loaded guy */
318 #define TL_LOADED       1   /* in memory (but temporarily)  */
319 #define TL_CACHED       2   /* out of memory, but cached somewhere */
320 
321 
322 /*****************************************************************************
323 *
324 *   A registered type provides:
325 *   	generic copy (to clipboard)
326 *   	generic match
327 *   	generic open
328 *   	generic free
329 *   	generic display (in asn.1)
330 *		cut (complete entity)
331 *   	paste (complete entity to desktop)
332 *
333 *   Procs must be provided for everything else
334 *
335 *
336 *****************************************************************************/
337 
338 
339 typedef struct objtypedata {
340 	Uint2 datatype;             /* same as datatype above */
341 	CharPtr asnname,          	/* asn.1 name for this */
342 		label,                  /* a short label for this type */
343 		name;                   /* a descriptive name */
344 	AsnTypePtr atp;             /* the base type pointer */
345 	OMNewFunc newfunc;
346 	AsnReadFunc asnread;
347 	AsnWriteFunc asnwrite;
348 	OMFreeFunc freefunc;          /* generic free function */
349 	OMLabelFunc labelfunc;
350 	OMSubTypeFunc subtypefunc;    /* get subtype (if any) given dataptr of OBJ_ */
351 	Uint2 tochoicetype;           /* if this could be a choice, the OBJ_ for it */
352 	Uint1 tochoice;               /* value of vnp->choice if this is made a choice */
353 } ObjMgrType, PNTR ObjMgrTypePtr;
354 
355 
356 /*****************************************************************************
357 *
358 *   Procs provide additional functions by data type.
359 *   	If the type is left off either input or output, then assumes anytype
360 *
361 *   paste: inputtype = type to paste
362 *          outputtype = type to paste it into
363 *   cut:   inputtype = type to cut it from
364 *          outputtype = type that is cut out
365 *   delete: like cut
366 *   filter: inputtype = type that goes in the filter
367 *           outputtype = type that comes out
368 *   transform: this is a destructive filter (input type disappears)
369 *   edit: inputtype and output type are the same
370 *   view: inputtype is a datatype.
371 *
372 *****************************************************************************/
373 
374 
375                 /* general function. ompcp is really an ObjMgrProcControlPtr */
376                 /* return is an OM_MSG_RET */
377 typedef Int2 (LIBCALLBACK * ObjMgrGenFunc) PROTO ((Pointer ompcp));
378 
379 #define NUM_OPT 20
380 typedef struct objprocdata {
381 	Uint2 proctype,             /* type of procedure (PROC_) */
382 		  subproctype,          /* used to distinguish procs */
383 		  procid;				/* unique id for this proc */
384 	CharPtr procname,			/* human readable name */
385 		proclabel,				/* short label */
386 		submenu;				/* optional submenu name */
387 	Uint2 inputtype,            /* input object (OBJ_) */
388 		  subinputtype,         /* for distinguishing CHOICEs */
389 		outputtype,             /* output object (OBJ_) */
390 		  suboutputtype;         /* for distinghishing CHOICEs  */
391 	Pointer procdata;           /* data used by proc */
392 	ObjMgrGenFunc func;         /* the function pointer */
393 	Int2 priority;              /* higher number = higher priority */
394 	DataVal options[NUM_OPT];   /* for function options */
395 } ObjMgrProc, PNTR ObjMgrProcPtr;
396 
397 typedef struct omproccontrol {
398     Boolean whole_entity;      /* TRUE if whole entity is selected */
399 	Pointer input_data,
400 			input_choice;
401 	Uint2 input_entityID,
402 		input_itemtype,
403 		input_choicetype;
404     Uint4 input_itemID;
405 	Uint1 input_regiontype;   /* for region of entity */
406 	Pointer input_region;
407 	Pointer output_data,
408 		output_choice;
409 	Uint2 output_entityID,
410 		output_itemtype,
411 		output_choicetype;
412 	Uint4 output_itemID;
413 	Uint1 output_regiontype;
414 	Pointer output_region;
415 	ObjMgrProcPtr proc;
416 	Boolean do_not_reload_from_cache;   /* default is for gather to reload cache */
417 } OMProcControl, PNTR OMProcControlPtr;
418 
419 #define OMPROC_OPEN		1
420 #define OMPROC_DELETE	2
421 #define OMPROC_VIEW		3
422 #define OMPROC_EDIT		4
423 #define OMPROC_SAVE		5
424 #define OMPROC_CUT		6
425 #define OMPROC_COPY		7
426 #define OMPROC_PASTE	8
427 #define OMPROC_ANALYZE  9
428 #define OMPROC_FIND		10
429 #define OMPROC_REPLACE	11
430 #define OMPROC_FILTER	12
431 #define OMPROC_FETCH	13
432 #define OMPROC_COLORMGR 14
433 
434 #define OMPROC_MAX      14
435 
436 
437 #define NUM_OMD 50
438 
439 typedef struct omdata {
440 	ObjMgrData data[NUM_OMD];
441 	struct omdata PNTR next;
442 } OMData, PNTR OMDataPtr;
443 
444 typedef struct omproc {
445 	ObjMgrProc data[NUM_OMD];
446 	struct omproc PNTR next;
447 } OMProc, PNTR OMProcPtr;
448 
449 typedef struct omtype {
450 	ObjMgrType data[NUM_OMD];
451 	struct omtype PNTR next;
452 } OMType, PNTR OMTypePtr;
453 
454 typedef struct selstruct {
455 	Uint2 entityID,
456 		  itemtype;
457     Uint4 itemID;
458 	Pointer region;       /* this restricts the message to a region.
459 	                         currently only a SeqLocPtr of type SEQLOC_INT */
460 	Uint1 regiontype;     /* 0 = not set
461 	                         1 = SeqLocPtr of type SEQLOC_INT	*/
462 	struct selstruct PNTR prev,
463 		PNTR next;
464 } SelStruct, PNTR SelStructPtr;
465 
466 typedef struct objmng {        /* functions for data management */
467 	Uint2 options;             /* options set with bit flags, defined below */
468 
469 	OMTypePtr ncbitype;    /* types needed by NCBI functions */
470 	ObjMgrTypePtr PNTR typelist; /* sorted by type */
471 	Uint2 tottype,                 /* number of elements in ncbitype */
472 		 currtype,                /* number of elements in ncbitype occupied */
473 		HighestObjMgrType;          /* set to OBJ_MAX on startup */
474 
475 	OMProcPtr ncbiproc;          /* NCBI functions */
476 	ObjMgrProcPtr PNTR proclist; /* sorted by proctype */
477 	Uint2 totproc,                 /* number of elements in ncbiproc */
478 		 currproc,                /* number of elements in ncbiproc occupied */
479 		HighestProcType,			  /* set to PROC_MAX on startup */
480 		HighestProcID,
481 		HighestUserKey;
482 
483 	OMDataPtr ncbidata;    /* data needed by NCBI functions */
484 	ObjMgrDataPtr PNTR datalist; /* sorted by pointer */
485 	Uint4 totobj,                 /* number of elements in ncbidata */
486 		 currobj;                /* number of elements in ncbidata occupied */
487 	Uint2 HighestEntityID;
488 	ObjMgrDataPtr clipboard;
489 	SelStructPtr sel;               /* for currently selected data item(s) */
490 
491 	Uint2 maxtemp,                /* maximum number of unlocked temp entries to keep */
492 		 tempcnt;                /* count of unlocked temp entries */
493 	Uint2 hold;                  /* if not 0, no reaping is done until it is 0 */
494 	Boolean reaping;             /* to protect against recursive calls to ObjMgrReap due to Msg */
495 	Boolean is_write_locked;     /* needed to unlock during messaging */
496 
497 	OMUserDataPtr userdata;      /* for global messageing */
498 
499 	Boolean autoclean;           /* if TRUE, reap and free cache if currobj > maxobj */
500 	Uint2 maxobj;                /* number of objects that tiggers autocleaning */
501 
502 	ObjMgrDataPtr PNTR PNTR	entityID_index; /**** two-level array index on Entity ID *****/
503 
504 } ObjMgr, PNTR ObjMgrPtr;
505 
506 #define DEFAULT_MAXTEMP 5   /* default number of temp entries to keep */
507 #define DEFAULT_MAXOBJ 50000   /* default number of objects to keep for autocleaning */
508 
509 /*****************************************************************************
510 *
511 *   Return the current ObjMgr
512 *   	Initialize if not done already
513 *
514 *****************************************************************************/
515 NLM_EXTERN ObjMgrPtr LIBCALL ObjMgrGet PROTO((void));
516 /*****************************************************************************
517 *
518 *   ObjMgrReadLock()
519 *   	Initialize if not done already
520 *       A thread can have only one read or write lock at a time
521 *       Many threads can have read locks
522 *       Only one thread can have a write lock
523 *       No other threads may have read locks if a write lock is granted
524 *       If another thread holds a write lock, this call blocks until write
525 *          is unlocked.
526 *
527 *****************************************************************************/
528 NLM_EXTERN ObjMgrPtr LIBCALL ObjMgrReadLock PROTO((void));
529 
530 /*****************************************************************************
531 *
532 *   ObjMgrWriteLock()
533 *   	Initialize if not done already
534 *       A thread can have only one read or write lock at a time
535 *       Many threads can have read locks
536 *       Only one thread can have a write lock
537 *       No other threads may have read locks if a write lock is granted
538 *       If another thread holds a read or write lock, this call blocks until write
539 *          is unlocked.
540 *
541 *****************************************************************************/
542 NLM_EXTERN ObjMgrPtr LIBCALL ObjMgrWriteLock PROTO((void));
543 /*****************************************************************************
544 *
545 *  ObjMgrUnlock()
546 *
547 *****************************************************************************/
548 NLM_EXTERN Boolean LIBCALL ObjMgrUnlock PROTO((void));
549 
550 
551 /*****************************************************************************
552 *
553 *   Options are set on the ObjMgr by setting 1 bit flags
554 *   Currently available options are defined below.
555 *   Options set on the ObjMgr itself (called with entityID = 0) become
556 *      defaults for every data object
557 *   Options set on a specific entity (called with entityID > 0) apply only
558 *      to that entity.
559 *
560 *****************************************************************************/
561 #define OM_OPT_FREE_IF_NO_VIEW   1  /* free entity if no more UserData
562                                        structures are attached to it */
563 #define OM_OPT_RECORD_SUPPRESSED 2  /* removed from distribution, still
564                                        available for retrieval */
565 #define OM_OPT_RECORD_DEAD       4
566 
567 /*****************************************************************************
568 *
569 *   ObjMgrSetHold()
570 *     Increments hold count in ObjMgr
571 *       returns current hold count
572 *     if hold != 0, then no tempload records are cached out of memory
573 *     This is useful if you are doing a complex task involving repeated
574 *      access to many records and you want them to stay in memory while
575 *      the task is performed, even though they are loaded temporarily by
576 *      BioseqLock..
577 *     Be sure to call ObjMgrClearHold() when you are done so they can be
578 *      cached out.
579 *
580 *****************************************************************************/
581 NLM_EXTERN Uint2 LIBCALL ObjMgrSetHold PROTO((void));
582 
583 /*****************************************************************************
584 *
585 *   ObjMgrCheckHold()
586 *       returns current hold count
587 *     if hold == 0, then tempload records will be cached out of memory
588 *
589 *****************************************************************************/
590 NLM_EXTERN Uint2 LIBCALL ObjMgrCheckHold PROTO((void));
591 
592 /*****************************************************************************
593 *
594 *   ObjMgrClearHold()
595 *     Decrements hold count in ObjMgr
596 *       returns current hold count
597 *       will never decrement below 0
598 *     if hold == 0, then tempload records will be cached out of memory
599 *
600 *****************************************************************************/
601 NLM_EXTERN Uint2 LIBCALL ObjMgrClearHold PROTO((void));
602 
603 /*****************************************************************************
604 *
605 *   ObjMgrSetOptions(Uint2 option)
606 *     Sets options on the ObjMgr. All Options are 1 bit flags set with
607 *       defines. Several Options may be ORed together.
608 *       returns current options.
609 *     if entityID != 0, only applies to that entityID
610 *
611 *****************************************************************************/
612 NLM_EXTERN Uint2 LIBCALL ObjMgrSetOptions PROTO((Uint2 option, Uint2 entityID));
613 
614 /*****************************************************************************
615 *
616 *   ObjMgrClearOptions(Uint2 option)
617 *     Clears options on the ObjMgr. All Options are 1 bit flags set with
618 *       defines. Several Options may be ORed together.
619 *       returns current options.
620 *     if entityID != 0, only applies to that entityID
621 *
622 *****************************************************************************/
623 NLM_EXTERN Uint2 LIBCALL ObjMgrClearOptions PROTO((Uint2 option, Uint2 entityID));
624 
625 /*****************************************************************************
626 *
627 *   ObjMgrGetOptions(void)
628 *     Returns options on the ObjMgr. All Options are 1 bit flags set with
629 *       defines. Several Options may be ORed together.
630 *     if entityID != 0, only test that entityID
631 *
632 *****************************************************************************/
633 NLM_EXTERN Uint2 LIBCALL ObjMgrGetOptions PROTO((Uint2 entityID));
634 
635 /*****************************************************************************
636 *
637 *   ObjMgrTestOptions(Uint2 option)
638 *     Tests options on the ObjMgr. All Options are 1 bit flags set with
639 *       defines. Several Options may be ORed together.
640 *       returns TRUE if ALL flags in "option" are set in the ObjMgr
641 *     if entityID != 0, only test that entityID
642 *
643 *****************************************************************************/
644 NLM_EXTERN Boolean LIBCALL ObjMgrTestOptions PROTO((Uint2 option, Uint2 entityID));
645 
646 
647 /*****************************************************************************
648 *
649 *   Management of Data Types
650 *
651 *****************************************************************************/
652 
653 NLM_EXTERN Int4 LIBCALL ObjMgrTypeLookup PROTO((ObjMgrPtr omp, Uint2 type));
654 
655 /*****************************************************************************
656 *
657 *   ObjMgrTypeFind(omp, type, asnname, name)
658 *   	returns the objmgrptr by looking for
659 *   		type: if type != 0
660 *   		asnname: if asnname != NULL
661 *   		name: if name != NULL
662 *       in that order of preference.
663 *   	returns NULL if can't match on highest priority key
664 *
665 *****************************************************************************/
666 NLM_EXTERN ObjMgrTypePtr LIBCALL ObjMgrTypeFind PROTO((ObjMgrPtr omp, Uint2 type, CharPtr asnname, CharPtr name));
667 
668 NLM_EXTERN Uint2 LIBCALL ObjMgrTypeAdd PROTO((ObjMgrTypePtr omtdp));
669 NLM_EXTERN Uint2 LIBCALL ObjMgrTypeLoad PROTO (( Uint2 type, CharPtr asnname,
670 		CharPtr label, CharPtr name, AsnTypePtr atp, OMNewFunc newfunc,
671 		AsnReadFunc asnread, AsnWriteFunc asnwrite, OMFreeFunc freefunc,
672 		OMLabelFunc labelfunc, OMSubTypeFunc subtypefunc));
673 /**************************************************************************
674 *
675 * ObjMgrTypeFindNext(omp, omtp)
676 *    returns next ObjMgrType after omtp
677 *    Exhaustively traverses registered types if omtp starts as NULL
678 *
679 ***************************************************************************/
680 NLM_EXTERN ObjMgrTypePtr LIBCALL ObjMgrTypeFindNext PROTO((ObjMgrPtr omp, ObjMgrTypePtr omtp));
681 
682 /*****************************************************************************
683 *
684 *   ObjMgrTypeSetLabelFunc(type, labelfunc)
685 *   	replaces the labelfunc for type with a new one
686 *   	can also set it for the first time
687 *
688 *****************************************************************************/
689 NLM_EXTERN Boolean LIBCALL ObjMgrTypeSetLabelFunc PROTO((Uint2 type, OMLabelFunc labelfunc));
690 
691 /*****************************************************************************
692 *
693 *   Management of Procedures
694 *
695 *****************************************************************************/
696 
697 NLM_EXTERN Int4 LIBCALL ObjMgrProcLookup PROTO((ObjMgrPtr omp, Uint2 procID));
698 
699 /*****************************************************************************
700 *
701 *   ObjMgrProcAdd(data, priority)
702 *   	adds an ObjMgrProc at given priority
703 *		priority must be > 0  and less than 32000
704 *       highest priority function is called first.
705 *       if priority == 0 (default)
706 *   		gets the next highest priority over previous procs of same type
707 *       if priority == PROC_PRIORITY_HIGHEST
708 *           is always the highest priority (first one wins)
709 *   	if priority == PROC_PRIORITY_LOWEST
710 *           is always the lowest priority
711 *
712 *****************************************************************************/
713 NLM_EXTERN Uint2  LIBCALL ObjMgrProcAdd PROTO((ObjMgrProcPtr data, Int2 priority));
714 
715 #define PROC_PRIORITY_HIGHEST 32767
716 #define PROC_PRIORITY_LOWEST  -32765
717 #define PROC_PRIORITY_DEFAULT 0
718 
719 
720 /*****************************************************************************
721 *
722 *   ObjMgrProcLoad(proctype, procname, proclabel, inputtype, subinputtype,
723 *              outputtype, suboutputtype,
724 *   				data, func, priority)
725 *   	adds a new proceedure with these parameters
726 *   	returns the procid
727 *   	if a procedure of the same name and type are already loaded
728 *   		returns the procid of the loaded proc.. does not reload
729 *
730 *****************************************************************************/
731 NLM_EXTERN Uint2 ObjMgrProcLoad PROTO((Uint2 proctype, CharPtr procname, CharPtr proclabel,
732                                        Uint2 inputtype, Uint2 subinputtype,
733                                        Uint2 outputtype, Uint2 suboutputtype, Pointer userdata,
734                                        ObjMgrGenFunc func, Int2 priority));
735 
736 /*****************************************************************************
737 *
738 *   ObjMgrProcLoadEx(proctype, procname, proclabel, inputtype, subinputtype,
739 *              outputtype, suboutputtype,
740 *   				data, func, priority, submenu)
741 *   	adds a new proceedure with these parameters
742 *   	returns the procid
743 *   	if a procedure of the same name and type are already loaded
744 *   		returns the procid of the loaded proc.. does not reload
745 *
746 *****************************************************************************/
747 NLM_EXTERN Uint2 ObjMgrProcLoadEx PROTO((Uint2 proctype, CharPtr procname, CharPtr proclabel,
748                                          Uint2 inputtype, Uint2 subinputtype,
749                                          Uint2 outputtype, Uint2 suboutputtype, Pointer userdata,
750                                          ObjMgrGenFunc func, Int2 priority, CharPtr submenu));
751 
752 /*****************************************************************************
753 *
754 *   ObjMgrProcFind(omp, procid, procname, proctype)
755 *   	if procid != NULL looks for it
756 *   	else matches on procname and proctype
757 *   		proctype = 0, matches all proctypes
758 *
759 *****************************************************************************/
760 NLM_EXTERN ObjMgrProcPtr LIBCALL ObjMgrProcFind PROTO((ObjMgrPtr omp, Uint2 procid,
761                                                        CharPtr procname, Uint2 proctype));
762 
763 /*****************************************************************************
764 *
765 *   ObjMgrGetProcID(omp, procname, proctype)
766 *   	returns procid given procname and proctype
767 *
768 *****************************************************************************/
769 NLM_EXTERN Uint2 LIBCALL ObjMgrGetProcID PROTO((ObjMgrPtr omp, CharPtr procname, Uint2 proctype));
770 
771 /*****************************************************************************
772 *
773 *   ObjMgrProcFindNext(omp, proctype, inputtype, outputtype, last)
774 *   	looks for proctype of highest priority that
775 *   		matches inputtype and outputtype
776 *   	0 on proctype or inputtype or outputtype matches any
777 *   	if last != NULL, then gets next after last
778 *
779 *****************************************************************************/
780 NLM_EXTERN ObjMgrProcPtr LIBCALL ObjMgrProcFindNext PROTO((ObjMgrPtr omp, Uint2 proctype,
781 						Uint2 inputtype, Uint2 outputtype, ObjMgrProcPtr last));
782 
783 /*****************************************************************************
784 *
785 *   ObjMgrProc Calls to run classes of procs
786 *
787 *****************************************************************************/
788 
789 
790 NLM_EXTERN Int2 LIBCALL ObjMgrProcOpen PROTO((ObjMgrPtr omp, Uint2 outputtype));
791 
792 /*****************************************************************************
793 *
794 *   OMGetNextUserKey returns a unique user key
795 *
796 *****************************************************************************/
797 
798 
799 NLM_EXTERN Uint2 LIBCALL OMGetNextUserKey PROTO((void));
800 
801 
802 /*****************************************************************************
803 *
804 *   Management of Data Objects
805 *
806 *****************************************************************************/
807 
808 NLM_EXTERN ObjMgrDataPtr LIBCALL ObjMgrFindByData PROTO((ObjMgrPtr omp, Pointer ptr));
809 NLM_EXTERN Int4 LIBCALL ObjMgrLookup PROTO((ObjMgrPtr omp, Pointer data));
810 NLM_EXTERN Boolean LIBCALL ObjMgrAdd PROTO((Uint2 type, Pointer data));
811 NLM_EXTERN Boolean LIBCALL ObjMgrDelete PROTO((Uint2 type, Pointer data));
812 NLM_EXTERN Boolean LIBCALL ObjMgrDeleteAllInRecord (void);
813 NLM_EXTERN Boolean LIBCALL ObjMgrConnect PROTO((Uint2 type, Pointer data, Uint2 parenttype, Pointer parentdata));
814 NLM_EXTERN Boolean LIBCALL ObjMgrConnectFunc PROTO((ObjMgrPtr omp, Uint2 type, Pointer data, Uint2 parenttype, Pointer parentdata));
815 
816 /*****************************************************************************
817 *
818 *   ObjMgrDetach (type, data)
819 *   	Removes parent info from element
820 *       Adds to objmgr if necessary
821 *       Does NOT register entity
822 *       (opposite of ObjMgrConnect)
823 *
824 *****************************************************************************/
825 NLM_EXTERN Boolean LIBCALL ObjMgrDetach PROTO((Uint2 type, Pointer data));
826 NLM_EXTERN Boolean LIBCALL ObjMgrDetachFunc PROTO((ObjMgrPtr omp, Uint2 type, Pointer data));
827 
828 /*****************************************************************************
829 *
830 *   ObjMgrSetDirtyFlag (entityID, the_flag)
831 *     record that an entity has been changed but not yet saved.
832 *       the_flag sets or unsets this state
833 *
834 *****************************************************************************/
835 NLM_EXTERN Boolean LIBCALL ObjMgrSetDirtyFlag PROTO((Uint2 entityID, Boolean the_flag));
836 
837 /*****************************************************************************
838 *
839 *   ObjMgrGetDirtyFlag (entityID)
840 *     returns the state of the dirty flag for entityID
841 *
842 *****************************************************************************/
843 NLM_EXTERN Boolean LIBCALL ObjMgrGetDirtyFlag PROTO((Uint2 entityID));
844 
845 NLM_EXTERN Boolean LIBCALL ObjMgrSetChoice PROTO((Uint2 type, ValNodePtr choice, Pointer data));
846 NLM_EXTERN Int4 LIBCALL ObjMgrLock PROTO((Uint2 type, Pointer data, Boolean lockit));
847 NLM_EXTERN Boolean LIBCALL ObjMgrSetTempLoad PROTO((ObjMgrPtr omp, Pointer ptr));
848 NLM_EXTERN Boolean LIBCALL ObjMgrReap PROTO((ObjMgrPtr omp));
849 NLM_EXTERN Boolean LIBCALL ObjMgrReapOne PROTO((ObjMgrPtr omp));
850 NLM_EXTERN ObjMgrDataPtr LIBCALL ObjMgrFindTop PROTO((ObjMgrPtr omp, ObjMgrDataPtr smdp));
851 NLM_EXTERN ObjMgrDataPtr LIBCALL ObjMgrGetDataStruct PROTO((ObjMgrPtr omp,
852 														   Uint2 entityID));
853 NLM_EXTERN ObjMgrDataPtr LIBCALL ObjMgrGetData PROTO((Uint2 entityID));
854 NLM_EXTERN Uint2 LIBCALL ObjMgrAddEntityID PROTO((ObjMgrPtr omp, ObjMgrDataPtr omdp));
855 
856 
857 /*****************************************************************************
858 *
859 *   ObjMgrWholeEntity(omdp, itemID, itemtype)
860 *	returns TRUE if itemID, itemtype identify a complete entity omdp
861 *       returns FALSE if these are an internal part of the entity
862 *
863 *****************************************************************************/
864 NLM_EXTERN Boolean LIBCALL ObjMgrWholeEntity PROTO((ObjMgrDataPtr omdp, Uint4 itemID, Uint2 itemtype));
865 
866 /*****************************************************************************
867 *
868 *   ObjMgrRegister (datatype, data)
869 *   	datatype is the datatype of data to register
870 *   	if data is already registered in ObjMgr, returns entityID
871 *   	if not, is added to the ObjMgr, returns entityID
872 *
873 *   	if (datatype is a choice type, uses data as a ValNodePtr)
874 *
875 *   	on failure returns 0
876 *
877 *****************************************************************************/
878 NLM_EXTERN Uint2 LIBCALL ObjMgrRegister PROTO((Uint2 datatype, Pointer data));
879 
880 /*****************************************************************************
881 *
882 *   ObjMgrAddUserData(entityID, procid, proctype, userkey)
883 *   	creates a new OMUserData struct attached to entityID
884 *   	if entityID = 0, attaches to the desktop (all objects)
885 *   	Caller must fill in returned structure
886 *   	returns NULL on failure
887 *
888 *****************************************************************************/
889 NLM_EXTERN OMUserDataPtr LIBCALL ObjMgrAddUserData PROTO((Uint2 entityID, Uint2 procid, Uint2 proctype, Uint2 userkey));
890 
891 /*****************************************************************************
892 *
893 *   ObjMgrGetUserData(entityID, procid, proctype, userkey)
894 *   	returns OMUserData attached to entityID by procid
895 *       if procid ==0, returns first OMUserData of proctype
896 *       if userkey == matches any userkey
897 *   	returns NULL on failure
898 *
899 *****************************************************************************/
900 NLM_EXTERN OMUserDataPtr LIBCALL ObjMgrGetUserData PROTO((Uint2 entityID, Uint2 procid, Uint2 proctype, Uint2 userkey));
901 
902 /*****************************************************************************
903 *
904 *   ObjMgrFreeUserData(entityID, procid, proctype, userkey)
905 *   	frees OMUserData attached to entityID by procid
906 *       if procid ==0, frees all OMUserData of proctype
907 *   	if proctype ==0, matches any proctype
908 *       if userkey == matches any userkey
909 *       if ObjMgrGetOptions(OM_OPT_FREE_IF_NO_VIEWS) if TRUE
910 *            and this is the last UserData, will free the entity
911 *   	returns TRUE if any freed
912 *
913 *****************************************************************************/
914 NLM_EXTERN Boolean LIBCALL ObjMgrFreeUserData PROTO((Uint2 entityID, Uint2 procid, Uint2 proctype, Uint2 userkey));
915 
916 
917 /*****************************************************************************
918 *
919 *   ObjMgrGetClipBoard()
920 *     returns ObjMgrDataPtr to current clipboard object or NULL if none
921 *
922 *****************************************************************************/
923 NLM_EXTERN ObjMgrDataPtr LIBCALL ObjMgrGetClipBoard PROTO((void));
924 
925 /*****************************************************************************
926 *
927 *   ObjMgrAddToClipBoard(entityID, ptr)
928 *   	if entityID > 0, then uses it.
929 *   	else, looks up entityID using ptr
930 *       adds entityID if needed
931 *       sends OM_MSG_TO_CLIPBOARD
932 *
933 *   	Anything in the clipboard is deleted
934 *
935 *****************************************************************************/
936 NLM_EXTERN Boolean LIBCALL ObjMgrAddToClipBoard PROTO((Uint2 entityID, Pointer ptr));
937 
938 /*****************************************************************************
939 *
940 *   ObjMgrFreeClipBoard()
941 *     clears any data from the clipboard
942 *
943 *****************************************************************************/
944 NLM_EXTERN Boolean LIBCALL ObjMgrFreeClipBoard PROTO((void));
945 
946 /*****************************************************************************
947 *
948 *   ObjMgrFreeCache(type)
949 *   	Frees all cached objects of type and subtypes of type
950 *   		based on ObjMgrMatch()
951 *   	if type == 0, frees all cached objects
952 *   	returns TRUE if no errors occurred
953 *
954 *       if ObjMgrSetHold() has been called but not cleared, nothing will
955 *         be removed from cache, since it is held, but this function will
956 *         return FALSE to warn you.
957 *
958 *****************************************************************************/
959 NLM_EXTERN Boolean LIBCALL ObjMgrFreeCache PROTO((Uint2 type));
960 
961 /*****************************************************************************
962 *
963 *   ObjMgrMatch(type1, type2)
964 *   	returns 0 if no match
965 *   	1 if identical
966 *   	2 if 2 is a subset of 1   (e.g. 1=OBJ_SEQENTRY, 2=BIOSEQ)
967 *       current type1 that can have subtypes are:
968 *   		OBJ_SEQENTRY
969 *   		OBJ_PUB
970 *   		OBJ_SEQANNOT
971 *   		OBJ_SEQCODE_SET
972 *   		OBJ_GENETIC_CODE_SET
973 *
974 *****************************************************************************/
975 NLM_EXTERN Int2 LIBCALL ObjMgrMatch PROTO((Uint2 type1, Uint2 type2));
976 
977 /*****************************************************************************
978 *
979 *   Boolean ObjMgrIsTemp(data)
980 *   	returns TRUE if data is a temporarily loaded item
981 *       data must be BioseqPtr or BioseqSetPtr
982 *
983 *****************************************************************************/
984 NLM_EXTERN Boolean LIBCALL ObjMgrIsTemp PROTO((Pointer data));
985 
986 /*****************************************************************************
987 *
988 *   Boolean ObjMgrIsParent(parent, child)
989 *   	returns TRUE if child is a child of parent
990 *       if parent = NULL, returns TRUE if child has no parent
991 *       child must never be NULL
992 *       returns TRUE if they are the equal
993 *       data must be BioseqPtr or BioseqSetPtr
994 *
995 *****************************************************************************/
996 NLM_EXTERN Boolean LIBCALL ObjMgrIsChild PROTO((Pointer parent, Pointer child));
997 
998 /*****************************************************************************
999 *
1000 *   ObjMgrDump(fp)
1001 *       prints status of internal object manager data for debugging
1002 *
1003 *****************************************************************************/
1004 
1005 NLM_EXTERN void LIBCALL ObjMgrDump PROTO((FILE * fp, CharPtr title));
1006 
1007 /*****************************************************************************
1008 *
1009 *   ObjMgrGetChoiceForData(data)
1010 *   	returns ValNodePtr for a BioseqPtr or BioseqSetPtr
1011 *       choice must have been put in ObjMgr using ObjMgrSeqEntry
1012 *       the Bioseq/BioseqSets it is a part of must also be in ObjMgr
1013 *       returns NULL on failure.
1014 *
1015 *****************************************************************************/
1016 NLM_EXTERN ValNodePtr LIBCALL ObjMgrGetChoiceForData PROTO((Pointer data));
1017 
1018 /*****************************************************************************
1019 *
1020 *   ObjMgrGetEntityIDForChoice(choice)
1021 *   	returns the EntityID for a ValNodePtr
1022 *       choice must have been put in ObjMgr using ObjMgrChoice
1023 *       the Bioseq/BioseqSets it is a part of must also be in ObjMgr
1024 *       This function will move up to the top of the Choice tree it may be
1025 *          in. If top level EntityID is 0, one is assigned at this point.
1026 *       If an element is moved under a different hierarchy, its EntityID will
1027 *          change.
1028 *
1029 *       Either ObjMgrGetEntityIDForPointer() or ObjMgrGetEntityIDForChoice()
1030 *   		MUST be called to have an OM_MSG_CREATE message sent to any
1031 *           registered proceedures
1032 *
1033 *       returns 0 on failure.
1034 *
1035 *****************************************************************************/
1036 NLM_EXTERN Uint2 LIBCALL ObjMgrGetEntityIDForChoice PROTO((ValNodePtr choice));
1037 
1038 /*****************************************************************************
1039 *
1040 *   ObjMgrGetEntityIDForPointer(data)
1041 *   	returns the EntityID for any pointer, Choice or Data
1042 *       This function will move up to the top of the tree it may be
1043 *          in. If top level EntityID is 0, one is assigned at this point.
1044 *       If an element is moved under a different hierarchy, its EntityID will
1045 *          change.
1046 *
1047 *       Either ObjMgrGetEntityIDForPointer() or ObjMgrGetEntityIDForChoice()
1048 *   		MUST be called to have an OM_MSG_CREATE message sent to any
1049 *           registered proceedures
1050 *
1051 *       returns 0 on failure.
1052 *
1053 *****************************************************************************/
1054 NLM_EXTERN Uint2 LIBCALL ObjMgrGetEntityIDForPointer PROTO((Pointer ptr));
1055 
1056 /*****************************************************************************
1057 *
1058 *   ObjMgrGetChoiceForEntityID (id)
1059 *
1060 *****************************************************************************/
1061 NLM_EXTERN ValNodePtr LIBCALL ObjMgrGetChoiceForEntityID PROTO((Uint2 id));
1062 
1063 /*****************************************************************************
1064 *
1065 *   Selection Functions for data objects
1066 *      See also SeqLoc specific selection in seqmgr.h
1067 *
1068 *****************************************************************************/
1069 
1070 /*****************************************************************************
1071 *
1072 *   ObjMgrSelect(entityID, itemID, itemtype, regiontype, region)
1073 *      if entityID == 0, just deselects everything
1074 * if entityID,itemID, itemtype already selected, deselects everything else
1075 *      if something else selected, deselects it first, then selects requested
1076 *        item
1077 *      if regiontype != 0, and restricts to region
1078 *      use ObjMgrAlsoSelect() to avoid implicit deselection of other items
1079 *      returns TRUE if item is now currently selected, FALSE if not
1080 *
1081 *****************************************************************************/
1082 NLM_EXTERN Boolean LIBCALL ObjMgrSelect PROTO((Uint2 entityID, Uint4 itemID,
1083                                                Uint2 itemtype, Uint1 regiontype, Pointer region));
1084 NLM_EXTERN Boolean LIBCALL ObjMgrAlsoSelect PROTO((Uint2 entityID, Uint4 itemID,
1085                                                    Uint2 itemtype, Uint1 regiontype, Pointer region));
1086 
1087 /*****************************************************************************
1088 *
1089 *   ObjMgrSetColor(entityID, itemID, itemtype, regiontype, region, rgb);
1090 *      Sets color of object in displays
1091 *      if regiontype != 0, and restricts to region
1092 *      rgb is a pointer to a Uint1[3] array containing an RGB value.
1093 *
1094 *****************************************************************************/
1095 NLM_EXTERN Boolean LIBCALL ObjMgrSetColor PROTO((Uint2 entityID, Uint4 itemID,
1096                                         Uint2 itemtype, Uint1 regiontype,
1097                                         Pointer region, Uint1Ptr rgb));
1098 
1099 /*****************************************************************************
1100 *
1101 *   ObjMgrDeSelect(entityID, itemID, itemtype)
1102 *   	if this item was selected, then deselects and returns TRUE
1103 *   	else returns FALSE
1104 *
1105 *****************************************************************************/
1106 NLM_EXTERN Boolean LIBCALL ObjMgrDeSelect PROTO((Uint2 entityID, Uint4 itemID,
1107 						 Uint2 itemtype, Uint1 regiontype, Pointer region));
1108 NLM_EXTERN Boolean LIBCALL ObjMgrDeSelectAll PROTO((void));
1109 
1110 /*************************************************************************
1111 *
1112 *   ObjMgrGetSelected() returns a linked list of selected items or NULL
1113 *   	if nothing is selected. Do not modify this list. List may be
1114 *       changed by later calls, so do not keep it.
1115 *
1116 *************************************************************************/
1117 NLM_EXTERN SelStructPtr LIBCALL ObjMgrGetSelected PROTO((void));
1118 
1119 
1120 /*****************************************************************************
1121 *
1122 *   ObjMgrGenericAsnTextFileRead(filename, datatypeptr, entityIDptr)
1123 *      reads an asn1 text file for any datatype registered with the ObjMgr.
1124 *      filename may contain a path
1125 *      scans the start of the file to figure out the type.
1126 *
1127 *      if it fails, it returns NULL
1128 *      if it succeeds, it returns a Pointer to the loaded data object
1129 *          if datatypeptr is not NULL, fills it in with the proper OBJ_...
1130 *          if entityIDptr is not NULL,
1131 *                it registers the data with the object manager
1132 *                it fills in entityIDptr with the entityID of the loaded object
1133 *
1134 *****************************************************************************/
1135 NLM_EXTERN Pointer LIBCALL ObjMgrGenericAsnTextFileRead PROTO((CharPtr filename,
1136                                  Uint2Ptr datatypeptr, Uint2Ptr entityIDptr));
1137 
1138 /******************************************************************************
1139 *
1140 *  ObjMgrMemCopy(type, ptr)
1141 *    Uses AsnIoMemCopy to make a copy of any ObjMgr supported type
1142 *    ObjMgrType for "type" must have been previously loaded
1143 *
1144 ******************************************************************************/
1145 NLM_EXTERN Pointer LIBCALL ObjMgrMemCopy PROTO((Uint2 type, Pointer ptr));
1146 
1147 /******************************************************************************
1148 *
1149 *  ObjMgrFree(type, ptr)
1150 *    ObjMgrType for "type" must have been previously loaded
1151 *
1152 ******************************************************************************/
1153 NLM_EXTERN Pointer LIBCALL ObjMgrFree PROTO((Uint2 type, Pointer ptr));
1154 
1155 /******************************************************************************
1156 *
1157 *  ObjMgrFreeByEntityID(entityID)
1158 *    Obtains type and ptr from ObjMgrDataPtr, then calls ObjMgrFree
1159 *
1160 ******************************************************************************/
1161 NLM_EXTERN Pointer LIBCALL ObjMgrFreeByEntityID PROTO((Uint2 entityID));
1162 
1163 NLM_EXTERN void LIBCALL ObjMgrResetAll PROTO((void));
1164 
1165 /* debugging functions */
1166 
1167 NLM_EXTERN void LIBCALL ObjMgrReportProc (FILE *fp);
1168 NLM_EXTERN void LIBCALL ObjMgrReportFunc (CharPtr filename);
1169 NLM_EXTERN Boolean LIBCALL ObjMgrStatusString (CharPtr str, size_t len);
1170 
1171 
1172 NLM_EXTERN void LIBCALL ObjMgrAddIndexOnEntityID PROTO((ObjMgrPtr omp,Uint2 entityID,ObjMgrDataPtr omdp));
1173 NLM_EXTERN void LIBCALL ObjMgrDeleteIndexOnEntityID PROTO((ObjMgrPtr omp,Uint2 entityID));
1174 NLM_EXTERN ObjMgrDataPtr LIBCALL ObjMgrLookupIndexOnEntityID PROTO((ObjMgrPtr omp,Uint2 entityID));
1175 
1176 NLM_EXTERN Boolean DeleteRemainingViews (Uint2 entityID);
1177 
1178 #ifdef __cplusplus
1179 }
1180 #endif
1181 
1182 #undef NLM_EXTERN
1183 #ifdef NLM_EXPORT
1184 #define NLM_EXTERN NLM_EXPORT
1185 #else
1186 #define NLM_EXTERN
1187 #endif
1188 
1189 #endif
1190 
1191