|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/cn3d/cn3dmsg.c |
source navigation diff markup identifier search freetext search file search |
1 /* cn3dmsg.c
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information (NCBI)
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 do not place any restriction on its use or reproduction.
13 * We would, however, appreciate having the NCBI and the author cited in
14 * any work or product based on this material
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * ===========================================================================
25 *
26 * File Name: cn3dmsg.c
27 *
28 * Author: Yanli Wang
29 *
30 * Version Creation Date: 3/26/98
31 *
32 * File Description: Main functions for building up cn3d/salsa communication
33 *
34 * Modifications:
35 * $Log: cn3dmsg.c,v $
36 * Revision 6.103 2006/07/13 17:08:37 bollin
37 * use Uint4 instead of Uint2 for itemID values
38 *
39 * Revision 6.102 2000/06/16 14:57:03 lewisg
40 * move entrez calls out of desktop
41 *
42 * Revision 6.101 2000/05/19 17:46:57 thiessen
43 * fix redraw from DDV show/hide bug
44 *
45 * Revision 6.100 2000/05/15 23:39:33 lewisg
46 * shred cblast, add menu items for gapped/ungapped, fix pdbheaders
47 *
48 * Revision 6.99 2000/04/27 22:21:57 lewisg
49 * misc bugs/features
50 *
51 * Revision 6.98 2000/04/20 23:27:44 lewisg
52 * misc bug fixes
53 *
54 * Revision 6.97 2000/04/12 19:53:37 lewisg
55 * sequence saving uses genbank class
56 *
57 * Revision 6.96 2000/04/10 21:41:25 lewisg
58 * move alignment menus into ddv, udv from cn3d
59 *
60 * Revision 6.95 2000/04/08 00:37:31 lewisg
61 * multiple seqentries, NEWSEQ message, etc.
62 *
63 * Revision 6.94 2000/04/05 23:11:28 lewisg
64 * get rid of double redraw for hide row
65 *
66 * Revision 6.93 2000/03/18 00:06:00 lewisg
67 * add blast, new help, new menus
68 *
69 * Revision 6.92 2000/03/15 19:32:20 lewisg
70 * launch only single udv window
71 *
72 * Revision 6.91 2000/03/08 21:46:14 lewisg
73 * cn3d saves viewport, misc bugs
74 *
75 * Revision 6.90 2000/03/02 21:11:05 lewisg
76 * use bandalign for import sequence, make standalone ddv use viewmgr, make dialogs modal, send color update
77 *
78 * Revision 6.89 2000/03/01 22:49:41 lewisg
79 * import bioseq, neatlyindex, get rid of dead code
80 *
81 * Revision 6.88 2000/02/19 01:23:59 lewisg
82 * use ibm, add row tracking code, various bug fixes
83 *
84 * Revision 6.87 2000/02/15 22:40:57 lewisg
85 * add ability to launch udv so that it colors by row, fixes to colormgr, track rows from viewmgr, fix visual c projects
86 *
87 * Revision 6.86 2000/02/10 15:51:59 lewisg
88 * cn3d responds and send correct update messages. many coloring bug fixes
89 *
90 * Revision 6.85 2000/02/07 20:17:37 lewisg
91 * minor bug fixes, use gui font for win32
92 *
93 * Revision 6.84 2000/02/05 01:32:21 lewisg
94 * add viewmgr, move place freeing is done in ddv, modify visual c++ projects
95 *
96 * Revision 6.83 2000/01/18 22:49:16 lewisg
97 * send OM_MSG_FLUSH to ddv/udv, tweak CPK coloration, misc bugs
98 *
99 * Revision 6.82 2000/01/11 01:16:47 lewisg
100 * fix color selection in Cn3D, other misc. bugs
101 *
102 * Revision 6.81 2000/01/08 23:16:26 lewisg
103 * add missing ifdef
104 *
105 * Revision 6.80 2000/01/08 00:47:53 lewisg
106 * fixes to selection, update, color
107 *
108 * Revision 6.79 2000/01/06 01:19:40 kans
109 * fixed SendUpdate problem found by Mac compiler
110 *
111 * Revision 6.78 2000/01/06 00:04:42 lewisg
112 * selection bug fixes, update message outbound, animation APIs moved to vibrant
113 *
114 * Revision 6.77 2000/01/04 15:55:50 lewisg
115 * don't hang on disconnected network and fix memory leak/hang at exit
116 *
117 * Revision 6.76 1999/12/28 23:06:35 lewisg
118 * udv/cn3d communication
119 *
120 * Revision 6.75 1999/12/28 15:08:44 lewisg
121 * remove remaining mediainfo code
122 *
123 * Revision 6.74 1999/12/15 23:17:47 lewisg
124 * make cn3d launch udv, fix launching of non-autonomous udv, add mouseup message
125 *
126 * Revision 6.73 1999/12/11 01:30:35 lewisg
127 * fix bugs with sharing colors between ddv and cn3d
128 *
129 * Revision 6.72 1999/12/03 23:17:23 lewisg
130 * Patrick's new global update msg, argument passing when launching ddv, experimental editing
131 *
132 * Revision 6.71 1999/12/02 20:31:59 lewisg
133 * put seqentries into bioseqset and fix calling convention in alignmgr.c
134 *
135 * Revision 6.70 1999/12/01 19:06:07 thiessen
136 * added alignmgr.h header
137 *
138 * Revision 6.69 1999/12/01 16:15:54 lewisg
139 * interim checkin to fix blocking memory leak
140 *
141 * Revision 6.68 1999/11/24 21:44:19 vakatov
142 * Minor formal fixes
143 *
144 * Revision 6.67 1999/11/24 15:23:19 lewisg
145 * added color selection dialogs for SS
146 *
147 * Revision 6.66 1999/11/22 17:29:54 lewisg
148 * add back color selection dialogs, fix viewer3d half-selection bug
149 *
150 * Revision 6.65 1999/11/22 14:46:44 thiessen
151 * moved _OPENGL code blocks to only vibrant and ncbicn3d libraries
152 *
153 * Revision 6.64 1999/11/18 00:21:42 lewisg
154 * draw speedups and selection on mouseup
155 *
156 * Revision 6.63 1999/11/15 18:30:08 lewisg
157 * get rid of extra redraws when selecting
158 *
159 * Revision 6.62 1999/11/12 16:06:34 lewisg
160 * fix sequentry to valnode conversion
161 *
162 * Revision 6.61 1999/11/10 23:19:41 lewisg
163 * rewrite of selection code for ddv
164 *
165 * Revision 6.60 1999/11/03 18:15:10 kans
166 * added prototypes needed by other files
167 *
168 * Revision 6.59 1999/11/02 23:06:07 lewisg
169 * fix cn3d to launch correctly if there is no seqentry associated with bioseq
170 *
171 * Revision 6.58 1999/11/01 22:10:27 lewisg
172 * add ability to call color functions by type, and add this to cn3d
173 *
174 * Revision 6.57 1999/10/29 14:15:29 thiessen
175 * ran all Cn3D source through GNU Indent to prettify
176 *
177 * Revision 6.56 1999/10/15 20:56:39 lewisg
178 * append DDV_ColorGlobal as userdata. free memory when cn3d terminates.
179 *
180 * Revision 6.55 1999/10/06 00:01:25 kans
181 * minor changes
182 *
183 * Revision 6.54 1999/10/05 23:18:20 lewisg
184 * add ddv and udv to cn3d with memory management
185 *
186 * Revision 6.53 1999/09/21 18:09:15 lewisg
187 * binary search added to color manager, various bug fixes, etc.
188 *
189 * Revision 6.52 1999/08/04 21:18:01 lewisg
190 * modularized open operations to allow sequin to launch cn3d
191 *
192 * Revision 6.51 1999/07/09 20:50:55 ywang
193 * set highlight color for salsa in Cn3dObjRegiste
194 *
195 * Revision 6.50 1999/07/08 20:41:02 ywang
196 * ignore message on features
197 *
198 * Revision 6.49 1999/07/07 20:45:36 ywang
199 * clear domaindata, mediadata, special feature before reading in new data in cn3d
200 *
201 * Revision 6.48 1999/06/14 17:38:01 ywang
202 * comment out 'BioseqLockById failed in MediaLaunch'
203 *
204 * Revision 6.47 1999/05/27 16:11:21 ywang
205 * initilize all local variables at defined
206 *
207 * Revision 6.46 1999/05/27 14:13:09 ywang
208 * change comment in ErrPost
209 *
210 * Revision 6.45 1999/05/25 22:04:57 ywang
211 * always check mediadata->length before assigning residue information for mediadata to protect memory from corruption upon weird data
212 *
213 * Revision 6.44 1999/04/22 21:10:07 ywang
214 * fix breaks
215 *
216 * Revision 6.43 1999/03/30 22:36:19 ywang
217 * add functions to color salsa for NcbiMimeAsn1_strucseqs & code reorganization
218 *
219 * Revision 6.42 1999/03/03 23:17:22 lewisg
220 * one master struct at a time, list slaves in structure info, bug fixes
221 *
222 * Revision 6.41 1999/01/20 18:21:20 ywang
223 * include salmedia.h due to the move around of MediaInfo from cn3dmsg.h to the new created salmedia.h
224 *
225 * Revision 6.40 1999/01/14 19:07:17 kans
226 * network availability is configurable
227 *
228 * Revision 6.39 1999/01/14 14:15:16 kans
229 * do not call EntrezBioseqFetchEnable/Disable, calls GatherSpecificProcLaunch for Seq-Struc Communication
230 *
231 * Revision 6.38 1998/12/16 20:13:33 ywang
232 * remove return warning for FillSeqinfoForSeqEditViewProcs
233 *
234 * Revision 6.37 1998/12/09 20:41:18 ywang
235 * get rid of GetGIForSeqId
236 *
237 * Revision 6.36 1998/10/27 15:55:52 ywang
238 * add functions for testing color by sequence conservation
239 *
240 * Revision 6.35 1998/10/21 21:16:07 ywang
241 * put highlight RGB in the application property structure
242 *
243 * Revision 6.34 1998/10/19 20:16:05 ywang
244 * add function FillSeqinfoForSeqEditViewProcs so that salsa can get color array
245 *
246 * Revision 6.33 1998/10/16 22:06:08 ywang
247 * make global color array for sequence display
248 *
249 * Revision 6.32 1998/09/23 22:08:42 ywang
250 * to record checkin log
251 *
252 * =========================================================================== */
253
254 #include <vibrant.h>
255 #include <document.h>
256 #include <vsm.h>
257 #include <sequtil.h> /* for sequence load funcs */
258 #include <objsub.h>
259 #include <string.h>
260 #include <objmgr.h>
261 #include <cn3dmsg.h>
262 #include <mmdbapi.h>
263 #include <accentr.h>
264 #include <lsqfetch.h>
265 #include <cn3dmain.h>
266 #include <samutil.h>
267 #include <sqnutils.h>
268 #include <algorend.h>
269 #include <cn3dshim.h>
270 #include <alignmgr.h>
271 #include <cn3dopen.h>
272 #include <cn3dmodl.h>
273
274
275 void Cn3D_RegisterColor(void)
276 {
277 DDV_ColorQueue *pColorQueue;
278 Int4 i;
279
280 /* add the regular coloring functions for residues */
281 for (i = 0; i < CN3DFUNCNUM; i++) {
282 pColorQueue = DDV_NewColorQueue(Cn3D_ColorList[i].Function,
283 Cn3D_ColorList[i].Name, DDV_PRILO, FALSE, Cn3D_ColorData.sepprocid);
284 DDV_AddColorFunc(Cn3D_ColorData.pDDVColorGlobal, pColorQueue);
285 }
286
287 /* add the user defined colors as an override */
288 pColorQueue = DDV_NewColorQueue(Cn3D_ColorSpecial, "Cn3D Special",
289 DDV_PRIHI, TRUE, Cn3D_ColorData.sepprocid);
290 DDV_AddColorFunc(Cn3D_ColorData.pDDVColorGlobal, pColorQueue);
291 }
292
293
294 /*****************************************************************************
295
296 Function: Cn3D_LaunchSeqEntry()
297
298 Purpose: Launch the Bioseq viewer on all Bioseqs contained in a SeqEntry.
299
300 Parameters: pvnsep, the valnode list of SeqEntries
301
302 *****************************************************************************/
303
304 static void Cn3D_SetRect(RecT *Rect)
305 {
306 RecT cn3drc;
307
308 if(Rect == NULL) return;
309 ObjectRect(Cn3D_ColorData.Cn3D_w, &cn3drc);
310 Rect->top = cn3drc.bottom + 50;
311 Rect->bottom = screenRect.bottom - 100;
312 if(Rect->bottom - Rect->top < 200) Rect->top =
313 Rect->bottom - 200;
314 if(Rect->bottom - Rect->top > 300) Rect->top =
315 Rect->bottom - 300;
316 Rect->left = cn3drc.left;
317 Rect->right = screenRect.right - 100;
318 if(Rect->right - Rect->left < 400) Rect->left =
319 Rect->right - 400;
320 }
321
322 void Cn3D_LaunchSeqEntry(ValNode * pvnsep)
323 {
324 Uint2 entityID;
325 SAM_ViewGlobal vg;
326
327 MemSet(&vg, 0, sizeof(SAM_ViewGlobal));
328 Cn3D_SetRect((RecT *)&vg.Rect);
329 vg.MasterViewer = SAMVIEWCN3D;
330 vg.FetchProc = NULL;
331 vg.NetStartProc = Cn3D_StartNet;
332 vg.BlastFile = (void *)Cn3D_ImportBioseqFile;
333 vg.BlastFileGap = (void *)Cn3D_ImportBioseqFileGap;
334 vg.BlastNet = (void *)Cn3D_ImportBioseq;
335 vg.BlastNetGap = (void *)Cn3D_ImportBioseqGap;
336 #if 0
337 vg.BlastMany = (void *)Cn3D_BlastDlg;
338 #endif
339 SetAppProperty(SAM_ViewString, &vg);
340 entityID = ObjMgrGetEntityIDForPointer(pvnsep);
341
342 GatherSpecificProcLaunch(0, "OneD-Viewer SE", OMPROC_VIEW,
343 FALSE, entityID, 0, OBJ_BIOSEQSET);
344 RemoveAppProperty(SAM_ViewString);
345
346 }
347
348 /*****************************************************************************
349
350 Function: Cn3D_RegisterSeqEntry()
351
352 Purpose: Adds a message func to the SeqEntry and makes it
353 OM_OPT_FREE_IF_NO_VIEW
354
355 Parameters: pvnsep, a valnode list of SeqEntries
356
357 *****************************************************************************/
358
359 void Cn3D_RegisterSeqEntry(ValNode * pvnsep)
360 {
361 Int2 entityID;
362 SeqEntry *sep = NULL;
363 BioseqSet *bssp;
364
365 if(pvnsep == NULL) return;
366 if(pvnsep->choice == 2)
367 if(((BioseqSet *)pvnsep->data.ptrvalue)->_class ==
368 BioseqseqSet_class_genbank) sep = pvnsep;
369
370 if(!sep) {
371 bssp = BioseqSetNew ();
372 if (bssp == NULL) return;
373 bssp->_class = BioseqseqSet_class_genbank;
374 bssp->seq_set = pvnsep;
375
376 sep = SeqEntryNew ();
377 if (sep == NULL) return;
378 sep->choice = 2; /* Bioseq-set */
379 sep->data.ptrvalue = (Pointer) bssp;
380 sep->next = NULL;
381 }
382
383 SeqMgrLinkSeqEntry(sep, 0, NULL);
384
385 entityID = ObjMgrGetEntityIDForPointer(sep);
386 Cn3D_ColorData.pvnsep = sep;
387
388 GatherSpecificProcLaunch(0, "Seq-Struc Communication", OMPROC_VIEW,
389 FALSE, entityID, 0, OBJ_BIOSEQSET);
390 SAM_MakeViewerFree((void *) sep);
391 if(Cn3D_ColorData.pDDVColorGlobal == NULL) {
392 Cn3D_ColorData.pDDVColorGlobal = DDV_GetColorGlobalEx((void *) sep);
393 DDV_LoadSSColor(Cn3D_ColorData.pDDVColorGlobal, "CN3D");
394 }
395 Cn3D_RegisterColor();
396 }
397
398
399 /*****************************************************************************
400
401 Function: Cn3D_LaunchSeqAnnot()
402
403 Purpose: Launch the SeqAlign viewer on all SeqAligns contained in a SeqAnnot.
404
405 Parameters: sap, the SeqAnnot
406
407 *****************************************************************************/
408
409 void Cn3D_LaunchSeqAnnot(SeqAnnot * sap)
410 {
411 Uint2 entityID;
412 Uint4 itemID;
413 SeqAlign *salp;
414 SAM_ViewGlobal vg;
415 RecT cn3drc;
416
417 MemSet(&vg, 0, sizeof(SAM_ViewGlobal));
418
419 for (; sap != NULL; sap = sap->next) {
420 if (sap->data == NULL)
421 continue;
422 salp = sap->data;
423 entityID = ObjMgrGetEntityIDForPointer(salp);
424
425 itemID =
426 GetItemIDGivenPointer(entityID, OBJ_SEQALIGN, (void *) salp);
427
428 ObjectRect(Cn3D_ColorData.Cn3D_w, &cn3drc);
429 Cn3D_SetRect((RecT *)&vg.Rect);
430 vg.MasterViewer = SAMVIEWCN3D;
431 vg.FetchProc = NULL;
432 vg.NetStartProc = Cn3D_StartNet;
433 vg.BlastFile = (void *)Cn3D_ImportBioseqFile;
434 vg.BlastFileGap = (void *)Cn3D_ImportBioseqFileGap;
435 vg.BlastNet = (void *)Cn3D_ImportBioseq;
436 vg.BlastNetGap = (void *)Cn3D_ImportBioseqGap;
437 #if 0
438 vg.BlastMany = (void *)Cn3D_BlastDlg;
439 #endif
440 SetAppProperty(SAM_ViewString, &vg);
441 GatherSpecificProcLaunch(0, "DDV", OMPROC_VIEW,
442 FALSE, entityID, itemID, OBJ_SEQALIGN);
443
444 RemoveAppProperty(SAM_ViewString);
445 }
446 }
447
448 /*****************************************************************************
449
450 Function: Cn3D_CountRows()
451
452 Purpose: figures out the number of rows in the SeqAlign
453
454 Parameters: salp, the SeqAlign corresponding to the vast alignment.
455
456 *****************************************************************************/
457
458 NLM_EXTERN Int4 Cn3D_CountRows(SeqAlign *salp)
459 {
460 SeqAlign *salptmp;
461 Int4 retval;
462
463 if(salp == NULL) return 0;
464
465 salptmp = SeqAlignListDup(salp);
466 AlnMgrNeatlyIndex(salptmp);
467 AlnMgrMakeMultByIntersectOnMaster(salptmp, TRUE);
468 retval = AlnMgrGetNumRows(salptmp);
469 SeqAlignListFree(salptmp);
470 return retval;
471 }
472
473
474 /*****************************************************************************
475
476 Function: Cn3D_RegisterSeqAnnot()
477
478 Purpose: Adds a message func to the SeqAnnot and makes it
479 OM_OPT_FREE_IF_NO_VIEW
480
481 Parameters: sap, the SeqAnnot pointer
482
483 *****************************************************************************/
484
485 void Cn3D_RegisterSeqAnnot(SeqAnnot *sap, Boolean Neat, Boolean IBM)
486 {
487 Int2 entityID;
488 SeqAlign *salp;
489
490 Cn3D_ColorData.sap = sap;
491
492 /* index the seq aligns */
493 for (; sap != NULL; sap = sap->next) {
494 if (sap->data == NULL) continue;
495 salp = sap->data;
496 entityID = ObjMgrRegister(OBJ_SEQALIGN, (void *) salp);
497 GatherSpecificProcLaunch(0, "Cn3D SeqAnnot", OMPROC_VIEW,
498 FALSE, entityID, 0, OBJ_SEQALIGN);
499 SAM_MakeViewerFree((void *) salp);
500 if(Cn3D_ColorData.pDDVColorGlobal == NULL) {
501 Cn3D_ColorData.pDDVColorGlobal = DDV_GetColorGlobalEx((void *) salp);
502 DDV_LoadSSColor(Cn3D_ColorData.pDDVColorGlobal, "CN3D");
503 }
504 else DDV_GetColorGlobalEx((void *) salp);
505
506 /* if(!AlnMgrIndexSeqAlign(salp)) {
507 ErrPostEx(SEV_ERROR, 0, 0, "Alignment not in correct format");
508 return;
509 } */
510 ViewMgr_RemoveSA(salp); /* make sure it isn't there */
511 ViewMgr_Attach(salp, Neat, IBM, 0, 0);
512 }
513 }
514
515
516 /*****************************************************************************
517
518 Function: Cn3D_SendUpdate()
519
520 Purpose: Sends an update message to everyone about everything.
521
522 *****************************************************************************/
523
524 NLM_EXTERN void Cn3D_SendUpdate()
525 {
526 DDVUpdateMSG dump;
527 Uint2 entityID;
528 Uint4 itemID;
529 SeqAlign *salp;
530 SeqAnnot *sap;
531 ValNode *pvnSips, *pvnSipsHold, *pvnsep;
532 SeqId *sip;
533
534 dump.data = NULL;
535 dump.type = UPDATE_TYPE_COLOR;
536
537 for (sap = Cn3D_ColorData.sap; sap != NULL; sap = sap->next) {
538 if (sap->data == NULL) continue;
539 salp = sap->data;
540 entityID = ObjMgrGetEntityIDForPointer(salp);
541 itemID =
542 GetItemIDGivenPointer(entityID, OBJ_SEQALIGN, (void *) salp);
543
544 ObjMgrSendProcMsg(OM_MSG_UPDATE, entityID,itemID,
545 OBJ_SEQALIGN,0,0,(Pointer)&dump);
546 }
547
548 for(pvnsep = Cn3D_ColorData.pvnsep; pvnsep != NULL;
549 pvnsep = pvnsep->next) {
550 pvnSips = SAM_ExtractSips(Cn3D_ColorData.pvnsep);
551 if (pvnSips != NULL) {
552 pvnSipsHold = pvnSips;
553
554 for (; pvnSips != NULL; pvnSips = pvnSips->next) {
555 sip = (SeqId *) pvnSips->data.ptrvalue;
556 if (sip == NULL) continue;
557 entityID = BioseqFindEntity(sip, &itemID);
558
559 ObjMgrSendProcMsg(OM_MSG_UPDATE, entityID,itemID,
560 OBJ_BIOSEQ,0,0,(Pointer)&dump);
561 }
562 ValNodeFree(pvnSipsHold);
563 }
564 }
565 }
566
567
568 /* check to see if there is any visible row in the pdmnsThis */
569 static Boolean Cn3D_IsVisibleRow(PDNMS pdnmsThis)
570 {
571 PMSD pmsdThis;
572 PDNMM pdvn;
573 PMMD pmmdThis;
574 Boolean retval = FALSE;
575
576 if(!Cn3D_ColorData.sap || pdnmsThis == NULL) return FALSE;
577 pmsdThis = (PMSD) pdnmsThis->data.ptrvalue;
578 for(pdvn = pmsdThis->pdnmmHead; pdvn != NULL; pdvn = pdvn->next){
579 pmmdThis = (PMMD)pdvn->data.ptrvalue;
580 if(pmmdThis) {
581 if(ViewMgr_TRow2VRow((SeqAlign *)Cn3D_ColorData.sap->data,
582 pmmdThis->iTargetRow) > 0) retval = TRUE;
583 }
584 }
585 pmsdThis->bVisible = retval;
586 return retval;
587 }
588
589
590 /*-----------------------------------------*/
591 static Int2 LIBCALLBACK SeqStrucMediaMsgFunc(OMMsgStructPtr ommsp)
592 {
593 OMUserDataPtr omudp = NULL;
594 DDVUpdateMSGPtr dump = NULL;
595 SelStructPtr sel = NULL;
596 PDNMS pdnmsThis;
597 PMSD pmsdThis;
598 omudp = (OMUserDataPtr) (ommsp->omuserdata);
599
600 switch (ommsp->message) {
601 case OM_MSG_UPDATE:
602
603 dump = (DDVUpdateMSGPtr)(ommsp->procmsgdata);
604
605 /* ignore generic UPDATE msg*/
606 if (!dump) break;
607
608 switch(dump->type){
609 case UPDATE_TYPE_RECOLOR:
610 pdnmsThis = GetSelectedModelstruc();
611 if (pdnmsThis) {
612 Cn3D_IsVisibleRow(pdnmsThis);
613 MakeStrucPalette(pdnmsThis);
614 pmsdThis = (PMSD)pdnmsThis->data.ptrvalue;
615 for (pdnmsThis = pmsdThis->pdnmsSlaves; pdnmsThis != NULL;
616 pdnmsThis = pdnmsThis->next) {
617 Cn3D_IsVisibleRow(pdnmsThis);
618 MakeStrucPalette(pdnmsThis);
619 }
620 }
621 Cn3D_SetStrucList();
622 Cn3D_ListDomainProc();
623 break;
624 case UPDATE_TYPE_VIEWMGR:
625 #ifdef _OPENGL
626 if(OGL_IsPlaying(Cn3D_ColorData.OGL_Data))
627 OGL_StopPlaying(Cn3D_ColorData.OGL_Data);
628 OGL_AllLayerOnProc(Cn3D_ColorData.OGL_Data);
629 #else /* _OPENGL */
630 if(IsPlaying3D()) StopPlaying3D();
631 Nlm_AllLayerSet3D(Cn3D_v3d, TRUE);
632 #endif /* else _OPENGL */
633 Cn3D_DisplayProc(NULL);
634 /*Cn3D_Redraw(FALSE);*/
635
636 break;
637 default:
638 break;
639 }
640 break;
641
642 case OM_MSG_SELECT:
643
644 if (ommsp->itemtype == OBJ_SEQALIGN)
645 return OM_MSG_RET_OK;
646 if (ommsp->itemtype == OBJ_SEQFEAT)
647 return OM_MSG_RET_OK;
648
649 sel = ObjMgrGetSelected();
650 while (sel != NULL) {
651 MediaHL(sel, TRUE); /* highlight in cn3d */
652 sel = sel->next;
653 }
654
655 break;
656
657 case OM_MSG_DESELECT:
658
659 if (ommsp->itemtype == OBJ_SEQALIGN)
660 return OM_MSG_RET_OK;
661 if (ommsp->itemtype == OBJ_SEQFEAT)
662 return OM_MSG_RET_OK;
663
664 sel = (SelStructPtr) MemNew(sizeof(SelStruct));
665 sel->entityID = ommsp->entityID;
666 sel->itemtype = ommsp->itemtype;
667 sel->itemID = ommsp->itemID;
668 sel->region = ommsp->region;
669 sel->regiontype = ommsp->regiontype;
670 if (sel) MediaHL(sel, FALSE); /* highlight in cn3d */
671
672 break;
673
674 case OM_MSG_MOUSEUP:
675 if (ommsp->itemtype == OBJ_SEQFEAT)
676 return OM_MSG_RET_OK;
677
678 #ifdef _OPENGL
679 if(OGL_IsPlaying(Cn3D_ColorData.OGL_Data)) {
680 OGL_StopPlaying(Cn3D_ColorData.OGL_Data);
681 OGL_AllLayerOnProc(Cn3D_ColorData.OGL_Data);
682 }
683 #else /* _OPENGL */
684 if(IsPlaying3D()) {
685 StopPlaying3D();
686 Nlm_AllLayerSet3D(Cn3D_v3d, TRUE);
687 }
688 #endif /* else _OPENGL */
689 Cn3D_Redraw(FALSE);
690 break;
691 }
692
693 return OM_MSG_RET_OK;
694
695 }
696
697 /*-----------------------------------------*/
698 extern Int2 LIBCALLBACK SeqStrucMediaFunc(Pointer data)
699 {
700 OMProcControlPtr ompcp = NULL;
701 OMUserDataPtr omudp = NULL;
702
703 ompcp = (OMProcControlPtr) data;
704
705 if (ompcp == NULL) {
706 Message(MSG_ERROR, "Data NULL [1]");
707 return OM_MSG_RET_ERROR;
708 }
709
710 if( ompcp->proc == NULL) {
711 Message(MSG_ERROR, "Data NULL [2]");
712 return OM_MSG_RET_ERROR;
713 }
714
715 switch (ompcp->input_itemtype) {
716 case OBJ_BIOSEQSET:
717 case OBJ_BIOSEQ:
718 break;
719 default:
720 return OM_MSG_RET_ERROR;
721 }
722
723 if (ompcp->input_data == NULL) {
724 Message(MSG_ERROR, "Data NULL [3]");
725 return OM_MSG_RET_ERROR;
726 }
727
728 Cn3D_ColorData.sepprocid = ompcp->proc->procid;
729
730 omudp =
731 ObjMgrAddUserData(ompcp->input_entityID, ompcp->proc->procid,
732 OMPROC_VIEW, Cn3D_ColorData.userkey);
733 if (omudp != NULL) {
734 omudp->messagefunc = SeqStrucMediaMsgFunc;
735 }
736 return OM_MSG_RET_OK;
737
738 }
739
740 /*****************************************************************************
741
742 Function: Cn3D_AnnotEditFunc()
743
744 Purpose: The object manager callback to register a SeqAnnot.
745
746 Parameters: data, the OMProcControlPtr.
747
748 Returns: OM_MSG_RET_*
749
750 *****************************************************************************/
751
752 extern Int2 LIBCALLBACK Cn3D_AnnotEditFunc(Pointer data)
753 {
754 OMProcControlPtr ompcp = NULL;
755 OMUserDataPtr omudp = NULL;
756
757 ompcp = (OMProcControlPtr) data;
758 if (ompcp == NULL) {
759 Message(MSG_ERROR, "Data NULL [1]");
760 return OM_MSG_RET_ERROR;
761 }
762
763 if( ompcp->proc == NULL) {
764 Message(MSG_ERROR, "Data NULL [2]");
765 return OM_MSG_RET_ERROR;
766 }
767
768 switch (ompcp->input_itemtype) {
769 case OBJ_SEQANNOT:
770 case OBJ_SEQALIGN:
771 break;
772 case 0:
773 return OM_MSG_RET_ERROR;
774 default:
775 return OM_MSG_RET_ERROR;
776 }
777
778 if (ompcp->input_data == NULL) {
779 Message(MSG_ERROR, "Data NULL [3]");
780 return OM_MSG_RET_ERROR;
781 }
782 Cn3D_ColorData.sapprocid = ompcp->proc->procid;
783 omudp = ObjMgrAddUserData(ompcp->input_entityID, ompcp->proc->procid,
784 OMPROC_EDIT, Cn3D_ColorData.userkey);
785 if (omudp != NULL) {
786 omudp->messagefunc = SeqStrucMediaMsgFunc;
787 }
788
789 return OM_MSG_RET_OK;
790 }
791 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |