1 /*   undviewer.h
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:  undviewer.h
27 *
28 * Author:  Patrick Durand
29 *
30 * Version Creation Date:   5/3/99
31 *
32 * $Revision: 6.58 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * $Log: udviewer.h,v $
39 * Revision 6.58  2006/07/13 17:13:18  bollin
40 * use Uint4 instead of Uint2 for itemID values
41 *
42 * Revision 6.57  2000/07/12 15:38:08  hurwitz
43 * made rectangle select much faster.  it's almost working.
44 *
45 * Revision 6.56  2000/07/08 20:44:01  vakatov
46 * Get all "#include" out of the 'extern "C" { }' scope;  other cleanup...
47 *
48 * Revision 6.55  2000/06/27 20:46:38  hurwitz
49 * fixed bugs with select rectangle, added select row option
50 *
51 * Revision 6.54  2000/06/26 19:32:17  hurwitz
52 * can select a rectangle instead of a single row, auto horizontal scroll works but not vertical scroll yet
53 *
54 * Revision 6.53  2000/06/16 14:57:02  lewisg
55 * move entrez calls out of desktop
56 *
57 * Revision 6.52  2000/05/19 13:48:31  hurwitz
58 * made a version of DDE that doesn't allow aligned gaps, changed wording for adding new rows
59 *
60 * Revision 6.51  2000/05/15 23:39:34  lewisg
61 * shred cblast, add menu items for gapped/ungapped, fix pdbheaders
62 *
63 * Revision 6.50  2000/04/28 13:51:20  kans
64 * db_list is a PopuP, not a scrolling LisT
65 *
66 * Revision 6.49  2000/04/27 22:21:58  lewisg
67 * misc bugs/features
68 *
69 * Revision 6.48  2000/04/27 19:47:31  kans
70 * implemented udv reset and select (PD+JK)
71 *
72 * Revision 6.47  2000/04/13 13:58:03  durand
73 * allowed udv to display reverse complement sequence
74 *
75 * Revision 6.46  2000/04/11 13:19:26  durand
76 * added UDV_LoadSpecificEditor for Sequin
77 *
78 * Revision 6.45  2000/04/10 21:41:26  lewisg
79 * move alignment menus into ddv, udv from cn3d
80 *
81 * Revision 6.44  2000/04/10 20:33:40  lewisg
82 * fix show/hide for blast multiple, make blast multiple API generic
83 *
84 * Revision 6.43  2000/04/05 21:13:20  kans
85 * more changes to allow udv panel to be added to Sequin viewer
86 *
87 * Revision 6.42  2000/04/05 20:52:36  hurwitz
88 * added GUI control for shifting left and right alignment boundaries
89 *
90 * Revision 6.41  2000/04/03 22:26:32  hurwitz
91 * can now shift a row with click and drag
92 *
93 * Revision 6.40  2000/03/31 13:51:21  durand
94 * added UDV_InitForSequin()
95 *
96 * Revision 6.39  2000/03/30 19:54:09  kans
97 * initial work to get UDV and DDV into Sequin viewer
98 *
99 * Revision 6.38  2000/03/28 21:03:14  hurwitz
100 * added gui control to re-order rows
101 *
102 * Revision 6.37  2000/03/15 19:32:20  lewisg
103 * launch only single udv window
104 *
105 * Revision 6.36  2000/03/06 14:00:47  durand
106 * first release of the Summary viewer done
107 *
108 * Revision 6.35  2000/03/02 15:41:46  lewisg
109 * move StartNetworkProc typedef to samutil.h
110 *
111 * Revision 6.34  2000/03/01 22:49:41  lewisg
112 * import bioseq, neatlyindex, get rid of dead code
113 *
114 * Revision 6.33  2000/02/16 22:38:30  durand
115 * fixed some wierd behaviours of features selections
116 *
117 * Revision 6.32  2000/02/16 16:00:33  durand
118 * added UDVprocid and GVprocid to vmp data structure
119 *
120 * Revision 6.31  2000/02/15 22:40:58  lewisg
121 * add ability to launch udv so that it colors by row, fixes to colormgr, track rows from viewmgr, fix visual c projects
122 *
123 * Revision 6.30  2000/01/11 15:03:18  durand
124 * remove network stuff
125 *
126 * Revision 6.29  2000/01/10 15:18:40  durand
127 * use Entrez instead of ID1
128 *
129 * Revision 6.28  2000/01/05 21:06:38  durand
130 * update mouse click actions and DrawSequence function for a better use from ddv and cn3d
131 *
132 * Revision 6.27  2000/01/03 21:06:38  durand
133 * update the way the udv main window is created
134 *
135 * Revision 6.26  1999/12/03 23:17:23  lewisg
136 * Patrick's new global update msg, argument passing when launching ddv, experimental editing
137 *
138 * Revision 6.25  1999/11/29 15:17:55  durand
139 * designed a new GUI; fixed problems under Win95 and Linux
140 *
141 * Revision 6.24  1999/11/19 15:01:47  durand
142 * speed up mouse selection ; avoid sequence flashing during selection ; update menu functionalities
143 *
144 * Revision 6.23  1999/11/18 14:54:23  durand
145 * add a new function to create an image map given a ParaG structure - Entrez sequence viewer only
146 *
147 * Revision 6.22  1999/11/09 21:06:58  durand
148 * add sequence selection manager
149 *
150 * Revision 6.21  1999/10/21 13:00:33  durand
151 * add new fields in UDV_mouse_select struct
152 *
153 * Revision 6.20  1999/10/20 20:07:44  durand
154 * add first_row and first_col to UDV_mouse_select
155 *
156 * Revision 6.19  1999/10/02 15:11:16  durand
157 * update the code to be used by wwwudv
158 *
159 * Revision 6.18  1999/09/29 20:09:51  durand
160 * modify some parts of the code to be used by the cgi-bin release of UDV
161 *
162 * Revision 6.17  1999/09/22 14:26:50  durand
163 * add fields for DDV mouse management
164 *
165 * Revision 6.16  1999/09/20 21:57:41  durand
166 * switch UDV_draw_double_cursor from static to NLM_EXTERN
167 *
168 * Revision 6.15  1999/09/08 15:36:58  beloslyu
169 * Typo fixed
170 *
171 * Revision 6.14  1999/09/08 14:09:32  durand
172 * update UDV_Draw_scale to deal with discontinuous SEqAlign
173 *
174 * Revision 6.13  1999/07/30 20:08:56  durand
175 * updates for the new Entrez graphical viewer
176 *
177 * Revision 6.12  1999/07/19 20:35:36  durand
178 * switch ScalePositionfrom from Boolean to Uint1 in UDV_Draw_scale
179 *
180 * Revision 6.11  1999/07/09 13:56:56  durand
181 * removed all the defines to udvdef.h
182 *
183 * Revision 6.10  1999/07/06 17:02:59  durand
184 * add UDVPanelRegion structure for DDV
185 *
186 * Revision 6.9  1999/06/16 22:11:24  durand
187 * update UDV functions to be used by DDV
188 *
189 * Revision 6.8  1999/06/16 13:07:00  durand
190 * update UDV functions to be used by DDV
191 *
192 * Revision 6.7  1999/06/15 15:25:53  durand
193 * remove DDV_win in UDVPanelData structure
194 *
195 * Revision 6.6  1999/06/08 13:52:36  durand
196 * update UDV data structures for the MSA editor
197 * ==========================================================================
198 */
199 
200 #ifndef _UNDVIEWER_
201 #define _UNDVIEWER_
202 
203 
204 /*******************************************************************************
205 
206   INCLUDE SECTION
207 
208 *******************************************************************************/
209 #include <explore.h>
210 #include <gather.h>
211 #include <ncbi.h>
212 #include <ncbistr.h>
213 #include <objfdef.h>
214 #include <objseq.h>
215 #include <objsub.h>
216 #include <seqmgr.h>
217 #include <seqport.h>
218 #include <sequtil.h>
219 #include <sqnutils.h>
220 #include <vibrant.h>
221 #include <bspview.h>
222 
223 #include <odlbox.h>
224 #include <udvseq.h>
225 #include <udvdef.h>
226 
227 #include <ddvcolor.h>
228 #include <samutil.h>
229 
230 
231 #undef NLM_EXTERN
232 #ifdef NLM_IMPORT
233 #define NLM_EXTERN NLM_IMPORT
234 #else
235 #define NLM_EXTERN extern
236 #endif
237 
238 #ifdef __cplusplus
239 extern "C" {
240 #endif
241 
242 /*******************************************************************************
243 
244   The major elements of the single sequence viewer : window and paragraph
245 
246 *******************************************************************************/
247 
248 	/*****************************************************************************
249 
250 	Structure of the UnDViewer area
251 
252 	-Panel--------------------------------------------------    -
253 	|         |             |                              |    |
254 	| Name    | Scale area  |                              |    |
255 	| area    | (if left    |    Sequence area             |    |
256 	|         |  scale)     |    (paragraph)               |    cyClient
257 	|         |             |                              |    |
258 	|         |             |                              |    |
259 	--------------------------------------------------------    -
260 	<-cxName->
261         	  <-cxLeftScale->
262 	<-------------------------cxClient--------------------->
263 
264 	*****************************************************************************/
265 
266 	/*****************************************************************************
267 
268 	Structure of a ParaG : see module udvseq.h
269 
270 	*****************************************************************************/
271 
272 
273 /*******************************************************************************
274 
275   DATA STRUCTURE SECTION
276 
277 *******************************************************************************/
278 	typedef struct udvscaledata {
279 		Uint4 ScaleColor;	/*letter color*/
280 		Uint4 TickMajColor;	/*tick color*/
281 		Uint4 TickMinColor;	/*tick color*/
282 		Boolean ShowMajorTick;	/*display tick marks if TRUE*/
283 		Boolean ShowMMinorTick;	/*display tick marks if TRUE*/
284 		Int2 ScalePosition;	/*position of the scale, see #define above*/
285 		Int2 cxLeftScale;	/*width of the 'SCALE_POS_LEFT' area, pixel unit
286 							NULL if ScalePosition== _TOP or if ShowScale==FALSE*/
287 		Int2 MajorTickEvery;	/*put a major tick every*/
288 		Int2 MinorTickEvery;	/*put a minor tick every*/
289 		} UDVScaleData, PNTR UDVScaleDataPtr;
290 
291 	typedef struct udvletterlayout {
292 		Uint4 LetClr;		/*color of a letter*/
293 		Uint4 bkClr;		/*bk color of a letter*/
294 		Uint1 AspLet;		/*aspect (uppercase,...)*/
295 		} UDVLetterLayout, PNTR UDVLetterLayoutPtr;
296 
297 	typedef struct udvfontdata {
298 		FonT hFnt;			/*Current Font*/
299 		Boolean UseDefaultColorLetter; /*if true, use the following color for
300 							letter (NA or AA); draft mode*/
301 		Uint4 LetterColor;
302 		Int2 cxChar;		/*width of a char, pixel unit*/
303 		Int2 cyChar;		/*height of a char, pixel unit*/
304 		Int2 LineHeight;	/*height of a single data line*/
305 		Int2 ColWidth;/*width of a single data column-MSA only*/
306 		} UDVFontData, PNTR UDVFontDataPtr;
307 
308 	/*the following structure was added for DDV. It's here (and not in the
309 	code of DDV), because that struct is part of UDVPanelData*/
310 	typedef struct udvpanelregion{/*descriptor of panel regions : ruler,
311 									names list, ParaG region, etc.*/
312 		RecT  region;/*size of the region*/
313 		Uint1 type;  /*type of the region; see above*/
314 		} UDVPanelRegion, PNTR UDVPanelRegionPtr;
315 
316 	typedef struct udvpaneldata {
317 		ValNodePtr region;/*descriptor of the panel content; each
318 						region->data.ptrvalue contains a pointer to UDVPanelRegion*/
319 		Int4 nTotLines;		/*total number of line to display*/
320 		Int4 nTotCol;/*total number of column to display-MSA only*/
321 		/*Display options*/
322 		Boolean ShowFeatures; /*TRUE: show features*/
323 		Boolean ShowScale;	/*TRUE: show num. scale*/
324 		Boolean ShowByBlock;/*TRUE: use nBlockByLine -MSA only*/
325 		/*panel size*/
326 		Int2 cxClient;		/*width of the client panel area, pixel unit*/
327 		Int2 cyClient;		/*height of the client panel area, pixel unit*/
328 		Int2 cxName;		/*width of the 'Name' area, pixel unit*/
329 		Int2 cyScale;		/*height of the 'Sacle' area, pixel unit (MSA only)*/
330 
331 		/*Letter lines*/
332 		Int2 nCharByLine;	/*number of letter displayed on one line of the viewer*/
333 		Int2 nBlockByLine;	/*number Ten-letter blocks displayed on one line of
334 							the viewer*/
335 		} UDVPanelData, PNTR UDVPanelDataPtr;
336 
337 	typedef struct udvscrolldata {
338 		/*Scroll Bar*/
339 		Int4 ScrollMax;		/*Size of the vertical Scroll Bar*/
340 							/*also equal number of data lines displayed within
341 							UnDViewer*/
342 		Int4 ScrollPos;		/*Current position within the vertical Scroll Bar*/
343 		Int4 ScrollPage;	/*Page decal of the vertical Scroll Bar*/
344 		} UDVScrollData, PNTR UDVScrollDataPtr;
345 
346 	typedef struct undviewergraphdata {
347 		UDVFontData 	udv_font;	/*Font*/
348 		UDVPanelData 	udv_panel;	/*Panel*/
349 		UDVScaleData	udv_scale;	/*Numerical scale*/
350 		UDVScrollData	udv_vscrl;	/*vertical Scroll Bar*/
351 		UDVScrollData	udv_hscrl;	/*horizontal Scroll Bar-MSA only*/
352 		Uint4Ptr 		pClr;		/*Color table for Features*/
353 		Uint4			DisplayOptions;/*bits vector to encode display options*/
354 		UDVLetterLayout NA_LayoutPal[5];
355 		UDVLetterLayout AA_LayoutPal[26];
356 		Int4            GotoLetter;/*letter to highlight after a GoTo action; one-based value*/
357 		} UnDViewerGraphData, PNTR UnDViewerGraphDataPtr;
358 
359 	typedef struct udv_item_select {
360 		Uint2		eIDsel;			/*-|               */
361 		Uint2		iIDsel;			/* |--selected item*/
362 		Uint2		iTypeSel;		/*-|               */
363 		} UDV_Item_Select, PNTR UDV_Item_SelectPtr;
364 
365   typedef struct udv_mouse_select {
366     Int1      Action_type;      /*action with the mouse*/
367     RecT      rcClip;           /*limit mvt of the mouse to this rc*/
368     PoinT     oldPos;           /*old pos of the mouse*/
369     PoinT     newPos;           /*new pos of the mouse*/
370     ParaGPtr	pgp;              /*current ParaG data*/
371     Char      szPos[20];        /*current position within the bsp*/
372     Int4      old_row;          /*used by DDV only (display coords);
373 							                    set when 'on_click' and every 'on_drag'*/
374     Int4      old_col;          /*
375                                   set when 'on_click' and every 'on_drag'*/
376     ParaGPtr    old_pgp;        /*pgp where old_col was located*/
377     Int4        first_row;      /*set only when 'on_click'*/
378     Int4        first_col;      /*set only when 'on_click'*/
379     Int4        last_row;       /*save corner of rectangle*/
380     Int4        last_col;       /*save corner of rectangle*/
381     Int4*       first_cols;     /*array for multiple rows*/
382     ParaGPtr    first_pgp;      /*pgp where first_col was located*/
383     ParaGPtr*   first_pgps;     /*array for multiple rows*/
384     PoinT       first_point;    /*point where first clicked*/
385     Int4        first_HScroll;  /*horizontal scroll position when first clicked*/
386     Int4        first_VScroll;  /*vertical scroll position when first clicked*/
387     Int4        old_HScroll;    /*horizontal scroll when select rectangle last drawn */
388     Int4        old_VScroll;    /*vertical scroll when select rectangle last drawn */
389     RecT        outline;        /*rectangle when making selection*/
390   } UDV_mouse_select,PNTR UDV_mouse_selectPtr;
391 
392 	typedef  struct  scanfeat {/*use to scan feature when the user clicks
393 						on a feature*/
394 		Uint2 eID;		/*identity of the feature*/
395 		Uint2 iID;
396 		Int4 index;		/*position within the Feature List Box*/
397 		} ScanFeat, PNTR ScanFeatPtr;
398 
399 	typedef struct udvtimerdata {/*used with the UDV timer*/
400 		Int4 pos;/*one-based; bsp coord*/
401 		Int2 delay;
402 		Uint1 status;
403 		Uint1 action;
404 	}UDVTimerData, PNTR UDVTimerDataPtr;
405 
406 	typedef struct viewerdialogdata {
407 		Uint2 				procid;		/*identification of ObjMgr User Data*/
408 		Uint2 				proctype;	/* idem */
409 		Uint2 				userkey;	/* idem */
410 		BspInfo				bsp_i;		/*bsp information*/
411 		UnDViewerGraphData 	udv_graph;	/*UnDviewer graphical panel info*/
412 		ValNodePtr 			ParaG;		/*ParaG data of the entire display*/
413 		PaneL				UnDViewer;	/*handle of the seq viewer panel*/
414 		PrompT				InfoPanel;	/*handle of the info panel*/
415 		WindoW              Parent;  /*only valid for Autonomous viewer*/
416 		UDV_mouse_select	UDV_ms;		/*used for mouse manipulation*/
417 		UDV_Item_Select		Item_select;/*selected Item*/
418 		UDV_Item_Select		Old_Item_select;/*old selected Item*/
419 		Boolean				ClickFeatFromDlg;/*click from Feat List Dlg==TRUE*/
420 		UDVTimerData		udt;
421         SAM_ViewGlobal     *vgp;  /*added for data exchange with Cn3D*/
422         BioseqViewPtr       bvp;  /*added for data exchange with Sequin*/
423 		Boolean             bDisplayRevComp;/*TRUE : diasplay the reverse
424 		    complement of a sequence. Nuc. only.*/
425 		} ViewerDialogData, PNTR ViewerDialogDataPtr;
426 
427 	typedef struct udvmainmenu {/*handles of the main menu commands*/
428 		MenU File;
429 		MenU Options;
430 		MenU Help;
431         MenU Align;
432 		IteM FileOpen;		/*open file command*/
433 		IteM EntrezOpen;	/*open from Entrez command*/
434 		IteM FileClose;		/*close file command*/
435 		IteM ListSequence;	/*list of available sequence*/
436 		IteM QuitViewer;	/*close the viewer*/
437 		IteM ShowFeature;	/*show feature on/off command*/
438 		IteM ShowFeatureList;	/*show feature on/off command*/
439 		IteM SearchForFeature;/*search features by keyword*/
440 		IteM ShowRevComp;	/*show reverse complement (nuc. seq. only)*/
441 		MenU ScalePos;		/*scale position command*/
442 		ChoicE ScalePosChoice; /*scale pos value (sub-menu)*/
443 		IteM RefreshScreen;	/*redraw the entire screen*/
444     MenU AddRow;
445     MenU FromFile;
446     MenU FromNet;
447     IteM BlastMany;
448 		IteM ConfigNet;/*Entrez Network configuration*/
449 		IteM HelpAbout;	/*what's that ?*/
450 	} UDVMainMenu, PNTR UDVMainMenuPtr;
451 
452 	typedef struct udvlogodata {
453 		FonT	f1;
454 		FonT	f2;
455 		FonT	f3;
456 		Char	szTitle[25];
457 		Char	szDesc[80];
458 	} UDVLogoData, PNTR UDVLogoDataPtr;
459 
460 	typedef struct viewermain {
461 		Boolean             UseNetwork;/*true if UDV is connected to Entrez*/
462 		Uint2               UDVprocid;
463 		Uint2               GVprocid;
464 			/*main win menu*/
465 		UDVMainMenu			MainMenu;		/*menu command list*/
466 			/*Features List DlgBox*/
467 		WindoW				hFeatDlg;
468 			/*Panel component*/
469 		ButtoN              gotoBtn;
470 		TexT                gotoVal;
471 		PaneL				Logo_Panel;
472 		Boolean				Show_logo;
473 		GrouP               StatusGroup;
474 			/*viewer data used only when AutonomeViewer is TRUE */
475 		Boolean				AutonomeViewer;
476 		Pointer				dataptr;		/*identification of the object*/
477 		Uint2				datatype;		/*idem */
478 		Uint2				entityID;		/*idem */
479 		ValNodePtr			BspTable;		/*list of bsp*/
480 		Uint2				BspChoice;		/*selection in menu (ONE-based)*/
481 		WindoW				hWndMain;
482 			/*BSP displayed in the viewer*/
483 		ViewerDialogDataPtr vdp;
484 		} ViewerMain, PNTR ViewerMainPtr;
485 
486 #define REGISTER_UDV_AUTONOMOUS ObjMgrProcLoad(OMPROC_VIEW, \
487 		"OneD-Viewer", "SingleSeqViewer", OBJ_BIOSEQ, 0, OBJ_BIOSEQ, 0, \
488 		NULL, UDV_ObjRegAutonomous, 0)
489 #define REGISTER_UDV_SEQENTRY ObjMgrProcLoad(OMPROC_VIEW, \
490 		"OneD-Viewer SE", "SingleSeqViewer SE", OBJ_BIOSEQSET, 0, OBJ_BIOSEQSET, 0, \
491 		NULL, UDV_ObjRegAutonomous, 0)
492 
493 	/*struture passed to the FEAT List dialog box*/
494 	typedef  struct  flmdata {
495 		WindoW 		hWndMain;	/*UnDviewer*/
496 		WindoW 		lbox;		/*list of features (OwnerDraw Lbox)*/
497 		GrouP		gFeatClass;	/*Hidden group of the Feat Class popup*/
498 		PopuP		pop;	/*available class list*/
499 		Int1Ptr		SeqFeatClass;/*classes reported for a sequence*/
500 		} FLMData, PNTR FLMDataPtr;
501 
502 	/*use to initialize the Feature List Dialog box*/
503 	typedef  struct  scanfeatforselect {
504 		Uint2 	eID;	/*if !=-1, UnDviewer slected feature*/
505 		Uint2 	iID;
506 		Int4 	index;	/*return the index of the UnDviewer slected feature*/
507 		Int4 	compteur;/*count the number of entries in Feature List DlgBox*/
508 		WindoW 	lbox;	/*the list itself*/
509 		Boolean SeqFeatListAvail[SEQFEAT_MAX+1];/*use to retrieve the feature
510 				classes*/
511 		Boolean SearchFeat;
512 		Char    szKeyword[50];
513 		} ScanFeatForSelect, PNTR ScanFeatForSelectPtr;
514 
515 	/*
516 	*  The UdvGlobalsPtr may be registered with a call to SetAppProperty
517 	*  e.g., SetAppProperty ("UdvGlobals", &udvglobals), where udvglobals
518 	*  is a persistent structure filled with Vibrant objects or callback
519 	*  function pointers specific for a given application.
520 	*/
521 
522 	typedef SeqEntryPtr (*UdvFetchSeqEntryProc) (Int4 uid, Int2 retcode);
523 
524 	typedef  struct  udvglobals {
525 		ViewerMainPtr         vmp;
526 		UdvFetchSeqEntryProc  fetchSepProc;
527 		Nlm_ItmActnProc   NetCfgMenuProc;
528 		StartNetworkProc  NetStartProc;
529 		} UdvGlobals, PNTR UdvGlobalsPtr;
530 
531     /*
532      * structs used only by the Blast sequence dialog box
533      */
534 
535 #if 0
536 
537     struct _UDV_BlastDlgData;
538     typedef void (*UDV_BlastProcCB)(struct _UDV_BlastDlgData *bddp);
539 
540     typedef struct _UDV_BlastDlgData {
541         ValNode *pvnSips;		/* list of sips in structure */
542         LisT bsp_list;		/* listbox of bsps */
543         PopuP db_list;		/* listbox of databases */
544         ButtoN bGap;   /* should the alignment be gapped? */
545         TexT tMax;
546         TexT tExpect;
547         UDV_BlastProcCB callback;  /* called at end of alignment */
548         Boolean IBM; /* should IBM be applied? */
549         SeqAlign *salp;  /* resulting seqalign */
550     } UDV_BlastDlgData;
551 
552 #endif /* 0 */
553 
554 /*******************************************************************************
555 
556   EXTERNAL FUNCTIONS SECTION (see the .c files of UnDViewer for a complete
557 	  description of each function)
558 
559 *******************************************************************************/
560 	/*drawing and UDV graphical management*/
561 	NLM_EXTERN ValNodePtr UDV_GetSelectedRegions(SelStructPtr om_ssp, Uint2 bsp_eID,
562 		Uint2 bsp_iID);
563 	NLM_EXTERN Boolean UDV_IsLetterSelected(ValNodePtr vnp_bsp, Int4 bsp_pos,
564 		Int4 bspLength,Boolean bDisplayRevComp);
565 	NLM_EXTERN SeqLocPtr UDV_GetClosetSeqLocGivenBspPos(SeqIdPtr sip, Uint2 eID,
566 		Uint2 iID, Int4 bsp_pos, Int4Ptr old_pos, Boolean bModify);
567 	NLM_EXTERN void UDV_InvalRegion(PaneL UnDViewer,UnDViewerGraphDataPtr GrData,
568 		ParaGPtr pgp,Int4 start_inval,Int4 stop_inval,Boolean IsSelect);
569 	NLM_EXTERN void	UDV_GetCurrentDispRange(ViewerDialogDataPtr vdp,
570 		Int4Ptr from_bsp,Int4Ptr to_bsp,Int4Ptr from_line,Int4Ptr to_line);
571 	NLM_EXTERN void LogoFontCreate(FonT PNTR f1,FonT PNTR f2,FonT PNTR f3);
572 	NLM_EXTERN FonT UDV_InitFont(UDVFontDataPtr udvfp);
573 	NLM_EXTERN Int2 UDV_ComputeLineHeight(Int2 cyChar);
574 	NLM_EXTERN void UDV_FontDim(Int2Ptr cxChar,Int2Ptr cyChar);
575 	NLM_EXTERN void UDV_ComputePanelSize(RecT rc,Int2Ptr cxClient,
576 				Int2Ptr cyClient);
577 	NLM_EXTERN void UDV_ComputeBlockByLine(Int2 cxClient,Int2 cxName,
578 				Int2 cxLeftScale,Int2 cxChar,Int2Ptr nCharByLine,
579 				Int2Ptr nBlockByLine);
580 	NLM_EXTERN void UDV_Build_Other_Colors(UnDViewerGraphDataPtr GrDataPtr);
581 	NLM_EXTERN void  UDV_Init_ScaleData(UnDViewerGraphDataPtr GrDataPtr);
582 	NLM_EXTERN void UDV_Init_GraphData(PaneL p,
583 											UnDViewerGraphDataPtr GrDataPtr);
584 	NLM_EXTERN Uint4Ptr UDV_BuildFeatColorTable(void);
585 	NLM_EXTERN void UDV_Build_NA_LayoutPalette(UnDViewerGraphDataPtr GrData);
586 	NLM_EXTERN void UDV_Build_AA_LayoutPalette(UnDViewerGraphDataPtr GrData);
587 	NLM_EXTERN void UDV_deselect_feature(ViewerDialogDataPtr vdp);
588 	NLM_EXTERN void UDV_SelectFeatInFeatDlg(ViewerMainPtr vmp,
589 			Uint2 entityID, Uint4 itemID);
590 	NLM_EXTERN void UDV_select_feature(PaneL p,ViewerDialogDataPtr vdp,
591 			Uint2 entityID,Uint4 itemID,Boolean bRepos);
592 	NLM_EXTERN void UDV_draw_double_cursor(RecT rcClip,PoinT pos);
593   NLM_EXTERN void UDV_draw_horizontal_line(RecT rcClip, Int4 VPos);
594   NLM_EXTERN void UDV_draw_rectangle(RecT rcClip, Boolean DotIt);
595   NLM_EXTERN void UDV_draw_vertical_bar(RecT rcClip, Int4 HPos, Boolean DotIt);
596   NLM_EXTERN void UDV_draw_horizontal_bar(Int4 VPos, Int4 LeftHPos, Int4 RightHPos);
597 	NLM_EXTERN void UDV_ClickProc(PaneL p, PoinT pt);
598 	NLM_EXTERN void UDV_DragMouse(PaneL p,ViewerDialogDataPtr vdp, PoinT pt);
599 	NLM_EXTERN void UDV_DragProc(PaneL p, PoinT pt);
600 	NLM_EXTERN void UDV_ReleaseMouse(PaneL p,ViewerDialogDataPtr vdp, PoinT pt);
601 	NLM_EXTERN void UDV_ReleaseProc(PaneL p, PoinT pt);
602 	NLM_EXTERN void UDV_HoldProc(PaneL p, PoinT pt);
603 	NLM_EXTERN void UDV_Draw_features(UnDViewerGraphDataPtr GrData,
604 		BspInfoPtr bsp_i,Boolean UseDefClr,Uint4 DefClr,
605 		ParaGPtr pgp,RecT PNTR rc,Uint4Ptr pClr,
606 		UDV_Item_Select * is,UDV_Item_Select * old_is,Uint4 DisplayType);
607 	NLM_EXTERN Boolean UDV_Draw_features_MAP(UnDViewerGraphDataPtr GrData,
608 					BspInfoPtr bsp_i,ParaGPtr pgp,RecT PNTR rc,Uint2 entityID,
609 					ValNodePtr PNTR vnpp_map);
610 	NLM_EXTERN void UDV_Draw_sequence(UnDViewerGraphDataPtr GrData,
611         DDV_ColorGlobal *svpp ,Boolean UseDefClr,Uint4 DefClr,
612 		ParaGPtr pgp,RecT PNTR rc,Int4 start_decal,Int4 StartLetter,
613 		CharPtr szSequence, SeqId *sip,ValNodePtr vnp_bsp,Boolean bSelect,
614         Int4 Row,Int4 bspLength,Boolean bDisplayRevComp);
615 	NLM_EXTERN void UDV_Draw_scale(UnDViewerGraphDataPtr GrData,
616 		Boolean ShowMajorTick,Boolean ShowMMinorTick,Uint1 ScalePosition,
617 		Int4 StartLetter,Int4 StopLetter,RecT PNTR rc,Int2 LeftDecal,
618 		Int4 ScaleMaxVal,Int4 AlignPos,Boolean UseBlockDisp,Int2 ColWidth,
619 		Uint4 DisplayType);
620 	NLM_EXTERN void UDV_draw_viewer (PaneL p);
621 	NLM_EXTERN void UDV_Logo_onDraw (PaneL p);
622 
623 	/*Features List Dialog Box*/
624 	NLM_EXTERN Boolean LIBCALLBACK UDV_FeaturesListBoxFind (SeqFeatPtr sfp,
625 			SeqMgrFeatContextPtr context);
626 
627 	/*UDV main window management*/
628 	NLM_EXTERN Int2 LIBCALLBACK UDV_ObjRegAutonomous (Pointer data);
629 	NLM_EXTERN void UDV_WinMainCleanupExtraProc (GraphiC g, VoidPtr data);
630 	NLM_EXTERN void UDV_Resize_Logo_Panel (WindoW Parent,RecT PNTR rcL);
631 	NLM_EXTERN void * UDV_FreeVDPstruct(ViewerDialogDataPtr vdp,Boolean final);
632 	NLM_EXTERN void UDV_set_PullMenus(UDVMainMenuPtr mmp,Boolean enable);
633 	NLM_EXTERN void UDV_set_MainMenus(UDVMainMenuPtr mmp,Boolean enable);
634 	NLM_EXTERN void UDV_set_MainControls(ViewerMainPtr vmp,Boolean enable);
635 	NLM_EXTERN void UDV_SetupMenus(WindoW w,Boolean isEntrezOk,SAM_ViewGlobal *vgp);
636 	NLM_EXTERN void	UDV_resize_viewer(PaneL p,ViewerDialogDataPtr vdp);
637 	NLM_EXTERN void UnDViewerVScrlUpdate(PaneL p,Boolean bInit,Int4 CurPos);
638 	NLM_EXTERN void UDV_WinMainResize(WindoW w);
639 	NLM_EXTERN Boolean  UDV_init_bsp_forViewer(PaneL p,BioseqPtr bsp,Uint2 eID,
640 			Uint2 iID,Uint2 itype,ViewerDialogDataPtr vdp);
641 	NLM_EXTERN Boolean UDV_Init_NonAutonomous(PaneL p,
642 				ViewerDialogDataPtr PNTR vdp,FonT f);
643 	NLM_EXTERN Boolean CreateMainControls(WindoW w,ViewerMainPtr vmp,SAM_ViewGlobal *vgp);
644 	NLM_EXTERN void UnDViewerVScrlProc (BaR sb, SlatE s, Int4 newval,  Int4 oldval);
645 	NLM_EXTERN void UDVResetProc (PaneL p);
646 
647 	/*sequence buffer management*/
648 	NLM_EXTERN CharPtr UDV_Read_Sequence (SeqIdPtr sip, Int4 from, Int4 to,
649 		Boolean IsProt,Int2 len);
650 	NLM_EXTERN void UDV_create_buffer(UnDViewerGraphDataPtr GrData,
651 		ValNodePtr ParaG_list,BspInfoPtr bsp_i,ValNodePtr StartScan,
652 		Boolean bReverse);
653 
654 	/*open a SeqEntry management*/
655     NLM_EXTERN Boolean LIBCALLBACK SearchBioseq (BioseqPtr bsp,
656 			SeqMgrBioseqContextPtr context);
657 	NLM_EXTERN Boolean  UDV_analyze_SEP_for_open(FILE *fp,SeqEntryPtr the_set,
658 		ViewerMainPtr vmp,WindoW w);
659 	NLM_EXTERN void UDV_Init_vdp_struct(PaneL p,ViewerDialogDataPtr vdp,
660 		Boolean EraseParaG,Boolean EraseMainTitle,Boolean EraseInfoPanel);
661 	NLM_EXTERN void UDV_NetOpen (IteM i);
662 	NLM_EXTERN void UDV_FileOpen(IteM i);
663 	NLM_EXTERN void UDV_FileClose(IteM i);
664 	NLM_EXTERN void UDV_CreateListBioseqDlg(IteM i);
665 
666 	/*clean quit*/
667 	NLM_EXTERN void UDV_WinMainProgQuit(WindoW w);
668 
669 	/*Sequin stuffs*/
670 	NLM_EXTERN Boolean UDV_InitForSequin(PaneL udvPanel, BioseqViewPtr bvp);
671 	NLM_EXTERN void UDV_LoadSpecificEditor(BioseqViewPtr bvp, Uint2 entityID,
672 		Uint4 itemID, Uint2 itemtype);
673 
674   /*zero UDV_mouse_select structure*/
675   NLM_EXTERN void ClearUDV_mouse_select(UDV_mouse_selectPtr msp);
676 
677 #if 0
678     /* blast dialog */
679     NLM_EXTERN void UDV_BlastDlg(UDV_BlastDlgData *bddp);
680 #endif
681 
682 
683 #ifdef __cplusplus
684 }
685 #endif
686 
687 #undef NLM_EXTERN
688 #ifdef NLM_EXPORT
689 #define NLM_EXTERN NLM_EXPORT
690 #else
691 #define NLM_EXTERN
692 #endif
693 
694 #endif /* ndef _UNDVIEWER_ */
695