|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/ddv/ddvpanel.c |
source navigation diff markup identifier search freetext search file search |
1 /* $Id: ddvpanel.c,v 1.109 2006/07/13 17:11:42 bollin Exp $
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: ddvpanel.c
27 *
28 * Author: Patrick Durand
29 *
30 * Version Creation Date: 06/19/99
31 *
32 * $Revision: 1.109 $
33 *
34 * File Description: window management module of DeuxD-Viewer (DDV)
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * $Log: ddvpanel.c,v $
39 * Revision 1.109 2006/07/13 17:11:42 bollin
40 * use Uint4 instead of Uint2 for itemID values
41 *
42 * Revision 1.108 2004/04/01 13:43:06 lavr
43 * Spell "occurred", "occurrence", and "occurring"
44 *
45 * Revision 1.107 2000/08/30 14:31:28 hurwitz
46 * quick fix so build does not crash
47 *
48 * Revision 1.106 2000/07/25 20:30:23 hurwitz
49 * bug fixes: panel update when file is closed, double-click launches UDV from DDE, seqName agrees in status line and left col
50 *
51 * Revision 1.105 2000/07/24 22:00:09 hurwitz
52 * fixed bug that 1/2 characters were displayed sometimes
53 *
54 * Revision 1.104 2000/07/20 22:25:57 hurwitz
55 * bug fix. mouse-mode query working again
56 *
57 * Revision 1.103 2000/07/19 19:04:02 hurwitz
58 * fixed bug that was causing overwrite of numbering over tick marks in DDE
59 *
60 * Revision 1.102 2000/07/17 13:32:33 lewisg
61 * move DDV_args out of the library
62 *
63 * Revision 1.101 2000/07/17 12:38:53 kans
64 * DDV_myargs is extern in header, instantiated in ddvpanel.c, since it is accessed from that library file
65 *
66 * Revision 1.100 2000/07/14 22:24:56 lewisg
67 * fix scroll, click, visual c++ build bugs. add command line arg parse to ddv
68 *
69 * Revision 1.99 2000/07/12 22:22:41 hurwitz
70 * added delete block to DDV
71 *
72 * Revision 1.98 2000/07/10 14:38:08 lewisg
73 * move seqalign and sequentry data from window to panels
74 *
75 * Revision 1.97 2000/07/07 22:31:14 lewisg
76 * interface tweaks
77 *
78 * Revision 1.96 2000/07/05 19:23:13 lewisg
79 * add two panes to ddv, update msvc project files
80 *
81 * Revision 1.95 2000/07/05 18:42:16 hurwitz
82 * added split block function to DDV
83 *
84 * Revision 1.94 2000/06/30 22:31:51 hurwitz
85 * added merge block function for DDV
86 *
87 * Revision 1.93 2000/06/29 23:15:13 hurwitz
88 * leave single space between aligned blocks with no unaligned sequence between them, no auto-merge of adjacent aligned blocks
89 *
90 * Revision 1.92 2000/06/27 20:46:38 hurwitz
91 * fixed bugs with select rectangle, added select row option
92 *
93 * Revision 1.91 2000/06/22 20:56:51 hurwitz
94 * assorted bug fixes
95 *
96 * Revision 1.90 2000/06/20 19:35:11 hurwitz
97 * use indexed seqAlign when necessary, make multiple when redrawing
98 *
99 * Revision 1.89 2000/06/15 20:26:05 hurwitz
100 * added left/right/center justify for DDE
101 *
102 * Revision 1.88 2000/06/15 17:33:18 hurwitz
103 * used view seqAlignPtr to get original (bug fix), and started working on left/right/center justify for DDE
104 *
105 * Revision 1.87 2000/06/15 16:01:07 hurwitz
106 * rewrote section that calls ViewMgr_Attach when SeqAlign is not editable but IBMable
107 *
108 * Revision 1.86 2000/06/12 23:02:40 hurwitz
109 * enable launch of DDE from Cn3D, swith from DDV_ComputeRuler to DDE_ReMakeRuler, get rid of styles option for DDE
110 *
111 * Revision 1.85 2000/06/08 20:04:39 hurwitz
112 * made warning about converting to true multiple alignment into a Message window, and other small fixes
113 *
114 * Revision 1.84 2000/06/02 19:57:03 hurwitz
115 * added a query dialog when converting from pairwise multiple to true multiple, bug fix of double freeing of a seqAlignPtr
116 *
117 * Revision 1.83 2000/05/31 23:07:26 hurwitz
118 * made NoGaps a runtime parameter, fixed bug with vertical scroll of show/hide list, save edits query is not performed if nothing to save
119 *
120 * Revision 1.82 2000/05/25 21:40:43 hurwitz
121 * rows hidden in DDV are hidden in DDE, can save edits when rows are hidden in DDE
122 *
123 * Revision 1.81 2000/05/24 21:43:00 hurwitz
124 * getting hide/show rows to work with DDV and DDE together
125 *
126 * Revision 1.80 2000/05/23 22:00:15 hurwitz
127 * working on launch of DDE from DDV
128 *
129 * Revision 1.79 2000/05/19 13:48:31 hurwitz
130 * made a version of DDE that doesn't allow aligned gaps, changed wording for adding new rows
131 *
132 * Revision 1.78 2000/05/16 19:43:01 hurwitz
133 * grey out create block, delete block, undo, and redo as needed
134 *
135 * Revision 1.77 2000/05/15 23:39:34 lewisg
136 * shred cblast, add menu items for gapped/ungapped, fix pdbheaders
137 *
138 * Revision 1.76 2000/05/15 22:00:36 hurwitz
139 * put save-edits query into DDV_SlaveQuit where it belongs
140 *
141 * Revision 1.75 2000/05/12 21:18:13 hurwitz
142 * added window asking if user wants to save unsaved edits for dde
143 *
144 * Revision 1.74 2000/05/10 21:54:54 hurwitz
145 * free memory when DDE is closed
146 *
147 * Revision 1.73 2000/05/10 16:17:00 hurwitz
148 * can show tails for just 1 aligned block
149 *
150 * Revision 1.72 2000/05/09 17:56:49 hurwitz
151 * bug fix of vertical scrolling problem
152 *
153 * Revision 1.71 2000/05/08 22:48:33 hurwitz
154 * on launch of DDE, merge nodes that are same MsaTxtDisp alignment and gap
155 *
156 * Revision 1.70 2000/05/05 20:24:13 hurwitz
157 * some bug fixes, also redraw proper block in DDE after a save operation that causes a merge of 2 blocks
158 *
159 * Revision 1.69 2000/05/04 22:43:38 hurwitz
160 * don't launch DDE on top of DDV, change some wording, redraw DDE after save to AlnMgr
161 *
162 * Revision 1.68 2000/04/28 14:43:37 hurwitz
163 * send message to DDV after edits in DDE are accepted by AlnMgr
164 *
165 * Revision 1.67 2000/04/27 22:24:36 lewisg
166 * misc bugs
167 *
168 * Revision 1.66 2000/04/27 20:05:54 kans
169 * added stub functions for Sequin
170 *
171 * Revision 1.65 2000/04/27 19:57:59 hurwitz
172 * scroll to aligned block on launch of DDE
173 *
174 * Revision 1.64 2000/04/27 15:38:02 hurwitz
175 * changed wording on menu
176 *
177 * Revision 1.63 2000/04/27 13:33:42 durand
178 * SpacerSize min value fixed to 1; update view when SpacerSize is changed
179 *
180 * Revision 1.62 2000/04/26 21:54:27 hurwitz
181 * added save function to tell AlnMgr about edits made in DDE
182 *
183 * Revision 1.61 2000/04/21 23:00:50 hurwitz
184 * can launch DDE from DDV
185 *
186 * Revision 1.60 2000/04/18 19:50:26 lewisg
187 * add deselect menu item
188 *
189 * Revision 1.59 2000/04/17 21:46:56 lewisg
190 * do not do double index on viewmgr update, rename menus
191 *
192 * Revision 1.58 2000/04/10 21:41:26 lewisg
193 * move alignment menus into ddv, udv from cn3d
194 *
195 * Revision 1.57 2000/04/10 20:58:42 hurwitz
196 * added GUI controls for DeleteBlock in DDE
197 *
198 * Revision 1.56 2000/04/07 16:21:08 hurwitz
199 * made delete block faster, added delete block to edit menu
200 *
201 * Revision 1.55 2000/03/31 19:33:50 durand
202 * added DDV_ShowHideUnAlignGap for import seq. debugging purpose
203 *
204 * Revision 1.54 2000/03/27 22:15:08 lewisg
205 * add show/hide row dialog
206 *
207 * Revision 1.53 2000/03/25 00:22:09 hurwitz
208 * put DDE_StackPtr in DDV_Main, add to stack inside DDE api's, added insert char, delete char, home and end keyboard control
209 *
210 * Revision 1.52 2000/03/23 00:00:00 hurwitz
211 * DDE api's are called with stack now
212 *
213 * Revision 1.51 2000/03/21 14:29:49 durand
214 * fixed a problem with menus setup
215 *
216 * Revision 1.49 2000/03/20 22:22:48 hurwitz
217 * added more checks to verify subroutine, 1 bug fix
218 *
219 * Revision 1.48 2000/03/17 16:15:30 durand
220 * added ASN.1 SeqAlign and SeqAnoot export
221 *
222 * Revision 1.47 2000/03/16 20:53:48 thiessen
223 * removed C++ style comment
224 *
225 * Revision 1.46 2000/03/16 15:51:32 hurwitz
226 * added function to create an aligned block
227 *
228 * Revision 1.45 2000/03/16 14:11:59 durand
229 * set corretly mouse mode menu
230 *
231 * Revision 1.44 2000/03/14 22:08:21 hurwitz
232 * undo and redo working properly, restore-original function added
233 *
234 * Revision 1.43 2000/03/10 23:01:43 hurwitz
235 * added undo and redo functions, first pass
236 *
237 * Revision 1.42 2000/03/09 22:28:40 hurwitz
238 * added shift block and delete block, a bug fix too
239 *
240 * Revision 1.41 2000/03/08 22:02:07 hurwitz
241 * added verify function, debugging, handle align_start != 0
242 *
243 * Revision 1.40 2000/03/06 22:45:58 hurwitz
244 * can shift right boundary of an aligned block left and right, DDVRuler updates added
245 *
246 * Revision 1.39 2000/03/02 15:43:11 durand
247 * use MovableModalWindow for dialog boxes
248 *
249 * Revision 1.38 2000/03/01 22:49:41 lewisg
250 * import bioseq, neatlyindex, get rid of dead code
251 *
252 * Revision 1.37 2000/02/29 21:13:06 hurwitz
253 * added low level functions for shifting left and right the left alignment boundary
254 *
255 * Revision 1.36 2000/02/28 16:28:39 hurwitz
256 * added functions for deleting an aligned gap
257 *
258 * Revision 1.35 2000/02/24 23:37:00 hurwitz
259 * added ability to insert gaps
260 *
261 * Revision 1.34 2000/02/18 16:06:22 hurwitz
262 * for editing multiple sequence alignments: shift row right now working
263 *
264 * Revision 1.33 2000/02/14 20:58:57 hurwitz
265 * added functions for editing multiple sequence alignments: hide/show row, move row, shift row left
266 *
267 * Revision 1.32 2000/02/08 14:10:42 durand
268 * made extern the functions DDV_UpdateHScrollVal and
269 *
270 * Revision 1.31 2000/02/07 14:03:35 durand
271 * replace BioseqUnlockById by BioseqUnlock
272 *
273 * Revision 1.30 2000/02/05 01:32:22 lewisg
274 * add viewmgr, move place freeing is done in ddv, modify visual c++ projects
275 *
276 * Revision 1.29 2000/02/04 16:05:41 durand
277 * add click action to select a row
278 *
279 * Revision 1.28 2000/01/26 13:38:55 durand
280 * update the GUI for the editor. Add functions to create the data to be used by the editor
281 *
282 * Revision 1.27 2000/01/18 22:49:16 lewisg
283 * send OM_MSG_FLUSH to ddv/udv, tweak CPK coloration, misc bugs
284 *
285 * Revision 1.26 2000/01/12 21:52:17 durand
286 * add import function; update menus when DDV is loaded from Cn3D
287 *
288 * Revision 1.25 2000/01/12 15:49:42 durand
289 * add About dlg box and fix a bug in selection
290 *
291 * Revision 1.24 2000/01/11 15:05:23 durand
292 * remove network stuff
293 *
294 * Revision 1.23 2000/01/10 15:09:45 durand
295 * Use Entrez instead of ID1
296 *
297 * Revision 1.22 1999/12/23 19:22:07 durand
298 * modify default options for DDV when loaded from Cn3D
299 *
300 * Revision 1.21 1999/12/21 15:27:24 durand
301 * avoid to quit Cn3D when closing DDV
302 *
303 * Revision 1.20 1999/12/20 20:20:41 lewisg
304 * allow cn3d to do color and ddv to do case when both are running
305 *
306 * Revision 1.19 1999/12/07 21:40:14 durand
307 * add mouse modes menu and caret facility for the editor
308 *
309 * Revision 1.18 1999/12/06 16:19:19 durand
310 * add GoTo facility to DDV
311 *
312 * Revision 1.17 1999/12/03 23:17:23 lewisg
313 * Patrick's new global update msg, argument passing when launching ddv, experimental editing
314 *
315 * Revision 1.16 1999/11/30 18:19:48 durand
316 * fix a problem with function declaration DDV_CloseData
317 *
318 * Revision 1.15 1999/11/30 17:28:59 durand
319 * fix a problem of redeclaration of the function DDV_CloseData
320 *
321 * Revision 1.14 1999/11/30 14:17:31 durand
322 * fix a bug occurring when deleting a SeqAlign
323 *
324 * Revision 1.13 1999/11/29 15:26:26 durand
325 * designed a new GUI to fix problems under MacOS, Linux and SGI
326 *
327 * Revision 1.12 1999/11/17 22:43:59 durand
328 * speed up the selection manager for large SeqAlign
329 *
330 * Revision 1.11 1999/11/04 22:11:37 durand
331 * add the Desktop to DDV. Add a better set of cleanup functions when closing DDV. Before creating color tables, try to get them from the SeqAlign
332 *
333 * Revision 1.10 1999/11/03 21:29:48 durand
334 * add CTRL and SHFT keys for mouse selection. redesign the loader functions of DDV to properly register the message callbacks
335 *
336 * Revision 1.9 1999/10/29 19:04:59 durand
337 * move DDVUpdateMSG in objmgr.h
338 *
339 * Revision 1.8 1999/10/29 14:15:38 durand
340 * add simple mouse selection functions
341 *
342 * Revision 1.7 1999/10/22 20:12:47 durand
343 * add Export command (text, HTML and Phylip formats)
344 *
345 * Revision 1.6 1999/10/20 15:01:16 durand
346 * bug fixed when closing Display Styles DlgBox
347 *
348 * Revision 1.5 1999/10/20 13:17:19 durand
349 * add display for disc. SeqAlign tails
350 *
351 * Revision 1.4 1999/10/16 15:02:25 durand
352 * fixes due to toolkit build failed
353 *
354 * Revision 1.3 1999/10/15 21:57:36 durand
355 * add a UI for display options
356 *
357 * Revision 1.2 1999/10/02 15:11:20 durand
358 * update the code to reuse more functions from UDV
359 *
360 * Revision 1.1 1999/09/30 14:10:29 durand
361 * add ddv to toolkit
362 *
363 * Revision 1.9 1999/09/21 14:19:08 durand
364 * add mouse click management layout
365 *
366 * Revision 1.8 1999/09/16 13:07:53 durand
367 * add File|Close and File|Open|Network commands
368 *
369 * Revision 1.7 1999/09/09 21:55:06 durand
370 * instantiate the Fle|Close command of DDV
371 *
372 * Revision 1.6 1999/07/20 14:58:02 durand
373 * use the Color Manager to display colored MSA
374 *
375 * Revision 1.5 1999/07/01 15:28:29 durand
376 * validate function loaders of DDV
377 *
378 * Revision 1.2 1999/06/28 22:07:19 durand
379 * add loader functions and clean the code with Lint and Purify
380 *
381 * Revision 1.1 1999/06/19 17:21:06 durand
382 * add Vibrant DDV code
383 *
384 *
385 *
386 * ==========================================================================
387 */
388
389 #include <ncbi.h>
390 #include <vibrant.h>
391 #include <udviewer.h>
392 #include <ddvpanel.h>
393 #include <ddvopen.h>
394 #include <ddvmain.h>
395 #include <ddvgraph.h>
396 #include <ddvclick.h>
397 #include <ddvcreate.h>
398 #include <alignmgr.h>
399 #include <objmgr.h>
400 #include <pgppop.h>
401 #include <vsm.h>
402 #include <salfiles.h>
403 #include <viewmgr.h>
404
405 Char szAppName[]="DDV";
406 Char szAppName2[]="DDE";
407
408 /*local text*/
409 static Char szAbout[]="DeuxD-Viewer : A sequence alignment viewer for GenBank\n\
410 Version 1.0\n\nInformation Engineering Branch\n\
411 NCBI - NLM - NIH, Bldg 38A\n\
412 8600 Rockville Pike\n\
413 Bethesda, MD 20894 - USA\n\n\
414 info@ncbi.nlm.nih.gov";
415
416 #ifdef DEBUG_DDV
417 static void DDV_ShowHideUnAlignGap(IteM i);
418 #endif
419 static void DDV_ExportTexte(IteM i);
420 static void UDV_GotoBtnProc(ButtoN g);
421 static void DDV_DeleteRow(IteM i);
422 static void DDV_MoveRowLeft(IteM i);
423 static void DDV_MoveRowRight(IteM i);
424 static void DDV_MoveLeftBoundaryLeft(IteM i);
425 static void DDV_MoveLeftBoundaryRight(IteM i);
426 static void DDV_MoveRightBoundaryLeft(IteM i);
427 static void DDV_MoveRightBoundaryRight(IteM i);
428 static void DDV_DeleteBlock(IteM i);
429 static void DDV_CreateBlock(IteM i);
430 static void DDV_Prev(IteM i);
431 static void DDV_Next(IteM i);
432 static void DDV_Orig(IteM i);
433 static void DDV_DoEditFunction(IteM i, Int4 WhichOne);
434 static void DDV_LaunchEditor(IteM i);
435 static void DDV_MergeBlocks(IteM i);
436 static void DDV_SplitBlock(IteM i);
437 static void DDV_DeleteBlock2(IteM i);
438 static void DDV_CallSaveEdits(IteM i);
439
440 /*******************************************************************************
441
442 Function : DDV_AboutProc()
443
444 Purpose : about dialog box
445
446 Parameters : -
447
448 Return value : none
449
450 *******************************************************************************/
451 static void DDV_AboutProc(IteM i)
452 {
453 MsgAlert(KEY_OK, SEV_INFO, "About DeuxD-Viewer",szAbout);
454 }
455
456 /*******************************************************************************
457
458 Function : DDV_EnableGotoTBItems()
459
460 Purpose : enable/disable the controls for "GoTo col,row" toolbar
461
462 Return value : none
463
464 *******************************************************************************/
465 typedef void (*MyEnaDisable) (Handle a);
466 extern void DDV_EnableGotoTBItems(WindoW hParent,Boolean bEnable)
467 {
468 DdvMainWinPtr dmwp;
469 MyEnaDisable my_func;
470
471 dmwp=(DdvMainWinPtr)GetObjectExtra(hParent);
472 if (!dmwp) return;
473
474 if (bEnable)
475 my_func=Enable;
476 else
477 my_func=Disable;
478
479 my_func(dmwp->gotoBtn);
480 my_func(dmwp->gotoValCol);
481 my_func(dmwp->gotoValRow);
482 }
483
484
485 /*******************************************************************************
486
487 Function : DDV_WhatSize()
488
489 Purpose : compute nTotLines and nTotCol depending on the display type
490
491 Parameters : -
492
493 Return value : -
494
495 *******************************************************************************/
496 extern void DDV_WhatSize(DdvMainPtr dmp)
497 {
498 Int4 i;
499 ParaGPtr pgp;
500
501 if (dmp==NULL) return;
502
503 dmp->GrData.udv_panel.nTotLines=0;
504
505 if (dmp->MSA_d.pgp_l.DisplayType==0) return;
506 if(dmp->MSA_d.pgp_l.DisplayType==DDV_DISP_HORZ){
507 for(i=0;i<dmp->MSA_d.pgp_l.nBsp;i++){
508 if (dmp->MSA_d.pgp_l.TableHead[i]->data.ptrvalue){
509 pgp=(ParaGPtr)(dmp->MSA_d.pgp_l.TableHead[i]->data.ptrvalue);
510 dmp->GrData.udv_panel.nTotLines+=pgp->nLines;
511 }
512 }
513 dmp->GrData.udv_panel.nTotCol=dmp->MSA_d.pgp_l.LengthAli;
514 }
515 else{/*full vertical display*/
516 /*not yet implemented*/
517 return;/*add to avoid a 'lint' warning*/
518 }
519 }
520
521 /*******************************************************************************
522
523 Function : DDV_CalcVHScrollPgUD()
524
525 Purpose : compute PageUp & Down (V & H Scrolls)
526
527 Parameters : cxyClient; either width of height of DDV panel
528 LineHeight; either width of a col. or height of one data line
529
530 Return value : PageUpDn
531
532 *******************************************************************************/
533 static Int4 DDV_CalcVHScrollPgUD(Int2 cxy_Client,Int2 LineColSize)
534 {
535 return((Int4)(cxy_Client/LineColSize));
536 }
537
538 /*******************************************************************************
539
540 Function : DDV_UpdateVScrollVal()
541
542 Purpose : update the DDV VScroll bar
543
544 Parameters : p; handel of the DDV panel
545 bInit; TRUE only when the DDV is created
546 CurPos ; new position
547
548 Return value : none
549
550 *******************************************************************************/
551 extern void DDV_UpdateVScrollVal(PaneL p,Boolean bInit,Int4 CurPos)
552 {
553 BaR vsb;
554 DdvMainPtr dmp;
555
556 dmp = (DdvMainPtr) GetObjectExtra((Handle)p);
557 /*GetAppProperty("DDV_MAIN_DATA");*/
558 if (dmp==NULL) return;
559
560 /*current scroll status*/
561 vsb = GetSlateVScrollBar ((SlatE) p);
562
563 if (bInit) CurPos=0;
564
565 /*given curpos (lineNumber) retrieve letter number*/
566
567 /*compute new values*/
568 dmp->GrData.udv_vscrl.ScrollPage=
569 DDV_CalcVHScrollPgUD((Int2)(dmp->GrData.udv_panel.cyClient-
570 3*dmp->GrData.udv_panel.cyScale/2-5),
571 dmp->GrData.udv_font.LineHeight);
572
573 if (dmp->GrData.udv_panel.nTotLines>dmp->GrData.udv_vscrl.ScrollPage){
574 dmp->GrData.udv_vscrl.ScrollMax=dmp->GrData.udv_panel.nTotLines-
575 dmp->GrData.udv_vscrl.ScrollPage+3/**/;
576 }
577 else{
578 dmp->GrData.udv_vscrl.ScrollMax=0;
579 dmp->GrData.udv_vscrl.ScrollPos=0;
580 dmp->GrData.udv_vscrl.ScrollPage=0;
581 }
582
583 if (CurPos<0) CurPos=0;
584
585 if (CurPos>=dmp->GrData.udv_vscrl.ScrollMax)
586 dmp->GrData.udv_vscrl.ScrollPos=dmp->GrData.udv_vscrl.ScrollMax;
587 else dmp->GrData.udv_vscrl.ScrollPos=CurPos;
588
589 /*update scroll*/
590 CorrectBarMax(vsb,dmp->GrData.udv_vscrl.ScrollMax);
591 CorrectBarValue(vsb,dmp->GrData.udv_vscrl.ScrollPos);
592 CorrectBarPage(vsb,dmp->GrData.udv_vscrl.ScrollPage,
593 dmp->GrData.udv_vscrl.ScrollPage);
594
595 }
596
597 /*******************************************************************************
598
599 Function : DDV_UpdateHScrollVal()
600
601 Purpose : update the DDV HScroll bar
602
603 Parameters : p; handel of the DDV panel
604 bInit; TRUE only when the DDV is created
605 CurPos ; new position
606
607 Return value : none
608
609 *******************************************************************************/
610 extern void DDV_UpdateHScrollVal(PaneL p,Boolean bInit,Int4 CurPos)
611 {
612 BaR hsb;
613 DdvMainPtr dmp;
614
615 dmp = (DdvMainPtr) GetObjectExtra((Handle)p);
616 if (dmp==NULL) return;
617
618 /*current scroll status*/
619 hsb = GetSlateHScrollBar ((SlatE) p);
620 if (!hsb) return;/*not always present*/
621
622 if (bInit) CurPos=0;
623
624 /*given curpos (lineNumber) retrieve letter number*/
625
626 /*compute new values*/
627 dmp->GrData.udv_hscrl.ScrollPage=
628 DDV_CalcVHScrollPgUD((Int2)(dmp->GrData.udv_panel.cxClient-
629 dmp->GrData.udv_panel.cxName),
630 dmp->GrData.udv_font.ColWidth);
631
632 if (dmp->GrData.udv_panel.nTotCol>dmp->GrData.udv_hscrl.ScrollPage){
633 dmp->GrData.udv_hscrl.ScrollMax=dmp->GrData.udv_panel.nTotCol-
634 dmp->GrData.udv_hscrl.ScrollPage+5/**/;
635 }
636 else{
637 dmp->GrData.udv_hscrl.ScrollMax=0;
638 dmp->GrData.udv_hscrl.ScrollPos=0;
639 dmp->GrData.udv_hscrl.ScrollPage=0;
640 }
641
642 if (CurPos<0) CurPos=0;
643
644 if (CurPos>=dmp->GrData.udv_hscrl.ScrollMax)
645 dmp->GrData.udv_hscrl.ScrollPos=dmp->GrData.udv_hscrl.ScrollMax;
646 else dmp->GrData.udv_hscrl.ScrollPos=CurPos;
647
648 /*update scroll*/
649 CorrectBarMax(hsb,dmp->GrData.udv_hscrl.ScrollMax);
650 CorrectBarValue(hsb,dmp->GrData.udv_hscrl.ScrollPos);
651 CorrectBarPage(hsb,dmp->GrData.udv_hscrl.ScrollPage,
652 dmp->GrData.udv_hscrl.ScrollPage);
653
654 }
655
656
657 /*****************************************************************************
658
659 Function : DDV_VHScrl()
660
661 Purpose : DD Viewer Horizontal/Vertical Scroll Bar function
662
663 Parameters : p; viewer
664 vdp; viewer data structure
665 newval; new value of the thumb
666 oldval; old value of the thumb
667 IsVscroll; TRUE means Vertical scrollbar
668
669 Note : this function can be used to scroll the panel for any reasons.
670
671 Return value : none
672
673 *****************************************************************************/
674 extern void DDV_VHScrl(PaneL p,UnDViewerGraphDataPtr gdp, Int4 newval, Int4 oldval,
675 Boolean IsVscroll)
676 {
677 RecT rcP;
678 WindoW temport;
679 Int4 n,limit;
680 Int2 dx,dy;
681 DdvMainPtr dmp;
682
683 if (!gdp || !p) return;
684
685 dmp = (DdvMainPtr) GetObjectExtra(p);
686 if (dmp==NULL) return;
687
688 /*compute scroll offset*/
689 if (oldval>newval)n=oldval-newval;
690 else n=newval-oldval;
691
692 temport=SavePort(ParentWindow((WindoW)p));
693 Select(p);
694 ObjectRect(p,&rcP);
695 InsetRect(&rcP,4,4);
696 /*drawing region:*/
697 DDV_AdjustDrawingRect(&rcP, &(gdp->udv_font), dmp);
698
699 if (IsVscroll){/*Vertical scroll*/
700 gdp->udv_vscrl.ScrollPos=newval;
701 limit=(Int4)gdp->udv_vscrl.ScrollPage;
702 dx=0;
703 dy=(Int2)((oldval-newval)*gdp->udv_font.LineHeight);
704 rcP.top+=3*gdp->udv_panel.cyScale/2;
705 }
706 else{/*horizontal scroll*/
707 gdp->udv_hscrl.ScrollPos=newval;
708 limit=(Int4)gdp->udv_hscrl.ScrollPage;
709 dx=(Int2)((oldval-newval)*gdp->udv_font.ColWidth);
710 dy=0;
711 rcP.left+=(gdp->udv_panel.cxName+gdp->udv_scale.cxLeftScale);
712 }
713
714 ClipRect(&rcP);
715
716 if (n<limit){/*Line UP/Down or Column left/right*/
717 ScrollRect (&rcP, dx, dy);
718 }
719 else{/*Page Up/Down or Page left/right*/
720 InvalRect(&rcP);
721 }
722 ResetClip();
723 RestorePort(temport);
724 Update ();
725 }
726
727 /*****************************************************************************
728
729 Function : DDV_VScrlProc()
730
731 Purpose : DD Viewer Vertical Scroll Bar Callback
732
733 Parameters : see vibrant library
734
735 Return value : none
736
737 *****************************************************************************/
738 extern void DDV_VScrlProc (BaR sb, SlatE s, Int4 newval, Int4 oldval)
739 {
740
741 DdvMainPtr dmp;
742
743 /*get the application data*/
744 dmp = (DdvMainPtr) GetObjectExtra((Handle)s);
745 if (dmp==NULL) return;
746
747 DDV_VHScrl((PaneL)s,&(dmp->GrData),newval,oldval,TRUE);
748 }
749
750 /*****************************************************************************
751
752 Function : DDV_HScrlProc()
753
754 Purpose : DD Viewer Horizontal Scroll Bar Callback
755
756 Parameters : see vibrant library
757
758 Return value : none
759
760 *****************************************************************************/
761 extern void DDV_HScrlProc (BaR sb, SlatE s, Int4 newval, Int4 oldval)
762 {
763
764 DdvMainPtr dmp;
765
766 /*get the application data*/
767 dmp = (DdvMainPtr) GetObjectExtra((Handle)s);
768 if (dmp==NULL) return;
769
770 DDV_VHScrl((PaneL)s,&(dmp->GrData),newval,oldval,FALSE);
771 }
772
773 /*****************************************************************************
774
775 Function: DDV_InitPanelData()
776
777 Purpose: Init numerical values for DDViewer. Called one times at the
778 start of the soft.
779
780 Return value: none (results are in sdp)
781
782 *****************************************************************************/
783 extern void DDV_InitPanelData(UDVPanelDataPtr pdp)
784 {
785 pdp->cxClient=0;
786 pdp->cyClient=0;
787 pdp->nTotLines=0;
788 pdp->nTotCol=0;
789 pdp->nCharByLine=DDV_DEFAULT_PARAG_SIZE;
790 pdp->nBlockByLine=0;
791 pdp->ShowFeatures=FALSE;
792 pdp->ShowScale=TRUE;
793 pdp->ShowByBlock=FALSE;
794 }
795
796 /*****************************************************************************
797
798 Function : DDV_SetupWin()
799
800 Purpose : resize DD viewer panel
801
802 Parameters : w; handle of the DD viewer window
803 bInit; is the window new?
804
805 *****************************************************************************/
806 extern void DDV_SetupWin (WindoW w,Boolean bInit)
807 {
808 RecT rWin, rButton;
809 RecT rStatus1, rStatus2, rPanel1, rPanel2;
810 Int2 height,diff,gap,width;
811 DdvMainWinPtr dmwp;
812
813 dmwp=(DdvMainWinPtr)GetObjectExtra(w);
814
815 ObjectRect(w,&rWin);
816 width= rWin.right-rWin.left;
817
818 GetPosition(dmwp->StatusGroup,&rStatus1);
819 diff=rStatus1.bottom-rStatus1.top;
820 gap= 4;
821
822 ObjectRect(dmwp->gotoBtn, &rButton);
823 height= rWin.bottom - rWin.top - rButton.bottom - gap;
824
825 if(GetStatus(dmwp->MainMenu.ShowLowerPanel)) {
826 Show(dmwp->LowerInfoPanel);
827 Show(dmwp->StatusGroupLower);
828 Show(dmwp->hLowerPanel);
829
830 rPanel1.right = width;
831 rPanel1.left = 0;
832 rPanel1.top = rButton.bottom + gap;
833 rPanel1.bottom = rPanel1.top + 2*height/3 - diff;
834
835 rStatus1.right = rPanel1.right;
836 rStatus1.left = rPanel1.left;
837 rStatus1.top = rPanel1.bottom;
838 rStatus1.bottom = rStatus1.top + diff;
839
840 rPanel2.right = rPanel1.right;
841 rPanel2.left = rPanel1.left;
842 rPanel2.top = rStatus1.bottom;
843 rPanel2.bottom = rPanel2.top + height/3 - diff;
844
845 rStatus2.right = rPanel1.right;
846 rStatus2.left = rPanel1.left;
847 rStatus2.top = rPanel2.bottom;
848 rStatus2.bottom = rStatus2.top + diff;
849
850
851 SetPosition (dmwp->StatusGroup, &rStatus1);
852 SetPosition (dmwp->UpperInfoPanel, &rStatus1);
853 SetPosition (dmwp->StatusGroupLower, &rStatus2);
854 SetPosition (dmwp->LowerInfoPanel, &rStatus2);
855 SetPosition (dmwp->hUpperPanel, &rPanel1);
856 SetPosition (dmwp->hLowerPanel, &rPanel2);
857 } else {
858 Hide(dmwp->LowerInfoPanel);
859 Hide(dmwp->StatusGroupLower);
860 Hide(dmwp->hLowerPanel);
861
862 /* set focus */
863 dmwp->hWndDDV = dmwp->hUpperPanel;
864 DDV_SetMenuFocus(w);
865 dmwp->InfoPanel = dmwp->UpperInfoPanel;
866 SetTitle(dmwp->InfoPanel,"Ready !");
867 SetTitle(dmwp->LowerInfoPanel,"");
868
869 rPanel1.right = width;
870 rPanel1.left = 0;
871 rPanel1.top = rButton.bottom + gap;
872 rPanel1.bottom = rPanel1.top + height - diff;
873
874 rStatus1.right = rPanel1.right;
875 rStatus1.left = rPanel1.left;
876 rStatus1.top = rPanel1.bottom;
877 rStatus1.bottom = rStatus1.top + diff;
878
879 SetPosition (dmwp->StatusGroup, &rStatus1);
880 SetPosition (dmwp->UpperInfoPanel, &rStatus1);
881 SetPosition (dmwp->hUpperPanel, &rPanel1);
882 }
883 AdjustPrnt (dmwp->hUpperPanel, &rPanel1, FALSE);
884
885 /* Update();*/
886 }
887
888 /*****************************************************************************
889
890 Function : DDV_ResizeDDV
891
892 Purpose : update DDV panel (size and scrolls)
893
894 Parameters : p; DDV panel
895 bInit; TRUE only when DDV panel is created
896
897 Return value : none
898
899 *****************************************************************************/
900 extern void DDV_Resize_DDV (PaneL p, Boolean bInit)
901 {
902 DdvMainPtr dmp;
903 RecT rcP;
904 Int4 vCurPos,hCurPos;
905 BaR vsb,hsb;
906 WindoW temport;
907
908 if (!p) return;
909 dmp = (DdvMainPtr) GetObjectExtra((Handle)p);
910 if (dmp==NULL) return;
911
912 GetPosition(p, &rcP);
913 /*panels of DDV; */
914
915 UDV_ComputePanelSize(rcP,&(dmp->GrData.udv_panel.cxClient),
916 &(dmp->GrData.udv_panel.cyClient));
917
918 temport=SavePort(ParentWindow(p));
919 Select(p);
920
921 /*current scroll status*/
922 vsb = GetSlateVScrollBar ((SlatE) p);
923 vCurPos=GetBarValue(vsb);
924 hsb = GetSlateHScrollBar ((SlatE) p);
925 hCurPos=GetBarValue(hsb);
926
927 /*update scrolls*/
928 DDV_UpdateVScrollVal(p,bInit,vCurPos);
929 DDV_UpdateHScrollVal(p,bInit,hCurPos);
930
931 InvalRect(&rcP);
932 RestorePort(temport);
933 }
934
935 /*****************************************************************************
936
937 Function : DDV_WinMainResize()
938
939 Purpose : Main Window Resize function
940
941 Parameters : w; handle of the parent window
942
943 Return value : none
944
945 *****************************************************************************/
946 extern void DDV_WinMainResize (WindoW w)
947 {
948 DdvMainWinPtr mWin_d;
949
950 mWin_d = (DdvMainWinPtr) GetObjectExtra(w);
951 if(mWin_d == NULL) return;
952
953 DDV_SetupWin (w,FALSE);
954 DDV_Resize_DDV (mWin_d->hUpperPanel, FALSE);
955 DDV_Resize_DDV (mWin_d->hLowerPanel, FALSE);
956 Update();
957 }
958
959 /*****************************************************************************
960
961 Function: DDV_CleanupDDVPdata() & DDV_FreeDDVPdata()
962
963 Purpose: delete the data attached to the DDV panel
964
965 Return value: none
966
967 *****************************************************************************/
968 static void DDV_FreeDDVPdata(DdvMSADataPtr dmdp,Uint2 userkey,Uint2 procid,
969 Uint2 proctype)
970 {
971 ParaGPtr pgp;
972 BioseqPtr bsp;
973 Int4 i;
974 Uint2 bsp_eID;
975
976 if (!dmdp) return;
977 /*before deleting the list of ParaG, I need to delete the user object
978 containing the Msg Func*/
979 if (userkey>0 && procid>0 && proctype>0) {
980 for(i=0;i<dmdp->pgp_l.nBsp;i++){
981 pgp=(ParaGPtr)(dmdp->pgp_l.TableHead[i]->data.ptrvalue);
982 bsp=BioseqLockById(pgp->sip);
983 if (bsp != NULL){
984 bsp_eID=ObjMgrGetEntityIDForPointer((Pointer)bsp);
985 BioseqUnlock(bsp);
986 if (bsp_eID>0 && bsp_eID!=dmdp->entityID){
987 ObjMgrFreeUserData(bsp_eID,procid,proctype,userkey);
988 }
989 }
990 }
991 }
992
993 if (dmdp->pgp_l.TableHead) {
994 DDV_DeleteDisplayList(&dmdp->pgp_l);
995 dmdp->pgp_l.TableHead=NULL;
996 }
997 if (dmdp->pgp_l.DisplayVert) {
998 UDV_FreeListParaG(&dmdp->pgp_l.DisplayVert);
999 dmdp->pgp_l.DisplayVert=NULL;
1000 }
1001 if (dmdp->pgp_l.sabp) {
1002 CleanupBlocks(dmdp->pgp_l.sabp);
1003 dmdp->pgp_l.sabp=NULL;
1004 }
1005 if (dmdp->pgp_l.bspp) {
1006 dmdp->pgp_l.bspp=DDV_BspInfoDeleteList(dmdp->pgp_l.bspp);
1007 dmdp->pgp_l.bspp=NULL;
1008 }
1009 if (dmdp->pgp_l.RulerDescr) {
1010 ValNodeFreeData(dmdp->pgp_l.RulerDescr);
1011 dmdp->pgp_l.RulerDescr=NULL;
1012 }
1013 if (dmdp->pgp_l.entitiesTbl) {
1014 MemFree(dmdp->pgp_l.entitiesTbl);
1015 dmdp->pgp_l.entitiesTbl=NULL;
1016 }
1017
1018 /* no rows, no cols */
1019 dmdp->pgp_l.LengthAli = 0;
1020 dmdp->pgp_l.nBsp = 0;
1021
1022 if(dmdp->entityID != 0)
1023 ObjMgrFreeUserData(dmdp->entityID,procid,proctype,userkey);
1024 dmdp->entityID=0;
1025 dmdp->itemID=0;
1026 }
1027
1028 extern void DDV_CleanupDDVPdata_g (DdvMainPtr dmp)
1029 {
1030 ValNodePtr vnp;
1031
1032 /*SeqAlign Idx & ParaG List*/
1033 DDV_FreeDDVPdata(&(dmp->MSA_d),dmp->userkey,dmp->procid,dmp->proctype);
1034 /*graphical data*/
1035 DDV_InitDefSAPdispStyles(&(dmp->ddo));
1036 ClearUDV_mouse_select(&(dmp->ms));
1037 dmp->ms.Action_type=MS_ACTION_FEAT_NOTHING;
1038 dmp->procid=0;
1039 dmp->proctype=0;
1040 dmp->userkey=0;
1041
1042 switch(dmp->dod.choice){
1043 case DDV_OPENTYPE_NOTRESP:
1044 break;
1045 case DDV_OPENTYPE_FILE:
1046 vnp=dmp->dod.vnp;
1047 while(vnp){
1048 ObjMgrFree(vnp->choice, (Pointer)vnp->data.ptrvalue);
1049 vnp=vnp->next;
1050 }
1051 ValNodeFree(dmp->dod.vnp);
1052 break;
1053 case DDV_OPENTYPE_SEP:
1054 case DDV_OPENTYPE_GI:
1055 if (dmp->dod.sep) SeqEntryFree(dmp->dod.sep);
1056 break;
1057 }
1058 memset(&(dmp->dod),0,sizeof(DdvOpenData));
1059
1060 /*delete list of SeqAligns*/
1061 if (dmp->vnp_ali){
1062 dmp->vnp_ali=ValNodeFree(dmp->vnp_ali);
1063 }
1064
1065 memset(&dmp->GrData.udv_vscrl,0,sizeof(UDVScrollData));
1066 memset(&dmp->GrData.udv_hscrl,0,sizeof(UDVScrollData));
1067 dmp->GrData.udv_panel.nTotLines=0;
1068 dmp->GrData.udv_panel.nTotCol=0;
1069
1070 /*colors; deleted only by the autonomous DDV*/
1071 /* if (bRemoveBioseq && dmp->Globals.colorp){
1072 DDV_DeleteColorGlobal(dmp->Globals.colorp);*/
1073 dmp->Globals.colorp=NULL;
1074 /* }*/
1075
1076 }
1077
1078 /*WindoW callback*/
1079 static void DDV_CleanupDDVPdata (GraphiC g, VoidPtr data)
1080 {
1081 DdvMainPtr dmp;
1082
1083 if (data){
1084 dmp=(DdvMainPtr)data;
1085 if (dmp->bEditor) {
1086 DDE_FreeStack(dmp->dsp);
1087 }
1088 DDV_CleanupDDVPdata_g (dmp);
1089 }
1090 }
1091
1092
1093 static PaneL DDV_PanelInit(GrouP g, WindoW w,DdvMainWinPtr dmwp,
1094 SAM_ViewGlobal *vgp, Boolean bEditor,
1095 Nlm_PnlClckProc ClickProc, Int4 Width)
1096 {
1097 PaneL p;
1098 DdvMainPtr dmp;
1099 Int2 Margins;
1100
1101 Margins=20*stdCharWidth;
1102
1103 /*init data blocks*/
1104 dmp=(DdvMainPtr)MemNew(sizeof(DdvMain));
1105 if (!dmp) return(FALSE);
1106
1107 /*init default SeqAlign display options for standalon DDV and for
1108 DDV started from Cn3D*/
1109 if (dmwp->AutonomeViewer)
1110 dmp->MasterViewer=SAMVIEWDDV;
1111 if(vgp == NULL) {
1112 DDV_InitDefSAPdispStyles(&(dmp->ddo));
1113 }
1114 else if(vgp->MasterViewer == SAMVIEWCN3D) {
1115 DDV_InitCn3DSAPdispStyles(&(dmp->ddo));
1116 dmp->MouseMode=DDV_MOUSEMODE_SELECT;
1117 }
1118
1119 dmp->ms.Action_type=MS_ACTION_FEAT_NOTHING;
1120
1121 if(vgp == NULL)
1122 p = AutonomousPanel4 (g,
1123 (Int2)2*((screenRect.right-screenRect.left)-Margins)/3,
1124 (Int2)2*((screenRect.bottom-screenRect.top)-Margins)/Width,
1125 DDV_DrawViewer,DDV_VScrlProc,DDV_HScrlProc,
1126 sizeof(DdvMainPtr),NULL,NULL);
1127 else
1128 p = AutonomousPanel4 (g,
1129 (Int2)vgp->Rect.right - vgp->Rect.left,
1130 (Int2)vgp->Rect.bottom - vgp->Rect.top,
1131 DDV_DrawViewer,DDV_VScrlProc,DDV_HScrlProc,
1132 sizeof(DdvMainPtr),NULL,NULL);
1133
1134 if(!p) return NULL;
1135
1136 Nlm_SetSlateBorder ((SlatE) p, FALSE);
1137 SetPanelClick(p,ClickProc,
1138 DDV_DragProc,DDV_HoldProc,DDV_ReleaseProc);
1139 SetSlateChar ((SlatE) p, DDV_KeyboardProc);
1140
1141 SetObjectExtra (p, (Pointer) dmp, (FreeProc)DDV_CleanupDDVPdata);
1142
1143 dmp->hWndDDV=p;
1144 dmp->hParent=w;
1145 dmp->bEditor=bEditor;
1146 if (!dmp->bEditor){
1147 dmp->deri.curEditRow=(Int4)-1;
1148 dmp->deri.curMasterRow=(Int4)0;
1149 }
1150 UDV_InitFont(&(dmp->GrData.udv_font));
1151 SelectFont(dmp->GrData.udv_font.hFnt);
1152 UDV_FontDim(&(dmp->GrData.udv_font.cxChar),&(dmp->GrData.udv_font.cyChar));
1153
1154 /*init the graphical elements of DDV*/
1155 DDV_InitGraphGlobal(dmp);
1156 return p;
1157 }
1158
1159 /*****************************************************************************
1160
1161 Function: DDV_CreateViewerPanel()
1162
1163 Purpose: create the Viewer main panel
1164
1165 Return value: none
1166
1167 *****************************************************************************/
1168 extern Boolean DDV_CreateViewerPanel(WindoW w,DdvMainWinPtr dmwp,
1169 SAM_ViewGlobal *vgp, Boolean bEditor)
1170 {
1171 PaneL p, p2;
1172 GrouP g,g2,StatusGroup,StatusGroupLower;
1173 ButtoN gotoBtn;
1174 TexT gotoRowTxt,gotoColTxt;
1175 PrompT info, infoLower;
1176 FonT hFnt;
1177 Int2 cxChar,cyChar;
1178
1179
1180 #ifdef WIN_MAC
1181 hFnt = ParseFont ("Monaco, 9");
1182 #endif
1183
1184 #ifdef WIN_MSWIN
1185 hFnt = ParseFont ("Courier, 7");
1186 #endif
1187
1188 #ifdef WIN_MOTIF
1189 hFnt = ParseFont ("fixed, 12");
1190 #endif
1191
1192 SelectFont (hFnt);
1193 cxChar=MaxCharWidth();
1194 cyChar=LineHeight();
1195 g = HiddenGroup (w, 5, 0, NULL);
1196 gotoBtn = PushButton (g, "Go to:",UDV_GotoBtnProc);
1197 StaticPrompt (g, "row:", 0, 3*cyChar/2, hFnt, 'l');
1198 gotoRowTxt = DialogText (g, "0", (Int2)4, NULL);
1199 StaticPrompt (g, "col:", 0, 3*cyChar/2, hFnt, 'l');
1200 gotoColTxt = DialogText (g, "0", (Int2)4, NULL);
1201
1202 g = HiddenGroup (w, 1, 2, NULL);
1203 g2 = HiddenGroup(g,1,1,NULL);
1204 DDV_SetupMenus(w,dmwp->UseNetwork,bEditor, vgp);
1205 p=DDV_PanelInit(g2, w, dmwp, vgp, bEditor, DDV_ClickProcUpper, 4);
1206 if(!p) return FALSE;
1207 dmwp->hUpperPanel = p; /*handle of the upper DDV panel (the multiple)*/
1208 dmwp->hWndDDV=p; /* default focus */
1209
1210 StatusGroup = HiddenGroup (g, 1, 1, NULL);
1211 info = StaticPrompt (StatusGroup, "Ready !", 0, 3*cyChar/2, hFnt, 'l');
1212
1213 g2 = HiddenGroup (g, 1, 1, NULL);
1214 p2=DDV_PanelInit(g2, w, dmwp, vgp, bEditor, DDV_ClickProcLower, 6);
1215 if(!p) return FALSE;
1216 dmwp->hLowerPanel = p2; /*handle of the DDV panel (the pairwise) */
1217
1218 StatusGroupLower = HiddenGroup (g, 1, 0, NULL);
1219 infoLower = StaticPrompt (StatusGroupLower, "", 0, 3*cyChar/2, hFnt, 'l');
1220
1221 AlignObjects(ALIGN_RIGHT, (HANDLE) p,(HANDLE) StatusGroup,(HANDLE) p2,
1222 (HANDLE) StatusGroupLower, NULL);
1223
1224 if (gotoBtn==NULL || gotoRowTxt==NULL ||
1225 gotoColTxt==NULL || info==NULL || infoLower == NULL)
1226 return(FALSE);
1227
1228 SetWindowTimer (w, DDV_TimerProc);
1229
1230 dmwp->gotoBtn=gotoBtn;
1231 dmwp->gotoValRow=gotoRowTxt;
1232 dmwp->gotoValCol=gotoColTxt;
1233 dmwp->StatusGroup=StatusGroup;
1234 dmwp->StatusGroupLower=StatusGroupLower;
1235 dmwp->InfoPanel=info;
1236 dmwp->UpperInfoPanel = info;
1237 dmwp->LowerInfoPanel = infoLower;
1238
1239 DDV_SetMenuFocus(w);
1240 Disable(dmwp->gotoBtn);
1241 Disable(dmwp->gotoValRow);
1242 Disable(dmwp->gotoValCol);
1243 /*init graph objects: call UDV functions ...*/
1244
1245
1246 return(TRUE);
1247 }
1248
1249 /*******************************************************************************
1250
1251 Function : DDV_WinMainProgQuit()
1252
1253 Purpose : end of prog
1254
1255 Parameters : w; main window handle
1256
1257 Return value : none
1258
1259 *******************************************************************************/
1260 extern void DDV_WinMainProgQuit(WindoW w)
1261 {
1262 QuitProgram();
1263 }
1264
1265 /*******************************************************************************
1266
1267 Function : QuitProc()
1268
1269 Purpose : bye-bye procedure !
1270
1271 Parameters : i; menu item which has called this function
1272
1273 Return value : none
1274
1275 *******************************************************************************/
1276 static void QuitProc(IteM i)
1277 {
1278 WindoW hWinMain;
1279
1280 hWinMain=(WindoW)ParentWindow(i);
1281 if (!hWinMain) return;
1282 DDV_SlaveQuit(hWinMain);
1283 }
1284
1285 NLM_EXTERN void DDV_Save(ButtoN g) {
1286 /*----------------------------------------------------------------------------
1287 * save edits, quit pop-up, quit DDE
1288 *---------------------------------------------------------------------------*/
1289 WindoW hDialog;
1290 WindoW hWinMain;
1291 DdvMainWinPtr mWin_d;
1292 DdvMainPtr dmp;
1293
1294 /* quit pop-up */
1295 hDialog = (WindoW)ParentWindow(g);
1296 if (!hDialog) return;
1297 Remove(hDialog);
1298
1299 /* save the edits */
1300 hWinMain = (WindoW) GetObjectExtra(hDialog);
1301 mWin_d = (DdvMainWinPtr) GetObjectExtra(hWinMain);
1302 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
1303 DDV_SaveEdits(dmp, TRUE);
1304
1305 /* quit DDE */
1306 if (mWin_d->AutonomeViewer)
1307 QuitProgram(); /*standalone DDV*/
1308 else
1309 Remove(hWinMain);/*slave viewer : just kill the main window*/
1310 }
1311
1312
1313 NLM_EXTERN void DDV_NoSave(ButtoN g) {
1314 /*----------------------------------------------------------------------------
1315 * quit pop-up, quit DDE
1316 *---------------------------------------------------------------------------*/
1317 WindoW hDialog;
1318 WindoW hWinMain;
1319 DdvMainWinPtr mWin_d;
1320
1321 /* quit the pop-up */
1322 hDialog = (WindoW)ParentWindow(g);
1323 if (!hDialog) return;
1324 Remove(hDialog);
1325
1326 /* quit DDE */
1327 hWinMain = (WindoW) GetObjectExtra(hDialog);
1328 mWin_d = (DdvMainWinPtr) GetObjectExtra(hWinMain);
1329 if (mWin_d->AutonomeViewer)
1330 QuitProgram(); /*standalone DDV*/
1331 else
1332 Remove(hWinMain);/*slave viewer : just kill the main window*/
1333 }
1334
1335
1336 NLM_EXTERN void DDV_Cancel(ButtoN g) {
1337 /*----------------------------------------------------------------------------
1338 * quit pop-up
1339 *---------------------------------------------------------------------------*/
1340 WindoW hDialog;
1341
1342 /* quit the pop-up */
1343 hDialog = (WindoW)ParentWindow(g);
1344 if (!hDialog) return;
1345 Remove(hDialog);
1346 }
1347
1348
1349 /*******************************************************************************
1350
1351 Function : DDV_CloseData()
1352
1353 Purpose : bye-bye data, i.e. use that function to delete all the data
1354 loaded within DDV.
1355
1356 Parameters : mWin_d; main data block
1357
1358 Return value : none
1359
1360 *******************************************************************************/
1361 extern void DDV_CloseData(DdvMainWinPtr mWin_d,Boolean bFinalExit)
1362 {
1363
1364 WatchCursor();
1365 /*dmp=(DdvMainPtr)GetObjectExtra(mWin_d->hWndDDV);*/
1366
1367 /*DDV_CleanupDDVPdata_g(dmp);*/
1368 if (!bFinalExit)
1369 DDV_SetupWin (mWin_d->hWndMain,TRUE);
1370 ArrowCursor();
1371 }
1372
1373
1374 NLM_EXTERN void DDV_FileCloseIt(WindoW hWinMain) {
1375 /*----------------------------------------------------------------------------
1376 * part of DDV_FileClose
1377 *---------------------------------------------------------------------------*/
1378 DdvMainPtr dmp;
1379 DdvMainWinPtr mWin_d;
1380 RecT rc;
1381
1382 mWin_d = (DdvMainWinPtr) GetObjectExtra((Handle)hWinMain);
1383 if (mWin_d==NULL) return;
1384
1385 /* delete data */
1386 dmp=(DdvMainPtr)GetObjectExtra(mWin_d->hWndDDV);
1387 DDV_CleanupDDVPdata_g(dmp);
1388 DDV_CloseData(mWin_d,FALSE);
1389 DDV_EnableGotoTBItems(hWinMain,FALSE);
1390
1391 /* blank the panel that's closed */
1392 mWin_d->Show_logo=FALSE;
1393 ObjectRect(mWin_d->hUpperPanel, &rc);
1394 InvalRect(&rc);
1395 ObjectRect(mWin_d->hLowerPanel, &rc);
1396 InvalRect(&rc);
1397
1398 Update();
1399 }
1400
1401
1402 /*******************************************************************************
1403
1404 Function : DDV_FileClose()
1405
1406 Purpose : close a SeqAlign
1407
1408 Parameters : i; menu item which has called this function
1409
1410 Return value : none
1411
1412 *******************************************************************************/
1413 static void DDV_FileClose(IteM i)
1414 {
1415 WindoW hWinMain;
1416
1417 hWinMain=(WindoW)ParentWindow(i);
1418 if (!hWinMain) return;
1419
1420 DDV_FileCloseIt(hWinMain);
1421 return;
1422 }
1423
1424
1425 #ifdef DEBUG_DDV
1426 static Uint1 DDV_GetCurrentUAGAPStyle(MsaParaGPopListPtr mpplp)
1427 {
1428 Int4 j;
1429 ValNodePtr vnp,vnp2;
1430 ParaGPtr pgp;
1431 MsaTxtDispPtr mtdp;
1432
1433 if (mpplp->TableHead){
1434 for(j=0;j<mpplp->nBsp;j++){
1435 vnp=mpplp->TableHead[j];
1436 while(vnp){
1437 pgp=(ParaGPtr)vnp->data.ptrvalue;
1438 if (pgp){
1439 vnp2=pgp->ptxtList;
1440 while(vnp2){
1441 mtdp=(MsaTxtDispPtr)vnp2->data.ptrvalue;
1442 if (mtdp->IsUnAligned && mtdp->IsGap){
1443 return(mtdp->TextStyle);
1444 }
1445 vnp2=vnp2->next;
1446 }
1447 }
1448 vnp=vnp->next;
1449 }
1450 }
1451 }
1452 return(0);
1453 }
1454
1455 static void DDV_SetCurrentUAGAPStyle(MsaParaGPopListPtr mpplp,Uint1 UATextStyle)
1456 {
1457 Int4 j;
1458 ValNodePtr vnp,vnp2;
1459 ParaGPtr pgp;
1460 MsaTxtDispPtr mtdp;
1461
1462 if (mpplp->TableHead){
1463 for(j=0;j<mpplp->nBsp;j++){
1464 vnp=mpplp->TableHead[j];
1465 while(vnp){
1466 pgp=(ParaGPtr)vnp->data.ptrvalue;
1467 if (pgp){
1468 vnp2=pgp->ptxtList;
1469 while(vnp2){
1470 mtdp=(MsaTxtDispPtr)vnp2->data.ptrvalue;
1471 if (mtdp->IsUnAligned && mtdp->IsGap){
1472 mtdp->TextStyle=UATextStyle;
1473 }
1474 vnp2=vnp2->next;
1475 }
1476 }
1477 vnp=vnp->next;
1478 }
1479 }
1480 }
1481 }
1482
1483
1484 /*******************************************************************************
1485
1486 Function : DDV_ShowHideUnAlignGap()
1487
1488 Purpose : use or not the ~ char to display an unalign gap
1489
1490 Return value : none
1491
1492 *******************************************************************************/
1493 static void DDV_ShowHideUnAlignGap(IteM i)
1494 {
1495 static Boolean bFirst=TRUE;
1496 static Uint1 UA_TextStyle;
1497 DdvMainWinPtr mWin_d;
1498 DdvMainPtr dmp;
1499 WindoW hWinMain,hDispDlg;
1500
1501 /*get some data*/
1502 hWinMain=(WindoW)ParentWindow(i);
1503 if (hWinMain==NULL) return;
1504 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
1505 if (mWin_d==NULL) return;
1506 if (mWin_d->hWndDDV==NULL) return;
1507 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
1508 if (dmp==NULL) return;
1509
1510 if (bFirst){
1511 UA_TextStyle=DDV_GetCurrentUAGAPStyle(&(dmp->MSA_d.pgp_l));
1512 bFirst=FALSE;
1513 }
1514
1515 if (UA_TextStyle==MSA_TXT_STYLE_UAGAP)
1516 UA_TextStyle=MSA_TXT_STYLE_GAP;
1517 else
1518 UA_TextStyle=MSA_TXT_STYLE_UAGAP;
1519
1520 DDV_SetCurrentUAGAPStyle(&(dmp->MSA_d.pgp_l),UA_TextStyle);
1521 }
1522 #endif
1523
1524 /*******************************************************************************
1525
1526 Function : DDV_DispStyles_OkProc()
1527
1528 Purpose : manage ok button of the Display Styles dialog box
1529
1530 Parameters : g; button
1531
1532 Return value : none
1533
1534 *******************************************************************************/
1535 static void DDV_DispStyles_OkProc(ButtoN g)
1536 {
1537 WindoW hDispDlg;
1538 DdvMainWinPtr mWin_d;
1539 DdvDispStylesMSGPtr dsmp;
1540 DdvMainPtr dmp;
1541 DDVUpdateLayoutDataPtr dumdp;
1542 DDVUpdateMSGPtr dump;
1543 Char szBuf[15]={""};
1544 Int2 value;
1545 Char title[10]={""};
1546 Int4 j;
1547
1548 hDispDlg=(WindoW)ParentWindow(g);
1549 Hide(hDispDlg);
1550 if (!hDispDlg) return;
1551
1552 dsmp = (DdvDispStylesMSGPtr) GetObjectExtra (hDispDlg);
1553
1554 if (dsmp==NULL) return;
1555
1556 mWin_d = (DdvMainWinPtr) GetObjectExtra (dsmp->hWinMain);
1557 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
1558
1559 dumdp=(DDVUpdateLayoutDataPtr)MemNew(sizeof(DDVUpdateLayoutData));
1560 if (!dumdp){
1561 MemFree(dsmp);
1562 Remove(hDispDlg);
1563 /*todo : add user message to inform for error*/
1564 return;
1565 }
1566
1567 dump=(DDVUpdateMSGPtr)MemNew(sizeof(DDVUpdateMSG));
1568 if (!dump){
1569 MemFree(dsmp);
1570 MemFree(dumdp);
1571 Remove(hDispDlg);
1572 /*todo : add user message to inform for error*/
1573 return;
1574 }
1575
1576 /*check box for color display*/
1577 dumdp->bUseColors=GetStatus((Handle)dsmp->chk2);
1578 /*show left tail check box*/
1579 dumdp->ShowLeftTail=GetStatus((Handle)dsmp->chk3);
1580 /*show right tail check box*/
1581 dumdp->ShowRightTail=GetStatus((Handle)dsmp->chk4);
1582
1583 if (Enabled((Handle)dsmp->g1)){
1584 /*size of the spacer*/
1585 GetTitle(dsmp->edit1, title, 9);
1586 value=(Int2)atoi(title);
1587 if (value<1)
1588 dumdp->SpacerSize=1;
1589 else if (value>20){
1590 dumdp->SpacerSize=20;
1591 }
1592 else dumdp->SpacerSize=(Uint1)value;
1593 /*get the values back from the user*/
1594 value=GetValue((Handle)dsmp->g2);
1595 if (value==1){/*use spacer ?*/
1596 dumdp->DispDiscStyle=MSA_TXT_STYLE_1;
1597 }
1598 else{/*use justification*/
1599 dumdp->DispDiscStyle=MSA_TXT_STYLE_2;
1600 value=GetValue((Handle)dsmp->g5);
1601 switch(value){
1602 case 1:
1603 dumdp->DiscJustification=DISP_JUST_LEFT;
1604 break;
1605 case 2:
1606 dumdp->DiscJustification=DISP_JUST_RIGHT;
1607 break;
1608 case 3:
1609 dumdp->DiscJustification=DISP_JUST_CENTER;
1610 break;
1611 case 4:
1612 dumdp->DiscJustification=DISP_JUST_SPLIT;
1613 break;
1614 }
1615 }
1616 }
1617
1618 /*sequence list... something selected?*/
1619 /*set the ruler styles*/
1620 for(j=0;j<dmp->MSA_d.pgp_l.nBsp;j++){
1621 if (GetItemStatus (dsmp->BspNames, (Int2)(j+1))){/*selected ?*/
1622 if(!dumdp->SeqList){
1623 dumdp->SeqList=(Int4Ptr)MemNew(sizeof(Int4));
1624 if (!dumdp->SeqList) break;
1625 dumdp->SeqList[0]=j+1;
1626 dumdp->nSeq++;
1627 }
1628 else{
1629 dumdp->SeqList=(Int4Ptr)MemExtend(dumdp->SeqList,
1630 (dumdp->nSeq+1)*sizeof(Int4),dumdp->nSeq*sizeof(Int4));
1631 if (dumdp->SeqList==NULL){
1632 dumdp->nSeq=0;
1633 break;
1634 }
1635 dumdp->SeqList[dumdp->nSeq]=j+1;
1636 dumdp->nSeq++;
1637 }
1638 }
1639 }
1640 if (dumdp->nSeq>0){
1641 value=GetValue((Handle)dsmp->g12);
1642 switch(value){
1643 case 1:
1644 dumdp->RulerStyle=SCALE_POS_TOP;
1645 break;
1646 case 2:
1647 dumdp->RulerStyle=SCALE_POS_NONE;
1648 break;
1649 }
1650 }
1651
1652 dumdp->ddv_panel=mWin_d->hWndDDV;
1653
1654 /*send a OM_MSG_UPDATE message*/
1655 dump->type=UPDATE_TYPE_LAYOUT;
1656 dump->data=(Pointer)dumdp;
1657 ObjMgrSendProcMsg(OM_MSG_UPDATE, dmp->MSA_d.entityID,dmp->MSA_d.itemID,
1658 OBJ_SEQALIGN,0,0,(Pointer)dump);
1659
1660 /*close the dlg box*/
1661 Remove(hDispDlg);
1662 }
1663
1664 /*******************************************************************************
1665
1666 Function : DDV_DispStyles_cancelProc()
1667
1668 Purpose : manage cancel button of the Display Styles dialog box
1669
1670 Parameters : g; button
1671
1672 Return value : none
1673
1674 *******************************************************************************/
1675 static void DDV_DispStyles_cancelProc(ButtoN g)
1676 {
1677 WindoW hDispDlg;
1678 DdvDispStylesMSGPtr dsmp;
1679
1680 hDispDlg=(WindoW)ParentWindow(g);
1681
1682 if (!hDispDlg) return;
1683
1684 dsmp = (DdvDispStylesMSGPtr) GetObjectExtra (hDispDlg);
1685
1686 if (dsmp==NULL) return;
1687
1688 Remove(hDispDlg);
1689 }
1690
1691
1692 /*******************************************************************************
1693
1694 Function : DDV_DispStyles_SelAllProc()
1695
1696 Purpose : manage SelAll BSP button of the Display Styles dialog box
1697
1698 Parameters : g; button
1699
1700 Return value : none
1701
1702 *******************************************************************************/
1703 static void DDV_DispStyles_SelAllProc(ButtoN g)
1704 {
1705 WindoW hDispDlg;
1706 DdvMainWinPtr mWin_d;
1707 DdvDispStylesMSGPtr dsmp;
1708 DdvMainPtr dmp;
1709 Int4 j;
1710
1711 hDispDlg=(WindoW)ParentWindow(g);
1712 if (!hDispDlg) return;
1713 dsmp = (DdvDispStylesMSGPtr) GetObjectExtra (hDispDlg);
1714 if (dsmp==NULL) return;
1715 mWin_d = (DdvMainWinPtr) GetObjectExtra (dsmp->hWinMain);
1716 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
1717
1718 for(j=0;j<dmp->MSA_d.pgp_l.nBsp;j++){
1719 SetItemStatus (dsmp->BspNames, (Int2)(j+1), TRUE);
1720 }
1721 }
1722
1723 /*******************************************************************************
1724
1725 Function : DDV_DispStyles_SelNoneProc()
1726
1727 Purpose : manage Sel None BSP button of the Display Styles dialog box
1728
1729 Parameters : g; button
1730
1731 Return value : none
1732
1733 *******************************************************************************/
1734 static void DDV_DispStyles_SelNoneProc(ButtoN g)
1735 {
1736 WindoW hDispDlg;
1737 DdvMainWinPtr mWin_d;
1738 DdvDispStylesMSGPtr dsmp;
1739 DdvMainPtr dmp;
1740 Int4 j;
1741
1742 hDispDlg=(WindoW)ParentWindow(g);
1743 if (!hDispDlg) return;
1744 dsmp = (DdvDispStylesMSGPtr) GetObjectExtra (hDispDlg);
1745 if (dsmp==NULL) return;
1746 mWin_d = (DdvMainWinPtr) GetObjectExtra (dsmp->hWinMain);
1747 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
1748
1749 for(j=0;j<dmp->MSA_d.pgp_l.nBsp;j++){
1750 SetItemStatus (dsmp->BspNames, (Int2)(j+1), FALSE);
1751 }
1752 }
1753
1754
1755 /*******************************************************************************
1756
1757 Function : DDV_DispStyles_DiscSetCtrlVal()
1758
1759 Purpose : set the values for the ctrl in the group "disc. align options"
1760
1761 Return value : none
1762
1763 *******************************************************************************/
1764 static void DDV_DispStyles_DiscSetCtrlVal(DdvDispStylesMSGPtr dsmp,
1765 DDV_Disp_OptPtr ddop)
1766 {
1767 Char szBuf[15]={""};
1768
1769
1770 Enable(dsmp->g1);
1771
1772 if (ddop->DispDiscStyle==MSA_TXT_STYLE_1)
1773 SetValue(dsmp->g2,1);
1774 else
1775 SetValue(dsmp->g2,2);
1776
1777 sprintf(szBuf,"%i",ddop->SpacerSize);
1778 SetTitle(dsmp->edit1,szBuf);/*spacer size*/
1779
1780 if (ddop->DiscJustification>0)
1781 SetValue(dsmp->g5,(Int2)(ddop->DiscJustification-DISP_JUST_LEFT+1));
1782 else
1783 SetValue(dsmp->g5,1);
1784 }
1785
1786 /*******************************************************************************
1787
1788 Function : DDV_DeselectItem()
1789
1790 Purpose : Deselects everything
1791
1792 Return value : none
1793
1794 *******************************************************************************/
1795 static void DDV_DeselectItem(IteM i)
1796 {
1797 DdvMainWinPtr mWin_d;
1798 DdvMainPtr dmp;
1799 WindoW hWinMain;
1800
1801 hWinMain=(WindoW)ParentWindow(i);
1802 if (hWinMain==NULL) return;
1803 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
1804 if (mWin_d==NULL) return;
1805 if (mWin_d->hWndDDV==NULL) return;
1806 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
1807 if (dmp==NULL) return;
1808
1809 ObjMgrDeSelectAll();
1810 ObjMgrSendProcMsg(OM_MSG_UPDATE, dmp->MSA_d.entityID,dmp->MSA_d.itemID,
1811 OBJ_SEQALIGN,0,0,NULL);
1812 ObjMgrSendMsg(OM_MSG_MOUSEUP, dmp->MSA_d.entityID, dmp->MSA_d.itemID,
1813 OBJ_SEQALIGN);
1814 }
1815
1816 /*******************************************************************************
1817
1818 Function : DDV_DisplayStyles()
1819
1820 Purpose : create the Display Styles dialog box
1821
1822 Return value : none
1823
1824 *******************************************************************************/
1825 static void DDV_DisplayStyles(IteM i)
1826 {
1827 DdvMainWinPtr mWin_d;
1828 DdvMainPtr dmp;
1829 WindoW hWinMain,hDispDlg;
1830 GrouP g0,g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,g11,g12,g13;
1831 LisT BspNames;
1832 ButtoN chk2,chk3,chk4;
1833 TexT edit1;
1834 DdvDispStylesMSGPtr dsmp;
1835 SeqIdPtr sip;
1836 Char szAccess[21];
1837 Char szBuf[10];
1838 Int4 j;
1839 ValNodePtr vnp;
1840 ParaGPtr pgp;
1841
1842 /*get some data*/
1843 hWinMain=(WindoW)ParentWindow(i);
1844 if (hWinMain==NULL) return;
1845 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
1846 if (mWin_d==NULL) return;
1847 if (mWin_d->hWndDDV==NULL) return;
1848 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
1849 if (dmp==NULL) return;
1850
1851 /*init MsgStruct; to be used when user clicks on [OK]*/
1852 dsmp=(DdvDispStylesMSGPtr)MemNew(sizeof(DdvDispStylesMSG));
1853 if (!dsmp) return;
1854
1855 /*DlgBox window*/
1856 hDispDlg=MovableModalWindow(-30, -20, -10, -10,
1857 "DDV - display options", NULL);
1858 if (!hDispDlg){
1859 MemFree(dsmp);
1860 return;
1861 }
1862
1863 SetObjectExtra (hDispDlg, (Pointer) dsmp, StdCleanupExtraProc);
1864 /*
1865 the dlg controls
1866
1867 g6 main group for all the dlg; put all the controls there
1868 |->chk2 check for color display
1869 |
1870 |->g0 main group for "Disc. SeqAlign display options"
1871 | |->g1
1872 | | |->g2 radio group 1 (spacer/seq.)
1873 | | |->g3
1874 | | |->g4 TexT ctrl, spacer size
1875 | | |->g5 radio group 2 (justification)
1876 | |->g13 check btns for tails
1877 |
1878 |->g8 main group for "Bioseq ruler"
1879 | |->g9
1880 | |->BspNames BSP names listbox
1881 | |->g10 the controls (radio & buttons)
1882 | |->g11
1883 | |->g12
1884 |->g7 (ok/cancel buttons)
1885 */
1886 /*top-level group*/
1887 g6=HiddenGroup(hDispDlg, -1, 0,NULL);
1888
1889 chk2=CheckBox(g6,"Use a color display",NULL);
1890
1891 /*Disc. SeqAlign display options group - start*/
1892 g0=NormalGroup(g6, -1, 0, "Disc. SeqAlign display options",NULL, NULL);
1893 g1=HiddenGroup(g0, 2, 0,NULL);
1894 g2=HiddenGroup(g1,0,2,NULL);
1895 RadioButton(g2,"spacer");
1896 RadioButton(g2,"sequence");
1897 g3=HiddenGroup(g1,0,2,NULL);
1898 g4=HiddenGroup(g3,2,0,NULL);
1899 edit1=DialogText(g4,NULL,6,NULL);
1900 g5=HiddenGroup(g3,0,4,NULL);
1901 RadioButton(g5,"Left");
1902 RadioButton(g5,"Right");
1903 RadioButton(g5,"Center");
1904 RadioButton(g5,"Split");
1905 g13=HiddenGroup(g0,0,2,NULL);
1906 chk3=CheckBox(g13,"Show left tail",NULL);
1907 chk4=CheckBox(g13,"Show right tail",NULL);
1908 /*Disc. SeqAlign display options group - end*/
1909
1910 /*Bioseq list - start*/
1911 g8=NormalGroup(g6, -1, 0, "Bioseq ruler",NULL, NULL);
1912 g9=HiddenGroup(g8,0,2,NULL);
1913 BspNames=MultiList(g9,6,6,NULL);
1914 if (dmp->MSA_d.pgp_l.TableHead){
1915 for(j=0;j<dmp->MSA_d.pgp_l.nBsp;j++){
1916 vnp=dmp->MSA_d.pgp_l.TableHead[j];
1917 pgp=(ParaGPtr)vnp->data.ptrvalue;
1918 if (pgp->sip){
1919 sip = SeqIdFindBest(pgp->sip, SEQID_GENBANK);
1920 if (!sip)
1921 sip = SeqIdFindBest(pgp->sip, 0);
1922 SeqIdWrite(sip, szAccess,PRINTID_TEXTID_ACCESSION, 20);
1923 ListItem(BspNames,szAccess);
1924 }
1925 }
1926 }
1927 g10=HiddenGroup(g9,2,0,NULL);
1928 g11=NormalGroup(g10, 2, 0, "Auto select",NULL, NULL);
1929 PushButton (g11, "All", DDV_DispStyles_SelAllProc);
1930 PushButton (g11, "None", DDV_DispStyles_SelNoneProc);
1931 g12=NormalGroup(g10, 3, 0, "Ruler Style",NULL, NULL);
1932 RadioButton(g12,"Top");
1933 RadioButton(g12,"None");
1934 SetValue(g12,2);
1935 /*Bioseq list - end*/
1936
1937 /*ok - cancel group - start*/
1938 g7=HiddenGroup(g6, 2, 0,NULL);
1939 PushButton (g7, "Ok", DDV_DispStyles_OkProc);
1940 PushButton (g7, "Cancel", DDV_DispStyles_cancelProc);
1941 /*ok - cancel group - end*/
1942
1943 /*copy data*/
1944 dsmp->hWinMain=hWinMain;
1945 dsmp->chk2=chk2;
1946 dsmp->chk3=chk3;
1947 dsmp->chk4=chk4;
1948 dsmp->g1=g1;
1949 dsmp->g2=g2;
1950 dsmp->g5=g5;
1951 dsmp->g12=g12;
1952 dsmp->edit1=edit1;
1953 dsmp->BspNames=BspNames;
1954
1955 /*build the dlgbox*/
1956 RealizeWindow(hDispDlg);
1957 Show(hDispDlg);
1958
1959 /*color display check box*/
1960 SetStatus(chk2,dmp->ddo.bUseColors);
1961 /*show left tail check box*/
1962 SetStatus(chk3,dmp->ddo.ShowLeftTail);
1963 /*show right tail check box*/
1964 SetStatus(chk4,dmp->ddo.ShowRightTail);
1965 /*spacer size*/
1966 sprintf(szBuf,"%i",dmp->ddo.SpacerSize);
1967 SetTitle(dsmp->edit1, szBuf);
1968
1969 /*depending on the SAP type, init some controls*/
1970 DDV_DispStyles_DiscSetCtrlVal(dsmp,&(dmp->ddo));
1971 /*
1972 if (AlnMgrIsSAPDiscAli(dmp->MSA_d.pgp_l.sap)){
1973 DDV_DispStyles_DiscSetCtrlVal(dsmp,&(dmp->ddo));
1974 }
1975 else{
1976 Disable(g1);
1977 }
1978 */
1979 }
1980
1981
1982 static void SelectJustify(ChoicE i) {
1983 /*----------------------------------------------------------------------------
1984 * handle the Justify left/right/center selection
1985 *---------------------------------------------------------------------------*/
1986 DdvMainWinPtr mWin_d;
1987 DdvMainPtr dmp;
1988 WindoW hWinMain;
1989 Int2 Value;
1990
1991 hWinMain=(WindoW)ParentWindow(i);
1992 if (!hWinMain) return;
1993 mWin_d = (DdvMainWinPtr) GetObjectExtra(hWinMain);
1994 if (mWin_d==NULL) return;
1995 dmp=(DdvMainPtr)GetObjectExtra(mWin_d->hWndDDV);
1996 if (dmp==NULL) return;
1997 if (!dmp->MSA_d.pgp_l.TableHead) return;
1998
1999 Value = GetValue(i);
2000 switch(Value) {
2001 case 1:
2002 DDE_LeftJustify(dmp->dsp, TRUE);
2003 break;
2004 case 2:
2005 DDE_RightJustify(dmp->dsp, TRUE);
2006 break;
2007 case 3:
2008 DDE_CenterJustify(dmp->dsp, TRUE);
2009 break;
2010 default:
2011 break;
2012 }
2013
2014 /* shut off the selection */
2015 SetValue(mWin_d->MainMenu.Justify, 0);
2016
2017 DDV_ReDraw(dmp);
2018 return;
2019 }
2020
2021
2022 /*******************************************************************************
2023
2024 Function : SelectMouseMode()
2025
2026 Purpose : modification of the mouse mode
2027
2028 Parameters : i; menu item
2029
2030 Return value : none
2031
2032 *******************************************************************************/
2033 static void SelectMouseMode(ChoicE i)
2034 {
2035 Int2 value;
2036 DdvMainWinPtr mWin_d;/*program data*/
2037 DdvMainPtr dmp;
2038 WindoW hWinMain;
2039 Int4 from_col,to_col,from_row,to_row,bsp_pos;
2040 Char szAccess[21];
2041
2042
2043 hWinMain=(WindoW)ParentWindow(i);
2044 if (!hWinMain) return;
2045 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
2046 if (mWin_d==NULL) return;
2047 dmp=(DdvMainPtr)GetObjectExtra(mWin_d->hWndDDV);
2048 if (dmp==NULL) return;
2049 if (!dmp->MSA_d.pgp_l.TableHead) return;
2050
2051 /*get the disp coord range*/
2052 DDV_GetCurrentDispRange(dmp->hWndDDV,&(dmp->GrData),
2053 dmp->MSA_d.pgp_l.LengthAli,&from_col,&to_col,
2054 &from_row,&to_row);
2055 /*switch to one-bsed value because dmp->dci values
2056 are one-based values*/
2057 from_row++;
2058 to_row++;
2059
2060 value=GetValue(i);
2061 switch(value){
2062 case 1:/*query mode*/
2063 dmp->MouseMode=DDV_MOUSEMODE_QUERY;
2064 goto Continue;
2065 case 2:/*select mode*/
2066 dmp->MouseMode=DDV_MOUSEMODE_SELECT;
2067 goto Continue;
2068 case 3:
2069 dmp->MouseMode=DDV_MOUSEMODE_SELECT_ONE_ROW;
2070
2071 Continue:
2072 dmp->dci.old_row=dmp->dci.new_row;
2073 dmp->dci.old_col=dmp->dci.new_col;
2074 dmp->dci.new_row=(Int4)-1;
2075 dmp->dci.new_col=(Int4)-1;
2076 /*hide the caret from old coordinates*/
2077 if (dmp->dci.old_col>=from_col && dmp->dci.old_col<=to_col &&
2078 dmp->dci.old_row>=from_row && dmp->dci.old_row<=to_row){
2079 DDV_InvalRegion(dmp->hWndDDV,&(dmp->GrData),
2080 _max_(0,dmp->dci.old_col-1),dmp->dci.old_col+1,
2081 dmp->dci.old_row,FALSE);
2082 }
2083 SetTitle(mWin_d->InfoPanel,"Ready !");
2084 break;
2085 case 4:/*edit mode*/
2086 dmp->MouseMode=DDV_MOUSEMODE_EDIT;
2087 dmp->dci.new_row=dmp->dci.old_row;
2088 dmp->dci.new_col=dmp->dci.old_col;
2089 /*show the caret from new coordinates*/
2090 if (dmp->dci.new_col>=from_col && dmp->dci.new_col<=to_col &&
2091 dmp->dci.new_row>=from_row && dmp->dci.new_row<=to_row){
2092 DDV_InvalRegion(dmp->hWndDDV,&(dmp->GrData),
2093 _max_(0,dmp->dci.new_col-1),dmp->dci.new_col+1,
2094 dmp->dci.new_row,FALSE);
2095 }
2096 DDV_GetSeqNameGivenRow(dmp->MSA_d.pgp_l.TableHead,
2097 dmp->dci.new_row,szAccess);
2098 bsp_pos=DDV_GetBspCoordGivenPgpList(
2099 dmp->MSA_d.pgp_l.TableHead[dmp->dci.new_row-1],
2100 dmp->dci.new_col);
2101 if (bsp_pos!=(Int4)-1){
2102 DDV_DispPositionInStatus(mWin_d->InfoPanel,
2103 bsp_pos+1,dmp->dci.new_row,szAccess);
2104 /*+1 : switch to one-based value*/
2105 }
2106 break;
2107 }
2108 }
2109
2110 static void DDV_ShowLowerPanel(IteM i)
2111 {
2112 DdvMainWinPtr mWin_d;/*program data*/
2113
2114 mWin_d = (DdvMainWinPtr) GetObjectExtra((Handle)i);
2115 if(!mWin_d) return;
2116 DDV_SetupWin (mWin_d->hWndMain,FALSE);
2117 }
2118
2119 /*******************************************************************************
2120
2121 Function : DDV_SetMenuFocus()
2122
2123 Purpose : Set menu item values depending on which panel has focus
2124
2125 Parameters : w; handle of the dialog box
2126
2127 Return value : none
2128
2129 *******************************************************************************/
2130
2131 NLM_EXTERN void DDV_SetMenuFocus(WindoW w)
2132 {
2133 DdvMainWinPtr mWin_d;/*program data*/
2134 DdvMainPtr dmp;
2135
2136 mWin_d = (DdvMainWinPtr) GetObjectExtra((Handle)w);
2137
2138 if (!mWin_d) return;
2139 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
2140
2141 switch(dmp->MouseMode){
2142 case DDV_MOUSEMODE_QUERY:
2143 SetValue(mWin_d->MainMenu.MouseMode,1);
2144 break;
2145 case DDV_MOUSEMODE_SELECT:
2146 SetValue(mWin_d->MainMenu.MouseMode,2);
2147 break;
2148 case DDV_MOUSEMODE_SELECT_ONE_ROW:
2149 SetValue(mWin_d->MainMenu.MouseMode,3);
2150 break;
2151 case DDV_MOUSEMODE_EDIT:
2152 SetValue(mWin_d->MainMenu.MouseMode,4);
2153 break;
2154 }
2155
2156 }
2157
2158 /*******************************************************************************
2159
2160 Function : DDV_SetupMenus()
2161
2162 Purpose : create the menu of DD-Viewer
2163
2164 Parameters : w; handle of the dialog box
2165 isID1Ok;TRUE if ID1 is enabled
2166 bEditor; true = show editor's commands
2167
2168 Return value : none
2169
2170 *******************************************************************************/
2171 extern void DDV_SetupMenus(WindoW w,Boolean isID1Ok,Boolean bEditor,
2172 SAM_ViewGlobal *vgp)
2173 {
2174 MenU m,s,s2;/*temp variable*/
2175 DdvMainWinPtr mWin_d;/*program data*/
2176 Boolean* pNoGaps;
2177 Boolean NoGaps;
2178
2179 mWin_d = (DdvMainWinPtr) GetObjectExtra((Handle)w);
2180
2181 if (!mWin_d) return;
2182
2183 /*File menu*/
2184 m=PulldownMenu(w,"File");
2185 mWin_d->MainMenu.File=m;
2186
2187 if (mWin_d->AutonomeViewer){/*available only for the Auntonomous viewer*/
2188 s=SubMenu(m,"Open from ");
2189 mWin_d->MainMenu.FileOpen=CommandItem(s,"a local file...",
2190 DDV_OpenFile);
2191 mWin_d->MainMenu.EntrezOpen=CommandItem(s,"the network...",
2192 DDV_OpenNetwork);
2193 if (isID1Ok==FALSE) Disable(mWin_d->MainMenu.EntrezOpen);
2194
2195 mWin_d->MainMenu.FileClose=CommandItem(m,"Close",DDV_FileClose);
2196 SeparatorItem(m);
2197 mWin_d->MainMenu.FileExport=CommandItem(m,"Export...",DDV_ExportTexte);
2198 s=SubMenu(m,"Import ");
2199 mWin_d->MainMenu.ImportSeq=CommandItem(s,"a single sequence",DDV_ImportBioseq);
2200 mWin_d->MainMenu.ImportNucSeqAlign=CommandItem(s,"a nuc. sequence alignment",DDV_ImportNucSeqAlign);
2201 mWin_d->MainMenu.ImportProtSeqAlign=CommandItem(s,"a prot. sequence alignment",DDV_ImportProtSeqAlign);
2202 SeparatorItem(m);
2203 VSMAddToMenu(m, VSM_DESKTOP);
2204 SeparatorItem(m);
2205 }
2206 else{
2207 mWin_d->MainMenu.FileExport=CommandItem(m,"Export...",DDV_ExportTexte);
2208 /* for editor allow save of edits */
2209 if (bEditor) {
2210 mWin_d->MainMenu.SaveEdits=CommandItem(m,"Save",DDV_CallSaveEdits);
2211 }
2212 SeparatorItem(m);
2213 }
2214 mWin_d->MainMenu.QuitViewer=CommandItem(m,"Quit/Q",QuitProc);
2215
2216 /*Edit Menu*/
2217 if (bEditor){
2218 m=PulldownMenu(w,"Edit");
2219 mWin_d->MainMenu.Edit=m;
2220 /*
2221 mWin_d->MainMenu.DeleteRow=CommandItem(m,"Delete row", DDV_DeleteRow);
2222 mWin_d->MainMenu.MoveRowLeft=CommandItem(m,"Move row to the left", DDV_MoveRowLeft);
2223 mWin_d->MainMenu.MoveRowRight=CommandItem(m,"Move row to the right", DDV_MoveRowRight);
2224 mWin_d->MainMenu.LeftBoundaryLeft=CommandItem(m,"Move left boundary left", DDV_MoveLeftBoundaryLeft);
2225 mWin_d->MainMenu.LeftBoundaryRight=CommandItem(m,"Move left boundary right", DDV_MoveLeftBoundaryRight);
2226 mWin_d->MainMenu.RightBoundaryLeft=CommandItem(m,"Move right boundary left", DDV_MoveRightBoundaryLeft);
2227 mWin_d->MainMenu.RightBoundaryRight=CommandItem(m,"Move right boundary right", DDV_MoveRightBoundaryRight);
2228 */
2229 mWin_d->MainMenu.CreateBlock=CommandItem(m,"Create block...", DDV_CreateBlock);
2230 mWin_d->MainMenu.DeleteBlock=CommandItem(m,"Delete block", DDV_DeleteBlock);
2231 mWin_d->MainMenu.Prev=CommandItem(m,"Undo (Ctrl + z)", DDV_Prev);
2232 mWin_d->MainMenu.Next=CommandItem(m,"Redo (Ctrl + y)", DDV_Next);
2233 mWin_d->MainMenu.Orig=CommandItem(m,"Restore original", DDV_Orig);
2234 /* to start, can't undo or redo anything */
2235 Disable(mWin_d->MainMenu.Prev);
2236 Disable(mWin_d->MainMenu.Next);
2237 }
2238
2239 if (mWin_d->AutonomeViewer){
2240 mWin_d->MainMenu.Align = PulldownMenu(w, "Alignment/A");
2241 mWin_d->MainMenu.Hide=CommandItem(mWin_d->MainMenu.Align,
2242 "Hide or Show Rows...",DDV_HideDlgItem);
2243 }
2244
2245 /* Align menu */
2246 if(vgp != NULL) {
2247 if(vgp->MasterViewer == SAMVIEWCN3D) {
2248 mWin_d->MainMenu.Align = PulldownMenu(w, "Alignment/A");
2249 mWin_d->MainMenu.Hide=CommandItem(mWin_d->MainMenu.Align,
2250 "Hide or Show Rows...",DDV_HideDlgItem);
2251 mWin_d->MainMenu.Deselect=CommandItem(mWin_d->MainMenu.Align,
2252 "Deselect All",DDV_DeselectItem);
2253 SeparatorItem(mWin_d->MainMenu.Align);
2254 mWin_d->MainMenu.AddRow = SubMenu(mWin_d->MainMenu.Align, "Add New Row");
2255 mWin_d->MainMenu.FromFile = SubMenu(mWin_d->MainMenu.AddRow, "From FASTA file");
2256 CommandItem(mWin_d->MainMenu.FromFile,
2257 "By gapped BLAST...", (Nlm_ItmActnProc)vgp->BlastFileGap);
2258 CommandItem(mWin_d->MainMenu.FromFile,
2259 "By ungapped BLAST...", (Nlm_ItmActnProc)vgp->BlastFile);
2260 if (vgp->NetStartProc) {
2261 mWin_d->MainMenu.FromNet = SubMenu(mWin_d->MainMenu.AddRow, "Download from Entrez");
2262 CommandItem(mWin_d->MainMenu.FromNet,
2263 "By gapped BLAST...", (Nlm_ItmActnProc)vgp->BlastNetGap);
2264 CommandItem(mWin_d->MainMenu.FromNet,
2265 "By ungapped BLAST...", (Nlm_ItmActnProc)vgp->BlastNet);
2266 }
2267 }
2268 }
2269
2270 /*Options menu*/
2271 m=PulldownMenu(w,"Options");
2272 mWin_d->MainMenu.Options=m;
2273 if (!bEditor) {
2274 mWin_d->MainMenu.DispStyles=CommandItem(m,"Styles",DDV_DisplayStyles);
2275 }
2276
2277 #ifdef DEBUG_DDV
2278 CommandItem(m,"Switch UA Gap",DDV_ShowHideUnAlignGap);
2279 #endif
2280 s=SubMenu(m,"Mouse modes");
2281 mWin_d->MainMenu.MouseMode=ChoiceGroup(s,SelectMouseMode);
2282 ChoiceItem(mWin_d->MainMenu.MouseMode,"Query");
2283 ChoiceItem(mWin_d->MainMenu.MouseMode,"Select rectangle");
2284 ChoiceItem(mWin_d->MainMenu.MouseMode,"Select one row");
2285 /* only allow "Edit" option for DDE, when not running in NoGaps mode */
2286 pNoGaps = (Boolean*) GetAppProperty("dde_nogaps");
2287 if (pNoGaps == NULL) NoGaps = TRUE;
2288 else NoGaps = *pNoGaps;
2289 if (!NoGaps) {
2290 if (bEditor)
2291 ChoiceItem(mWin_d->MainMenu.MouseMode,"Edit");
2292 }
2293
2294 if (bEditor) {
2295 s2=SubMenu(m,"Justify");
2296 mWin_d->MainMenu.Justify=ChoiceGroup(s2,SelectJustify);
2297 ChoiceItem(mWin_d->MainMenu.Justify,"Left");
2298 ChoiceItem(mWin_d->MainMenu.Justify,"Right");
2299 ChoiceItem(mWin_d->MainMenu.Justify,"Center");
2300 }
2301
2302 /* only launch the editor from the viewer */
2303 if (!bEditor && mWin_d->EditAllowed) {
2304 mWin_d->MainMenu.ShowLowerPanel = StatusItem(m,
2305 "Show Lower Panel/L", DDV_ShowLowerPanel);
2306 SetObjectExtra (mWin_d->MainMenu.ShowLowerPanel, (Pointer)mWin_d, NULL);
2307 mWin_d->MainMenu.LaunchEditor=CommandItem(m,"Launch editor...",DDV_LaunchEditor);
2308 mWin_d->MainMenu.MergeBlocks=CommandItem(m,"Merge 2 blocks...",DDV_MergeBlocks);
2309 mWin_d->MainMenu.SplitBlock=CommandItem(m,"Split block in 2...",DDV_SplitBlock);
2310 mWin_d->MainMenu.DeleteDDVBlock=CommandItem(m, "Delete block...",DDV_DeleteBlock2);
2311 }
2312
2313 if (mWin_d->AutonomeViewer && mWin_d->NetCfgMenuProc){
2314 mWin_d->MainMenu.ConfigNet=CommandItem(m,"Network...",
2315 mWin_d->NetCfgMenuProc);
2316 }
2317 /*Help menu*/
2318 m=PulldownMenu(w,"Help");
2319 CommandItem(m,"About...",DDV_AboutProc);
2320 }
2321
2322 /*******************************************************************************
2323
2324 Function : DDV_WinMainCleanup()
2325
2326 Purpose : free memory before leaving viewer
2327
2328 Parameters : mWin_d ; main window data
2329
2330 Return value : none
2331
2332 *******************************************************************************/
2333 extern void DDV_WinMainCleanup(GraphiC g, VoidPtr data)
2334 {
2335 DdvMainWinPtr mWin_d;
2336
2337 if (!data) return;
2338 mWin_d=(DdvMainWinPtr)data;
2339
2340 /*main window data - Logo*/
2341 /* if (mWin_d->f1) DeleteFont(mWin_d->f1);
2342 if (mWin_d->f2) DeleteFont(mWin_d->f2);
2343 if (mWin_d->f3) DeleteFont(mWin_d->f3);
2344 */
2345 /*delete Align data*/
2346 DDV_CloseData(mWin_d,TRUE);
2347
2348 MemFree(mWin_d);
2349 }
2350
2351 /*******************************************************************************
2352
2353 Purpose : init the graphical data structure of DDV. Use only when you start DDV.
2354
2355 Function : DDV_InitGraphGlobal()
2356
2357 Parameters : dmp; main DDV data block
2358
2359 Return value : -
2360
2361 *******************************************************************************/
2362 extern void DDV_InitGraphGlobal(DdvMainPtr dmp)
2363 {
2364 Int2 decal=0;
2365
2366 dmp->GrData.udv_font.LineHeight=
2367 UDV_ComputeLineHeight(dmp->GrData.udv_font.cyChar);
2368 dmp->GrData.udv_font.ColWidth=
2369 DDV_ComputeColWidth(dmp->GrData.udv_font.cxChar);
2370 UDV_Init_ScaleData(&(dmp->GrData));
2371 UDV_Build_Other_Colors(&(dmp->GrData));
2372 /*... then adjust values for DDV*/
2373 dmp->GrData.udv_scale.ScalePosition=(Int2)SCALE_POS_TOP;
2374 dmp->GrData.udv_panel.ShowFeatures=FALSE;
2375 dmp->GrData.udv_panel.ShowByBlock=FALSE;
2376 dmp->GrData.udv_scale.cxLeftScale=dmp->GrData.udv_font.cxChar*2;
2377 dmp->GrData.udv_panel.cxName=PANEL_NAME_WIDTH*dmp->GrData.udv_font.cxChar;
2378 if (dmp->GrData.udv_scale.ShowMajorTick) decal++;
2379 if (dmp->GrData.udv_scale.ScalePosition==SCALE_POS_TOP) decal++;
2380 dmp->GrData.udv_panel.cyScale=decal*dmp->GrData.udv_font.LineHeight;
2381 dmp->MSA_d.pgp_l.DisplayType=DDV_DISP_HORZ;
2382 }
2383
2384 /*******************************************************************************
2385
2386 Function : DDV_SetRulerAttribInPGP()
2387
2388 Purpose : modify the BSP ruler attribute for a row in the MSA
2389
2390 Return value : -
2391
2392 *******************************************************************************/
2393 extern void DDV_SetRulerAttribInPGP(ValNodePtr ParaG_Head, Uint1 RulerStyle)
2394 {
2395 ValNodePtr vnp;
2396 ParaGPtr pgp;
2397
2398 vnp=ParaG_Head;
2399 while(vnp){
2400 pgp=(ParaGPtr)vnp->data.ptrvalue;
2401 if (pgp){
2402 pgp->ScaleStyle=RulerStyle;
2403 switch (RulerStyle){
2404 case SCALE_POS_NONE:
2405 pgp->nLines=1;
2406 break;
2407 case SCALE_POS_TOP:
2408 pgp->nLines=2;
2409 break;
2410 default:
2411 pgp->nLines=1;
2412 break;
2413 }
2414 }
2415 vnp=vnp->next;
2416 }
2417 }
2418
2419 /*******************************************************************************
2420
2421 Function : DDV_SetRulerAttribInPGP()
2422
2423 Purpose : modify the BSP ruler attribute for a row in the MSA
2424
2425 Return value : -
2426
2427 *******************************************************************************/
2428 extern void DDV_SortPGPLineNum(ValNodePtr PNTR Head, Int4 nBsp)
2429 {
2430 ValNodePtr vnp;
2431 ParaGPtr pgp;
2432 Int4 n=0,j;
2433
2434 for(j=0;j<nBsp;j++){
2435 vnp=Head[j];
2436 while(vnp){
2437 pgp=(ParaGPtr)vnp->data.ptrvalue;
2438 pgp->StartLine=n;
2439 vnp=vnp->next;
2440 }
2441 n+=pgp->nLines;
2442 }
2443 }
2444
2445 /*******************************************************************************
2446
2447 Function : DDV_ExportSeqAlign()
2448
2449 Purpose : export a SeqAlign
2450
2451 Return value : none
2452
2453 *******************************************************************************/
2454 static void DDV_ExportSeqAlign(SeqAlignPtr sap,CharPtr szFName)
2455 {
2456 SeqAlignPtr sap_to_save=NULL;
2457 AsnIoPtr aip;
2458 AsnTypePtr atp;
2459 AsnModulePtr amp;
2460
2461 sap_to_save=AlnMgrGetSubAlign(sap, NULL, 0, -1);
2462 if (sap_to_save==NULL) goto error;
2463
2464 amp = AsnAllModPtr ();
2465 atp = AsnTypeFind (amp,"Seq-align");
2466
2467 if ((aip = AsnIoOpen (szFName, "w")) == NULL) goto error;
2468 SeqAlignAsnWrite( sap, aip, atp );
2469 AsnIoReset(aip);
2470 return;
2471 error:
2472 if (sap_to_save) SeqAlignFree(sap_to_save);
2473 Message(MSG_OK, "Sorry, ASN.1 SeqAlign cannot be exported.");
2474 return;
2475 }
2476
2477 /*******************************************************************************
2478
2479 Function : DDV_ExportSeqAlign()
2480
2481 Purpose : export a SeqAlign
2482
2483 Return value : none
2484
2485 *******************************************************************************/
2486 static void DDV_ExportSeqAnnot(SeqAlignPtr sap,CharPtr szFName)
2487 {
2488 SeqAlignPtr sap_to_save=NULL;
2489
2490 sap_to_save=AlnMgrGetSubAlign(sap, NULL, 0, -1);
2491 if (sap_to_save==NULL){
2492 Message(MSG_OK, "Sorry, ASN.1 SeqAlign cannot be exported.");
2493 return;
2494 }
2495 /*Salsa export function*/
2496 seqalign_write (sap_to_save, szFName);
2497 if (sap_to_save) SeqAlignFree(sap_to_save);
2498 }
2499
2500 /*******************************************************************************
2501
2502 Function : DDVExportTexteChooseFormat()
2503
2504 Purpose : manage popup list of SeqAlign Format (export)
2505
2506 Return value : none
2507
2508 *******************************************************************************/
2509 static void DDVExportTexteChooseFormat (PopuP pop)
2510 {
2511 DdvExportTexteMSGPtr detmp;
2512 WindoW hExportDlg;
2513 Int2 value;
2514
2515 hExportDlg=(WindoW)ParentWindow(pop);
2516
2517 if (!hExportDlg) return;
2518
2519 detmp = (DdvExportTexteMSGPtr) GetObjectExtra (hExportDlg);
2520
2521 if (detmp==NULL) return;
2522
2523 value=GetValue(pop);
2524
2525 if(value>2){
2526 Disable(detmp->chk2);
2527 Disable(detmp->chk3);
2528 Disable(detmp->chk4);
2529 Disable(detmp->chk5);
2530 Disable(detmp->chk6);
2531 }
2532 else{
2533 Enable(detmp->chk2);
2534 Enable(detmp->chk3);
2535 Enable(detmp->chk4);
2536 Enable(detmp->chk5);
2537 Enable(detmp->chk6);
2538 }
2539 return;
2540 }
2541
2542 /*******************************************************************************
2543
2544 Function : DDVExportTexteOkProc()
2545
2546 Purpose : manage ok button of the Export dialog box
2547
2548 Return value : none
2549
2550 *******************************************************************************/
2551 static void DDVExportTexteOkProc(ButtoN g)
2552 {
2553 DdvExportTexteMSGPtr detmp;
2554 DdvMainWinPtr mWin_d;
2555 DdvMainPtr dmp;
2556 DDVOptionsBlock dob;
2557 WindoW hExportDlg;
2558 Uint4 disp_options=0;
2559 FILE *hFile;
2560 Int2 value;
2561 Boolean bRulerNum,bRulerTick,bShowBlock,bShowStrand,bShowBSPcoord,
2562 bPrintGap;
2563 Char szFName[PATH_MAX]={""};
2564
2565 hExportDlg=(WindoW)ParentWindow(g);
2566
2567 if (!hExportDlg) return;
2568
2569 detmp = (DdvExportTexteMSGPtr) GetObjectExtra (hExportDlg);
2570
2571 if (detmp==NULL) {
2572 Remove(hExportDlg);
2573 return;
2574 }
2575
2576 mWin_d = (DdvMainWinPtr) GetObjectExtra (detmp->hWinMain);
2577 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
2578
2579 /*get the user's choices*/
2580 value=GetValue(detmp->pop);
2581
2582 bRulerNum=bRulerTick=bShowBlock=bShowStrand=bShowBSPcoord=FALSE;
2583 disp_options = VIEW_FULLSEQ;
2584
2585 if(value<3){/*text and HTML only*/
2586 bRulerNum=GetStatus(detmp->chk2);
2587 if (bRulerNum){
2588 bRulerTick=GetStatus(detmp->chk3);
2589 }
2590 else{
2591 bRulerTick=FALSE;
2592 }
2593 bShowBlock=GetStatus(detmp->chk4);
2594 bShowStrand=GetStatus(detmp->chk5);
2595 bShowBSPcoord=GetStatus(detmp->chk6);
2596 if (bRulerNum) disp_options |= RULER_TOP;
2597 if (bRulerTick) disp_options|=RULER_TICK;
2598 if (bShowBlock) disp_options|=DISPE_SHOWBLOCK;
2599 if (bShowStrand) disp_options|=DISP_STRAND;
2600 if (bShowBSPcoord) disp_options|=DISP_BSP_COORD;
2601 }
2602
2603 GetTitle(detmp->edit1, szFName, PATH_MAX-1);
2604
2605 switch(value){
2606 case 1:/*text*/
2607 disp_options|=DISP_FULL_TXT;
2608 break;
2609 case 2:/*html*/
2610 disp_options|=DISP_FULL_HTML;
2611 break;
2612 case 3:/*philou*/
2613 disp_options|=DISP_PHYLIP_TXT;
2614 break;
2615 case 4:/*fasta + gaps*/
2616 bPrintGap=TRUE;
2617 break;
2618 case 5:/*fasta without gaps*/
2619 bPrintGap=FALSE;
2620 break;
2621 case 6:/*seqalign*/
2622 DDV_ExportSeqAlign(dmp->MSA_d.pgp_l.sap,szFName);
2623 Remove(hExportDlg);
2624 return;
2625 case 7:/*seqannot*/
2626 DDV_ExportSeqAnnot(dmp->MSA_d.pgp_l.sap,szFName);
2627 Remove(hExportDlg);
2628 return;
2629 }
2630
2631 MemFill(&dob,0,sizeof(DDVOptionsBlock));
2632 dob.LineSize=ParaG_Size;
2633 hFile=fopen(szFName,"w");
2634 if (!hFile){
2635 Message(MSG_OK, "File creation failed !");
2636 }
2637 else{/*a last... save the SeqAlign*/
2638 switch(value){
2639 case 1:
2640 case 2:
2641 case 3:/*text,html,philou only*/
2642 DDV_DumpSAPInAFile(&(dmp->MSA_d.pgp_l),&dob, hFile,disp_options,
2643 dmp->Globals.colorp);
2644 break;
2645 case 4:
2646 case 5:/*Fasta*/
2647 DDV_DumpSAPInFastaFile(&(dmp->MSA_d.pgp_l),&dob, hFile,bPrintGap);
2648 break;
2649 }
2650 fclose(hFile);
2651 }
2652 Remove(hExportDlg);
2653 }
2654
2655 /*******************************************************************************
2656
2657 Function : DDVExportTextecancelProc()
2658
2659 Purpose : manage cancel button of the Export dialog box
2660
2661 Return value : none
2662
2663 *******************************************************************************/
2664 static void DDVExportTextecancelProc(ButtoN g)
2665 {
2666 WindoW hExportDlg;
2667 DdvExportTexteMSGPtr detmp;
2668
2669 hExportDlg=(WindoW)ParentWindow(g);
2670
2671 if (!hExportDlg) return;
2672
2673 detmp = (DdvExportTexteMSGPtr) GetObjectExtra (hExportDlg);
2674
2675 if (detmp==NULL) {
2676 Remove(hExportDlg);
2677 return;
2678 }
2679
2680 Remove(hExportDlg);
2681 }
2682
2683 /*******************************************************************************
2684
2685 Function : DDVExportTexteShowNumber()
2686
2687 Purpose : manage ShoWNumber checkbox of the Export dialog box
2688
2689 Return value : none
2690
2691 *******************************************************************************/
2692 static void DDVExportTexteShowNumber(ButtoN g)
2693 {
2694 WindoW hExportDlg;
2695 DdvExportTexteMSGPtr detmp;
2696
2697 hExportDlg=(WindoW)ParentWindow(g);
2698
2699 if (!hExportDlg) return;
2700
2701 detmp = (DdvExportTexteMSGPtr) GetObjectExtra (hExportDlg);
2702
2703 if (detmp==NULL) return;
2704
2705 if (GetStatus(detmp->chk2)==FALSE){
2706 Disable(detmp->chk3);
2707 }
2708 else{
2709 Enable(detmp->chk3);
2710 }
2711
2712 return;
2713 }
2714
2715 /*******************************************************************************
2716
2717 Function : DDVExportTexteFNameProc()
2718
2719 Purpose : manage File name edit control of the Export dialog box
2720
2721 Parameters : t; edit control
2722
2723 Return value : none
2724
2725 *******************************************************************************/
2726 static void DDVExportTexteFNameProc(TexT t)
2727 {
2728 Char szFName[PATH_MAX]={""};
2729 WindoW hExportDlg;
2730 DdvExportTexteMSGPtr detmp;
2731
2732 hExportDlg=(WindoW)ParentWindow(t);
2733
2734 if (!hExportDlg) return;
2735
2736 detmp = (DdvExportTexteMSGPtr) GetObjectExtra (hExportDlg);
2737
2738 if (detmp==NULL) return;
2739
2740 GetTitle(t, szFName, PATH_MAX-1);
2741
2742 if (StringLen(szFName) == 0)
2743 Disable(detmp->ok);
2744 else Enable(detmp->ok);
2745
2746 return;
2747 }
2748
2749 /*******************************************************************************
2750
2751 Function : DDVExportTexteBrowseFile()
2752
2753 Purpose : manage browse button of the Export dialog box
2754
2755 Parameters : g; button
2756
2757 Return value : none
2758
2759 *******************************************************************************/
2760 static void DDVExportTexteBrowseFile(ButtoN g)
2761 {
2762 WindoW hExportDlg;
2763 DdvExportTexteMSGPtr detmp;
2764 Char path[PATH_MAX]={""};
2765
2766 hExportDlg=(WindoW)ParentWindow(g);
2767
2768 if (!hExportDlg) return;
2769
2770 detmp = (DdvExportTexteMSGPtr) GetObjectExtra (hExportDlg);
2771
2772 if (detmp==NULL) return;
2773 if (!detmp->edit1) return;
2774
2775 if (GetOutputFileName (path, PATH_MAX-1, NULL)){
2776 SetTitle(detmp->edit1, path);
2777 DDVExportTexteFNameProc(detmp->edit1);
2778 }
2779
2780 return;
2781 }
2782
2783 /*******************************************************************************
2784
2785 Function : DDV_ExportTexte()
2786
2787 Purpose : create the Export dialog box
2788
2789 Return value : none
2790
2791 *******************************************************************************/
2792 static void DDV_ExportTexte(IteM i)
2793 {
2794 DdvExportTexteMSGPtr detmp;
2795 DdvMainWinPtr mWin_d;
2796 DdvMainPtr dmp;
2797 WindoW hWinMain,hExportDlg;
2798 GrouP g0,g1,g4,g7,g8,g10;
2799 ButtoN chk2,chk3,chk4,chk5,chk6,browse,ok;
2800 TexT edit1;
2801 PopuP pop;
2802 PrompT txt;
2803
2804 /*get some data*/
2805 hWinMain=(WindoW)ParentWindow(i);
2806 if (hWinMain==NULL) return;
2807 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
2808 if (mWin_d==NULL) return;
2809 if (mWin_d->hWndDDV==NULL) return;
2810 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
2811 if (dmp==NULL) return;
2812
2813 /*init MsgStruct; to be used when user clicks on [OK]*/
2814 detmp=(DdvExportTexteMSGPtr)MemNew(sizeof(DdvExportTexteMSG));
2815 if (!detmp) return;
2816
2817 /*DlgBox window*/
2818 hExportDlg=MovableModalWindow(-30, -20, -10, -10,
2819 "DDV - export a SeqAlign", NULL);
2820
2821 if (!hExportDlg){
2822 MemFree(detmp);
2823 return;
2824 }
2825
2826 SetObjectExtra (hExportDlg, (Pointer) detmp, StdCleanupExtraProc);
2827
2828 /*top-level groups*/
2829 g0=HiddenGroup(hExportDlg, -1, 0,NULL);
2830
2831 g1=NormalGroup(g0,2,0,"SeqAlign Ruler",NULL,NULL);
2832 /* g2=HiddenGroup(g1,2,0);*/
2833 chk2=CheckBox(g1,"Show number",DDVExportTexteShowNumber);
2834 chk3=CheckBox(g1,"Show ticks",NULL);
2835
2836 g4=NormalGroup(g0,0,4,"SeqAlign format",NULL,NULL);
2837 chk4=CheckBox(g4,"Use block of 10 letters",NULL);
2838 chk5=CheckBox(g4,"Display strand orientation",NULL);
2839 chk6=CheckBox(g4,"Display BioSeq coordinates",NULL);
2840 g7=HiddenGroup(g4,2,0,NULL);
2841 txt=StaticPrompt(g7,"Format :",0,0,systemFont,'l');
2842 #ifdef WIN_MAC
2843 pop=PopupList(g7,TRUE,DDVExportTexteChooseFormat);
2844 #endif
2845
2846 #ifndef WIN_MAC
2847 pop=PopupList(g7,FALSE,DDVExportTexteChooseFormat);
2848 #endif
2849 AlignObjects(ALIGN_MIDDLE,(HANDLE) txt, (HANDLE) pop, NULL);
2850 PopupItem(pop,"Text");
2851 PopupItem(pop,"HTML");
2852 PopupItem(pop,"Phylip");
2853 PopupItem(pop,"Fasta with gaps");
2854 PopupItem(pop,"Fasta without gaps");
2855 PopupItem(pop,"ASN.1 SeqAlign");
2856 PopupItem(pop,"ASN.1 SeqAnnot");
2857
2858 g8=NormalGroup(g0,3,0,"File name",NULL,NULL);
2859 edit1=DialogText(g8,"",20,DDVExportTexteFNameProc);
2860 browse=PushButton (g8, "Browse...", DDVExportTexteBrowseFile);
2861
2862 /*ok - cancel group - start*/
2863 g10=HiddenGroup(g0, 2, 0,NULL);
2864 ok=PushButton (g10, "Ok", DDVExportTexteOkProc);
2865 PushButton (g10, "Cancel", DDVExportTextecancelProc);
2866 /*build the dlgbox*/
2867 RealizeWindow(hExportDlg);
2868 Show(hExportDlg);
2869 /*copy data*/
2870 detmp->hWinMain=hWinMain;
2871 detmp->chk2=chk2;
2872 detmp->chk3=chk3;
2873 detmp->chk4=chk4;
2874 detmp->chk5=chk5;
2875 detmp->chk6=chk6;
2876 detmp->pop=pop;
2877 detmp->edit1=edit1;
2878 detmp->ok=ok;
2879 /*color display check box*/
2880 SetStatus(chk2,TRUE);
2881 SetStatus(chk3,TRUE);
2882 SetStatus(chk4,TRUE);
2883 SetStatus(chk5,TRUE);
2884 SetStatus(chk6,TRUE);
2885 SetValue(pop,1);
2886 Disable(detmp->ok);
2887 }
2888
2889 /*******************************************************************************
2890
2891 Function : UDV_GotoBtnProc()
2892
2893 Purpose : create the Export dialog box
2894
2895 Return value : none
2896
2897 *******************************************************************************/
2898 static void UDV_GotoBtnProc(ButtoN g)
2899 {
2900 DdvMainWinPtr dmwp;
2901 DdvMainPtr dmp;
2902 MsaParaGPopList mppl;
2903 WindoW hParent;
2904 Char szCol[20],szRow[20],szInfo[255];
2905 Int4 col,row,from_col,to_col,from_row,to_row,old_pos;
2906 Boolean bHorzScroll,bVertScroll;
2907 BaR hsb,vsb;
2908
2909 /*get main data block*/
2910 hParent=(WindoW)ParentWindow(g);
2911 if (!hParent) return;
2912 dmwp=(DdvMainWinPtr)GetObjectExtra(hParent);
2913 if (!dmwp) return;
2914 dmp=(DdvMainPtr)GetObjectExtra(dmwp->hWndDDV);
2915 if (!dmp) return;
2916
2917 /*get user values*/
2918 GetTitle(dmwp->gotoValCol,szCol,19);
2919 GetTitle(dmwp->gotoValRow,szRow,19);
2920 col=atoi(szCol);
2921 row=atoi(szRow);
2922
2923 /*check their validity*/
2924 mppl=dmp->MSA_d.pgp_l;
2925 if (row<1 || row>mppl.nBsp){
2926 sprintf(szInfo,"Please enter a 'row' value in\nthe range [1..%i]",
2927 mppl.nBsp);
2928 Message(MSG_OK,szInfo);
2929 Select(dmwp->gotoValRow);
2930 return;
2931 }
2932 if (col<1 || col>mppl.LengthAli){
2933 sprintf(szInfo,"Please enter a 'column' value in\nthe range [1..%i]",
2934 mppl.LengthAli);
2935 Message(MSG_OK,szInfo);
2936 Select(dmwp->gotoValCol);
2937 return;
2938 }
2939
2940 /*do I need to scroll the panel content*/
2941 DDV_GetCurrentDispRange(dmwp->hWndDDV,&dmp->GrData,mppl.LengthAli,
2942 &from_col,&to_col,&from_row,&to_row);
2943 if (col>=from_col && col<=to_col)
2944 bHorzScroll=FALSE;
2945 else
2946 bHorzScroll=TRUE;
2947 if (row>=from_row && row<=to_row)
2948 bVertScroll=FALSE;
2949 else
2950 bVertScroll=TRUE;
2951
2952 dmp->dtd.col=col;
2953 dmp->dtd.row=row;
2954 if (bHorzScroll){
2955 hsb = GetSlateHScrollBar ((SlatE) dmp->hWndDDV);
2956 col--;/*switch to zero-based values*/
2957 old_pos=GetBarValue(hsb);
2958 SetValue(hsb,old_pos+(col-old_pos)-5);
2959 }
2960 if (bVertScroll){
2961 vsb = GetSlateVScrollBar ((SlatE) dmp->hWndDDV);
2962 row--;/*switch to zero-based values*/
2963 old_pos=GetBarValue(vsb);
2964 SetValue(vsb,old_pos+(row-old_pos));
2965 }
2966 dmp->dtd.action=DDV_INVAL_REGION;
2967 dmp->dtd.status=DDV_SET_TIMER;
2968 }
2969
2970 /*******************************************************************************
2971
2972 Function : DDV_TimerProc()
2973
2974 Purpose : timer callback of DDV
2975
2976 Return value : none
2977
2978 *******************************************************************************/
2979 extern void DDV_TimerProc (WindoW w)
2980 {
2981 DdvMainWinPtr dmwp;
2982 DdvMainPtr dmp;
2983 Int4 col,row;
2984
2985 /*get main data block*/
2986 dmwp=(DdvMainWinPtr)GetObjectExtra(w);
2987 if (!dmwp) return;
2988 dmp=(DdvMainPtr)GetObjectExtra(dmwp->hWndDDV);
2989 if (!dmp) return;
2990 if (dmp->dtd.status==DDV_SET_TIMER){
2991 dmp->dtd.delay=0;
2992 if (dmp->dtd.action==DDV_INVAL_REGION){
2993 DDV_InvalRegion(dmp->hWndDDV,&(dmp->GrData),
2994 _max_(0,dmp->dtd.col-1),dmp->dtd.col+1,
2995 dmp->dtd.row,FALSE);
2996 }
2997 dmp->dtd.status=DDV_TEST_TIMER;
2998 }
2999 if (dmp->dtd.status==DDV_TEST_TIMER){
3000 if (dmp->dtd.delay>10){
3001 if (dmp->dtd.action==DDV_INVAL_REGION){
3002 col=dmp->dtd.col;
3003 row=dmp->dtd.row;
3004 dmp->dtd.col=0;
3005 dmp->dtd.row=0;
3006 DDV_InvalRegion(dmp->hWndDDV,&(dmp->GrData),
3007 _max_(0,col-1),col+1,row,FALSE);
3008 dmp->dtd.action=DDV_NOTHING;
3009 }
3010 }
3011 }
3012 dmp->dtd.delay++;
3013 }
3014
3015 /*******************************************************************************
3016
3017 Function : DDV_DeleteRow()
3018
3019 Purpose : UI to delete a row
3020
3021 Return value : none
3022
3023 *******************************************************************************/
3024 static void DDV_DeleteRow(IteM i)
3025 {
3026 DdvMainWinPtr mWin_d;
3027 DdvMainPtr dmp;
3028 WindoW hWinMain,temport;
3029 DDE_StackPtr ddesp;
3030 RecT rcP;
3031 static Int4 PassCount = 0;
3032 BaR hsb;
3033
3034 /*get some data*/
3035 hWinMain=(WindoW)ParentWindow(i);
3036 if (hWinMain==NULL) return;
3037 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
3038 if (mWin_d==NULL) return;
3039 if (mWin_d->hWndDDV==NULL) return;
3040 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
3041 if (dmp==NULL) return;
3042
3043 ddesp = dmp->dsp;
3044
3045 if (PassCount == 0) {
3046 DDE_ShiftBlock(ddesp, 0, 5, TRUE);
3047 }
3048
3049 if (PassCount == 1) {
3050 DDE_ShiftBlock(ddesp, 0, -5, TRUE);
3051 PassCount = 4;
3052 }
3053
3054 if (PassCount == 5) {
3055 DDE_InsertGap(ddesp, 7, 1649, TRUE);
3056 DDE_InsertGap(ddesp, 7, 1649, TRUE);
3057 DDE_InsertGap(ddesp, 7, 9, TRUE);
3058 DDE_InsertGap(ddesp, 7, 9, TRUE);
3059 DDE_InsertGap(ddesp, 7, 9, TRUE);
3060 DDE_InsertGap(ddesp, 7, 11, TRUE);
3061 DDE_InsertGap(ddesp, 7, 3, TRUE);
3062 DDE_InsertGap(ddesp, 7, 1, TRUE);
3063 DDE_InsertGap(ddesp, 7, 0, TRUE);
3064 DDE_InsertGap(ddesp, 7, 0, TRUE);
3065 DDE_InsertGap(ddesp, 7, 27, TRUE);
3066 DDE_InsertGap(ddesp, 7, 23, TRUE);
3067 DDE_InsertGap(ddesp, 7, 22, TRUE);
3068 DDE_InsertGap(ddesp, 7, 1645, TRUE);
3069 DDE_InsertGap(ddesp, 7, 1655, TRUE);
3070 DDE_InsertGap(ddesp, 7, 1649, TRUE);
3071 DDE_InsertGap(ddesp, 7, 1649, TRUE);
3072 DDE_InsertGap(ddesp, 7, 1650, TRUE);
3073 DDE_InsertGap(ddesp, 7, 1648, TRUE);
3074 DDE_InsertGap(ddesp, 7, 1648, TRUE);
3075 PassCount = 6;
3076 }
3077
3078 if (PassCount == 7) {
3079 DDE_RemoveGap(ddesp, 7, 1649, TRUE);
3080 DDE_RemoveGap(ddesp, 7, 1645, TRUE);
3081 DDE_RemoveGap(ddesp, 7, 15, TRUE);
3082 DDE_RemoveGap(ddesp, 7, 15, TRUE);
3083 DDE_RemoveGap(ddesp, 7, 1, TRUE);
3084 DDE_RemoveGap(ddesp, 7, 1, TRUE);
3085 DDE_RemoveGap(ddesp, 7, 25, TRUE);
3086 DDE_RemoveGap(ddesp, 7, 20, TRUE);
3087 DDE_RemoveGap(ddesp, 7, 18, TRUE);
3088 DDE_RemoveGap(ddesp, 7, 12, TRUE);
3089 DDE_RemoveGap(ddesp, 7, 11, TRUE);
3090 DDE_RemoveGap(ddesp, 7, 4, TRUE);
3091 DDE_RemoveGap(ddesp, 7, 0, TRUE);
3092 DDE_RemoveGap(ddesp, 7, 0, TRUE);
3093 DDE_InsertGap(ddesp, 7, 0, TRUE);
3094 DDE_RemoveGap(ddesp, 7, 1636, TRUE);
3095 DDE_InsertGap(ddesp, 7, 1645, TRUE);
3096 DDE_InsertGap(ddesp, 7, 1647, TRUE);
3097 DDE_RemoveGap(ddesp, 7, 1645, TRUE);
3098 DDE_RemoveGap(ddesp, 7, 1646, TRUE);
3099 DDE_InsertGap(ddesp, 7, 1645, TRUE);
3100 DDE_InsertGap(ddesp, 7, 1647, TRUE);
3101 DDE_RemoveGap(ddesp, 7, 1647, TRUE);
3102 DDE_RemoveGap(ddesp, 7, 1645, TRUE);
3103 DDE_RemoveGap(ddesp, 7, 0, TRUE);
3104 DDE_InsertGap(ddesp, 7, 0, TRUE);
3105 DDE_InsertGap(ddesp, 7, 0, TRUE);
3106 DDE_InsertGap(ddesp, 7, 1, TRUE);
3107 DDE_InsertGap(ddesp, 7, 3, TRUE);
3108 DDE_InsertGap(ddesp, 7, 5, TRUE);
3109 DDE_RemoveGap(ddesp, 7, 1, TRUE);
3110 DDE_RemoveGap(ddesp, 7, 2, TRUE);
3111 DDE_RemoveGap(ddesp, 7, 0, TRUE);
3112 DDE_RemoveGap(ddesp, 7, 0, TRUE);
3113 DDE_RemoveGap(ddesp, 7, 1, TRUE);
3114 DDE_InsertGap(ddesp, 7, 1649, TRUE);
3115 DDE_InsertGap(ddesp, 7, 1648, TRUE);
3116 DDE_InsertGap(ddesp, 7, 1647, TRUE);
3117 DDE_InsertGap(ddesp, 7, 1647, TRUE);
3118 DDE_RemoveGap(ddesp, 7, 1647, TRUE);
3119 DDE_InsertGap(ddesp, 7, 0, TRUE);
3120 DDE_RemoveGap(ddesp, 7, 1648, TRUE);
3121 DDE_InsertGap(ddesp, 7, 1649, TRUE);
3122 DDE_RemoveGap(ddesp, 7, 1649, TRUE);
3123 PassCount = 14;
3124 }
3125
3126 if (PassCount == 15) {
3127 DDE_HideRow(ddesp, 3, TRUE);
3128 DDE_HideRow(ddesp, 3, TRUE);
3129 DDE_HideRow(ddesp, 4, TRUE);
3130 DDE_HideRow(ddesp, 0, TRUE);
3131 DDE_HideRow(ddesp, 7, TRUE);
3132 }
3133
3134 if (PassCount == 16) {
3135 DDE_ShowRow(ddesp, 2, TRUE);
3136 DDE_ShowRow(ddesp, 3, TRUE);
3137 DDE_ShowRow(ddesp, 0, TRUE);
3138 DDE_ShowRow(ddesp, 4, TRUE);
3139 DDE_ShowRow(ddesp, 7, TRUE);
3140 }
3141
3142 if (PassCount == 17) {
3143 DDE_MoveRow(ddesp, 5, 2, TRUE);
3144 }
3145
3146 if (PassCount == 18) {
3147 DDE_HideRow(ddesp, 3, TRUE);
3148 DDE_HideRow(ddesp, 4, TRUE);
3149 DDE_HideRow(ddesp, 0, TRUE);
3150 DDE_HideRow(ddesp, 7, TRUE);
3151 DDE_HideRow(ddesp, 2, TRUE);
3152 DDE_HideRow(ddesp, 1, TRUE);
3153 DDE_HideRow(ddesp, 6, TRUE);
3154 DDE_HideRow(ddesp, 5, TRUE);
3155 DDE_HideRow(ddesp, 4, TRUE);
3156 PassCount = 19;
3157 }
3158
3159 if (PassCount == 20) {
3160 DDE_ShowRow(ddesp, 7, TRUE);
3161 DDE_ShowRow(ddesp, 0, TRUE);
3162 DDE_ShowRow(ddesp, 4, TRUE);
3163 DDE_ShowRow(ddesp, 3, TRUE);
3164 DDE_ShowRow(ddesp, 1, TRUE);
3165 DDE_ShowRow(ddesp, 5, TRUE);
3166 DDE_ShowRow(ddesp, 6, TRUE);
3167 DDE_ShowRow(ddesp, 2, TRUE);
3168 PassCount = 27;
3169 }
3170
3171 if (PassCount == 28) {
3172 DDE_MoveRow(ddesp, 3, 3, TRUE);
3173 DDE_MoveRow(ddesp, 2, 5, TRUE);
3174 DDE_MoveRow(ddesp, 0, 6, TRUE);
3175 DDE_MoveRow(ddesp, 7, 1, TRUE);
3176 DDE_MoveRow(ddesp, 7, 0, TRUE);
3177 DDE_MoveRow(ddesp, 0, 7, TRUE);
3178 PassCount = 33;
3179 }
3180
3181 if (PassCount == 34) {
3182 DDE_HideRow(ddesp, 6, TRUE);
3183 DDE_HideRow(ddesp, 1, TRUE);
3184 DDE_HideRow(ddesp, 0, TRUE);
3185 DDE_HideRow(ddesp, 7, TRUE);
3186 PassCount = 37;
3187 }
3188
3189 if (PassCount == 38) {
3190 DDE_MoveRow(ddesp, 3, 1, TRUE);
3191 DDE_MoveRow(ddesp, 0, 2, TRUE);
3192 DDE_MoveRow(ddesp, 0, 3, TRUE);
3193 DDE_MoveRow(ddesp, 3, 0, TRUE);
3194 PassCount = 41;
3195 }
3196
3197 if (PassCount == 42) {
3198 DDE_ShowRow(ddesp, 1, TRUE);
3199 DDE_ShowRow(ddesp, 7, TRUE);
3200 DDE_ShowRow(ddesp, 6, TRUE);
3201 DDE_ShowRow(ddesp, 0, TRUE);
3202 PassCount = 45;
3203 }
3204
3205 if (PassCount == 46) {
3206 DDE_HideNewRow(ddesp, 5, TRUE);
3207 DDE_HideNewRow(ddesp, 2, TRUE);
3208 DDE_HideNewRow(ddesp, 4, TRUE);
3209 DDE_HideNewRow(ddesp, 3, TRUE);
3210 PassCount = 49;
3211 }
3212
3213 if (PassCount == 50) {
3214 DDE_ShowNewRow(ddesp, 2, TRUE);
3215 DDE_ShowNewRow(ddesp, 3, TRUE);
3216 DDE_ShowNewRow(ddesp, 5, TRUE);
3217 DDE_ShowNewRow(ddesp, 4, TRUE);
3218 PassCount = 53;
3219 }
3220
3221 if (PassCount == 54) {
3222 DDE_HideRow(ddesp, 4, TRUE);
3223 DDE_HideRow(ddesp, 7, TRUE);
3224 DDE_HideRow(ddesp, 0, TRUE);
3225 DDE_RestoreRowOrder(ddesp, TRUE);
3226 DDE_ShowRow(ddesp, 7, TRUE);
3227 DDE_ShowRow(ddesp, 0, TRUE);
3228 DDE_ShowRow(ddesp, 4, TRUE);
3229 }
3230
3231 if (PassCount == 55) {
3232 DDE_ShiftRightBoundary(ddesp, 0, -1640, TRUE);
3233 DDE_DeleteBlock(ddesp, 0, TRUE);
3234 PassCount = 64;
3235 }
3236
3237 if (PassCount == 65) {
3238 DDE_CreateBlock(ddesp, 20, 30, TRUE);
3239 DDE_CreateBlock(ddesp, 15, 35, TRUE);
3240 DDE_CreateBlock(ddesp, 25, 40, TRUE);
3241 DDE_CreateBlock(ddesp, 15, 40, TRUE);
3242 }
3243
3244 MemCopy(&(dmp->MSA_d.pgp_l), ddesp->pEdit->pPopList, sizeof(MsaParaGPopList));
3245
3246 DDV_InitColour_When_Start(dmp->MSA_d.pgp_l.sap,
3247 &(dmp->MSA_d.pgp_l),&(dmp->Globals.colorp), FALSE);
3248
3249 /* recalculate window size */
3250 DDV_WhatSize(dmp);
3251 /* adjust horizontal scroll bar */
3252 hsb = GetSlateHScrollBar((SlatE) dmp->hWndDDV);
3253 DDV_UpdateHScrollVal(dmp->hWndDDV, FALSE, GetBarValue(hsb));
3254
3255 PassCount++;
3256
3257 temport=SavePort(mWin_d->hWndDDV);
3258 Select(mWin_d->hWndDDV);
3259 ObjectRect(mWin_d->hWndDDV, &rcP);
3260 InvalRect(&rcP);
3261 Update();
3262 RestorePort(temport);
3263 return;
3264 }
3265
3266 static void DDV_MoveRowLeft(IteM i)
3267 {
3268 DDV_DoEditFunction(i, MOVE_ROW_LEFT);
3269 return;
3270 }
3271
3272 static void DDV_MoveRowRight(IteM i)
3273 {
3274 DDV_DoEditFunction(i, MOVE_ROW_RIGHT);
3275 return;
3276 }
3277
3278 static void DDV_MoveLeftBoundaryLeft(IteM i)
3279 {
3280 DDV_DoEditFunction(i, MOVE_LEFT_BOUNDARY_LEFT);
3281 return;
3282 }
3283
3284 static void DDV_MoveLeftBoundaryRight(IteM i)
3285 {
3286 DDV_DoEditFunction(i, MOVE_LEFT_BOUNDARY_RIGHT);
3287 return;
3288 }
3289
3290 static void DDV_MoveRightBoundaryLeft(IteM i)
3291 {
3292 DDV_DoEditFunction(i, MOVE_RIGHT_BOUNDARY_LEFT);
3293 return;
3294 }
3295
3296 static void DDV_MoveRightBoundaryRight(IteM i)
3297 {
3298 DDV_DoEditFunction(i, MOVE_RIGHT_BOUNDARY_RIGHT);
3299 return;
3300 }
3301
3302 static void DDV_DeleteBlock(IteM i)
3303 {
3304 DDV_DoEditFunction(i, DDE_DELETE_BLOCK);
3305 return;
3306 }
3307
3308 static void DDV_CreateBlock(IteM i)
3309 {
3310 DDV_DoEditFunction(i, DDE_CREATE_BLOCK);
3311 return;
3312 }
3313
3314 static void DDV_Prev(IteM i)
3315 {
3316 DDV_DoEditFunction(i, DDE_PREV);
3317 return;
3318 }
3319
3320 static void DDV_Next(IteM i)
3321 {
3322 DDV_DoEditFunction(i, DDE_NEXT);
3323 return;
3324 }
3325
3326 static void DDV_Orig(IteM i)
3327 {
3328 DDV_DoEditFunction(i, DDE_ORIG);
3329 return;
3330 }
3331
3332 static void DDV_LaunchEditor(IteM i)
3333 {
3334 DDV_DoEditFunction(i, DDE_LAUNCH_EDITOR);
3335 return;
3336 }
3337
3338 static void DDV_MergeBlocks(IteM i)
3339 {
3340 DDV_DoEditFunction(i, DDE_MERGE_BLOCKS);
3341 return;
3342 }
3343
3344 static void DDV_SplitBlock(IteM i)
3345 {
3346 DDV_DoEditFunction(i, DDE_SPLIT_BLOCK);
3347 return;
3348 }
3349
3350 static void DDV_DeleteBlock2(IteM i)
3351 {
3352 DDV_DoEditFunction(i, DDV_DELETE_BLOCK);
3353 return;
3354 }
3355
3356
3357 static void DDV_CallSaveEdits(IteM i) {
3358 /*----------------------------------------------------------------------------
3359 * get DDVMainPtr and call DDV_SaveEdits
3360 *---------------------------------------------------------------------------*/
3361 WindoW hWinMain;
3362 DdvMainWinPtr mWin_d;
3363 DdvMainPtr dmp;
3364
3365 hWinMain=(WindoW)ParentWindow(i);
3366 if (hWinMain==NULL) return;
3367 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
3368 if (mWin_d==NULL) return;
3369 if (mWin_d->hWndDDV==NULL) return;
3370 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
3371 if (dmp==NULL) return;
3372
3373 DDV_SaveEdits(dmp, TRUE);
3374 }
3375
3376
3377 static void write_annot(SeqAlignPtr align)
3378 {
3379 SeqAnnotPtr annot;
3380 AsnIoPtr aip;
3381
3382 annot = SeqAnnotNew();
3383 annot->type = 2;
3384 annot->data = align;
3385
3386 aip = AsnIoOpen("temp2.sat", "w");
3387 SeqAnnotAsnWrite(annot, aip, NULL);
3388 AsnIoClose(aip);
3389
3390 annot->data = NULL;
3391 SeqAnnotFree(annot);
3392 }
3393
3394
3395 NLM_EXTERN void DDV_SaveEdits(DdvMainPtr dmp, Boolean UpdateDDV) {
3396 /*----------------------------------------------------------------------------
3397 * create a DenseSeg for the block that has been created or edited.
3398 * pass this info to the AlnMgr and tell it to add or replace the block.
3399 *---------------------------------------------------------------------------*/
3400 Int4* pStarts;
3401 Int4* pLens;
3402 Uint1* pStrands;
3403 Int4 ii, jj, NumSegs, NumRows, NumBlocksAtLastSave, NumBlocksNow;
3404 DenseSegPtr dsp;
3405 SeqAlignPtr sap, indexed_sap;
3406 SeqId head;
3407 SeqIdPtr sip_prev, sip;
3408 DDVUpdateMSG dum;
3409 MsaParaGPopListPtr mpplp;
3410 Boolean ReDraw;
3411 BaR hsb;
3412 Int4 HPos, Col, i;
3413
3414 /* note: dsp is DenseSegPtr */
3415 /* dmp->dsp is DDE_StackPtr */
3416
3417 NumRows = dmp->dsp->pEdit->TotalNumRows;
3418 NumSegs = DDE_GetNumSegmentsInBlock(dmp->dsp->pEdit, 0);
3419 sap = ViewMgr_GetBegin(dmp->MSA_d.pgp_l.viewed_sap);
3420 indexed_sap = ViewMgr_GetBeginIndexed(dmp->MSA_d.pgp_l.viewed_sap);
3421
3422 /* if there's a block that gets added or replaced, create a DenseSeg */
3423 if (NumSegs > 0) {
3424 /* create the empty dense seg, do NOT free it in this routine */
3425 dsp = DenseSegNew();
3426 dsp->dim = dmp->dsp->pEdit->TotalNumRows;
3427 dsp->numseg = NumSegs;
3428 /* create the starts, lens, and strands arrays */
3429 pStarts = MemNew(NumRows * NumSegs * sizeof(Int4));
3430 pLens = MemNew(NumSegs * sizeof(Int4));
3431 pStrands = MemNew(NumRows * NumSegs * sizeof(Uint1));
3432 DDE_CreateArraysForDenseSeg(dmp->dsp->pEdit, 0, pStarts, pLens); /* fill starts and lens */
3433 for (ii=0; ii<NumSegs; ii++) {
3434 for (jj=0; jj<NumRows; jj++) {
3435 pStrands[ii*NumRows + jj] = AlnMgrGetNthStrand(sap, jj+1); /* fill strands */
3436 }
3437 }
3438 dsp->starts = pStarts;
3439 dsp->lens = pLens;
3440 dsp->strands = pStrands;
3441 /* create the linked-list of SeqIdPtr's */
3442 sip_prev = &head;
3443 for (ii=0; ii<NumRows; ii++) {
3444 sip = AlnMgrGetNthSeqIdPtr(indexed_sap, ii+1);
3445 sip_prev->next = sip;
3446 sip_prev = sip_prev->next;
3447 }
3448 dsp->ids = head.next;
3449 }
3450
3451 if (NumSegs > 0) {NumBlocksNow = 1;}
3452 else {NumBlocksNow = 0;}
3453
3454 NumBlocksAtLastSave = dmp->dsp->NumBlocks;
3455
3456 ReDraw = FALSE;
3457 if ((NumBlocksAtLastSave==1) && (NumBlocksNow==0)) {
3458 /* delete block */
3459 AlnMgrReplaceBlock(indexed_sap, NULL, dmp->dsp->LaunchBlock+1);
3460 }
3461 if ((NumBlocksAtLastSave==1) && (NumBlocksNow==1)) {
3462 /* replace block */
3463 AlnMgrReplaceBlock(indexed_sap, dsp, dmp->dsp->LaunchBlock+1);
3464 ReDraw = TRUE;
3465 }
3466 if ((NumBlocksAtLastSave==0) && (NumBlocksNow==1)) {
3467 /* add block */
3468 AlnMgrAddBlock(indexed_sap, dsp);
3469 dmp->dsp->IsUnAligned = FALSE;
3470 ReDraw = TRUE;
3471 }
3472
3473 SeqAlignListFree(sap);
3474 sap = AlnMgrGetSubAlign(indexed_sap, NULL, 0, -1);
3475
3476 ViewMgr_SetBegin(dmp->MSA_d.pgp_l.viewed_sap, sap, FALSE, FALSE);
3477 /* indicate there are no edits to save when quitting DDE */
3478 dmp->dsp->SomethingToSave = FALSE;
3479
3480 dmp->dsp->NumBlocks = NumBlocksNow;
3481
3482 /* redraw the display when 2 aligned blocks are merged */
3483 /* if merging with preceeding block, launch block is decremented */
3484 /* (there's no need to redraw when the first block is left aligned */
3485 /* or when the last block is right aligned. however, since I have */
3486 /* no way of knowing how many blocks there are, a right aligned last */
3487 /* block always causes a redraw) */
3488
3489 /* update: we decided not to do auto merge. so, I'm setting */
3490 /* ReDraw to FALSE here. no redraw. no modifying block index. */
3491 /* if we go back to auto-merge, just get rid of this one line. */
3492 ReDraw = FALSE;
3493
3494 if (ReDraw) {
3495 if (DDE_FirstColumnIsAligned(dmp->dsp->pEdit)) {
3496 if (dmp->dsp->LaunchBlock == 0) {
3497 ReDraw = FALSE;
3498 }
3499 else {
3500 dmp->dsp->LaunchBlock--;
3501 }
3502 }
3503 else if (!DDE_LastColumnIsAligned(dmp->dsp->pEdit)) {
3504 ReDraw = FALSE;
3505 }
3506 }
3507
3508 if (ReDraw) {
3509 mpplp = DDE_CreateDisplay(indexed_sap, dmp->dsp->LaunchBlock,
3510 dmp->dsp->IsUnAligned, &dmp->dsp->NumBlocks);
3511 mpplp->viewed_sap = dmp->dsp->pEdit->pPopList->viewed_sap;
3512 dmp->dsp->pEdit = DDE_New(mpplp, dmp->dsp->pEdit->TotalNumRows);
3513 DDE_MergeNodesLists(dmp->dsp->pEdit);
3514 /* hide the rows in DDE that are hidden in DDV */
3515 NumRows = dmp->dsp->pEdit->TotalNumRows;
3516 for (i=0; i<NumRows; i++) {
3517 if (ViewMgr_TRow2VRow(dmp->MSA_d.pgp_l.viewed_sap, i+1) == -1) {
3518 DDE_HideRow(dmp->dsp, i, FALSE);
3519 }
3520 }
3521 DDE_Add(dmp->dsp);
3522 dmp->dsp->SomethingToSave = FALSE;
3523 /* position block at 5th col */
3524 hsb = GetSlateHScrollBar((SlatE) dmp->hWndDDV);
3525 HPos = GetBarValue(hsb);
3526 Col = DDE_GetAlignStart(dmp->dsp->pEdit, 0);
3527 DDV_ReDrawAtCol(dmp, HPos+Col-5, TRUE);
3528 }
3529
3530 /* tell DDV to rebuild its display */
3531 if (UpdateDDV) {
3532 dum.type = UPDATE_TYPE_VIEWMGR;
3533 dum.data = NULL;
3534 ViewMgr_Update(dmp->MSA_d.pgp_l.viewed_sap);
3535 ObjMgrSendProcMsg(OM_MSG_UPDATE, dmp->MSA_d.entityID, dmp->MSA_d.itemID,
3536 OBJ_SEQALIGN, 0, 0, (Pointer)&dum);
3537 }
3538
3539 return;
3540 }
3541
3542 /*******************************************************************************
3543
3544 Function : DDV_DoEditFunction(Item i, Int4 WhichOne)
3545
3546 Purpose : UI to do one of the edit functions
3547
3548 Return value : none
3549
3550 *******************************************************************************/
3551 static void DDV_DoEditFunction(IteM i, Int4 WhichOne)
3552 {
3553 DdvMainWinPtr mWin_d;
3554 DdvMainPtr dmp;
3555 WindoW hWinMain;
3556 DDE_StackPtr ddesp;
3557
3558 /*get some data*/
3559 hWinMain=(WindoW)ParentWindow(i);
3560 if (hWinMain==NULL) return;
3561 mWin_d = (DdvMainWinPtr) GetObjectExtra (hWinMain);
3562 if (mWin_d==NULL) return;
3563 if (mWin_d->hWndDDV==NULL) return;
3564 dmp = (DdvMainPtr) GetObjectExtra(mWin_d->hWndDDV);
3565 if (dmp==NULL) return;
3566
3567 ddesp = dmp->dsp;
3568
3569 switch (WhichOne) {
3570 case MOVE_ROW_LEFT:
3571 DDE_ShiftRow(ddesp, 4, -1, TRUE, TRUE);
3572 DDV_ReDraw(dmp);
3573 break;
3574 case MOVE_ROW_RIGHT:
3575 DDE_ShiftRow(ddesp, 4, 1, TRUE, TRUE);
3576 DDV_ReDraw(dmp);
3577 break;
3578 case MOVE_LEFT_BOUNDARY_LEFT:
3579 DDE_ShiftLeftBoundary(ddesp, 0, -1, TRUE);
3580 DDV_ReDraw(dmp);
3581 break;
3582 case MOVE_LEFT_BOUNDARY_RIGHT:
3583 DDE_ShiftLeftBoundary(ddesp, 0, 1, TRUE);
3584 DDV_ReDraw(dmp);
3585 break;
3586 case MOVE_RIGHT_BOUNDARY_LEFT:
3587 DDE_ShiftRightBoundary(ddesp, 0, -1, TRUE);
3588 DDV_ReDraw(dmp);
3589 break;
3590 case MOVE_RIGHT_BOUNDARY_RIGHT:
3591 DDE_ShiftRightBoundary(ddesp, 0, 1, TRUE);
3592 DDV_ReDraw(dmp);
3593 break;
3594 case DDE_DELETE_BLOCK:
3595 if (DDE_DeleteBlock(ddesp, 0, TRUE)) {
3596 DDV_ReDraw(dmp);
3597 }
3598 break;
3599 case DDE_CREATE_BLOCK:
3600 /* switch to the mode that allows block creation */
3601 dmp->SavedMouseMode = dmp->MouseMode;
3602 dmp->MouseMode = DDV_MOUSEMODE_CREATEBLOCK;
3603 CrossCursor();
3604 break;
3605 case DDE_PREV:
3606 if (DDE_Prev(ddesp)) {
3607 DDV_ReDraw(dmp);
3608 }
3609 break;
3610 case DDE_NEXT:
3611 if (DDE_Next(ddesp)){
3612 DDV_ReDraw(dmp);
3613 }
3614 break;
3615 case DDE_ORIG:
3616 DDE_GetOriginal(ddesp, TRUE);
3617 DDV_ReDraw(dmp);
3618 break;
3619 case DDE_LAUNCH_EDITOR:
3620 dmp->SavedMouseMode = dmp->MouseMode;
3621 dmp->MouseMode = DDV_MOUSEMODE_LAUNCHEDITOR;
3622 CrossCursor();
3623 break;
3624 case DDE_MERGE_BLOCKS:
3625 dmp->SavedMouseMode = dmp->MouseMode;
3626 dmp->MouseMode = DDV_MOUSEMODE_MERGEBLOCKS1;
3627 CrossCursor();
3628 break;
3629 case DDE_SPLIT_BLOCK:
3630 dmp->SavedMouseMode = dmp->MouseMode;
3631 dmp->MouseMode = DDV_MOUSEMODE_SPLITBLOCK;
3632 CrossCursor();
3633 break;
3634 case DDV_DELETE_BLOCK:
3635 dmp->SavedMouseMode = dmp->MouseMode;
3636 dmp->MouseMode = DDV_MOUSEMODE_DELETEBLOCK;
3637 CrossCursor();
3638 break;
3639 }
3640 if (dmp->bEditor) {
3641 DDV_GreyOut(mWin_d, DDE_AtStartOfStack(dmp->dsp), DDE_AtEndOfStack(dmp->dsp));
3642 }
3643 return;
3644 }
3645
3646
3647 NLM_EXTERN void DDVResetProc (PaneL p)
3648
3649 {
3650 }
3651
3652 static void PopulateDDV (BioseqViewPtr bvp)
3653
3654 {
3655 }
3656
3657 static void ShowDDV (BioseqViewPtr bvp, Boolean show)
3658
3659 {
3660 }
3661
3662 static void SelectDDV (BioseqViewPtr bvp, Uint2 selentityID, Uint4 selitemID,
3663 Uint2 selitemtype, SeqLocPtr region,
3664 Boolean select, Boolean scrollto)
3665
3666 {
3667 }
3668
3669 static void ResizeDDV (BioseqViewPtr bvp)
3670
3671 {
3672 }
3673
3674 BioseqPageData ddvPageData = {
3675 "Multiple", TRUE, TRUE, TRUE, FALSE, -1,
3676 PopulateDDV, ShowDDV, SelectDDV,
3677 NULL, NULL,
3678 NULL, NULL, ResizeDDV, NULL
3679 };
3680
3681 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |