1 /*  $Id: ddvmain.h,v 1.44 2000/07/17 13:32:33 lewisg 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:  ddvmain.h
27 *
28 * Author:  Patrick Durand
29 *
30 * Version Creation Date:   06/19/99
31 *
32 * $Revision: 1.44 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * $Log: ddvmain.h,v $
39 * Revision 1.44  2000/07/17 13:32:33  lewisg
40 * move DDV_args out of the library
41 *
42 * Revision 1.43  2000/07/17 12:38:53  kans
43 * DDV_myargs is extern in header, instantiated in ddvpanel.c, since it is accessed from that library file
44 *
45 * Revision 1.42  2000/07/14 22:24:56  lewisg
46 * fix scroll, click, visual c++ build bugs.  add command line arg parse to ddv
47 *
48 * Revision 1.41  2000/07/12 22:22:42  hurwitz
49 * added delete block to DDV
50 *
51 * Revision 1.40  2000/07/10 14:38:07  lewisg
52 * move seqalign and sequentry data from window to panels
53 *
54 * Revision 1.39  2000/07/08 20:43:58  vakatov
55 * Get all "#include" out of the 'extern "C" { }' scope;  other cleanup...
56 *
57 * Revision 1.38  2000/07/05 19:23:13  lewisg
58 * add two panes to ddv, update msvc project files
59 *
60 * Revision 1.37  2000/07/05 18:42:16  hurwitz
61 * added split block function to DDV
62 *
63 * Revision 1.36  2000/06/30 22:31:51  hurwitz
64 * added merge block function for DDV
65 *
66 * Revision 1.35  2000/06/27 20:46:38  hurwitz
67 * fixed bugs with select rectangle, added select row option
68 *
69 * Revision 1.34  2000/06/15 17:33:18  hurwitz
70 * used view seqAlignPtr to get original (bug fix), and started working on left/right/center justify for DDE
71 *
72 * Revision 1.33  2000/05/19 13:48:31  hurwitz
73 * made a version of DDE that doesn't allow aligned gaps, changed wording for adding new rows
74 *
75 * Revision 1.32  2000/05/15 23:39:34  lewisg
76 * shred cblast, add menu items for gapped/ungapped, fix pdbheaders
77 *
78 * Revision 1.31  2000/04/26 21:54:27  hurwitz
79 * added save function to tell AlnMgr about edits made in DDE
80 *
81 * Revision 1.30  2000/04/21 23:00:50  hurwitz
82 * can launch DDE from DDV
83 *
84 * Revision 1.29  2000/04/18 19:50:24  lewisg
85 * add deselect menu item
86 *
87 * Revision 1.28  2000/04/17 13:30:43  durand
88 * removed g_hParent and unused functions DDV_LaunchAlignViewer and DDV_LaunchAlignEditor
89 *
90 * Revision 1.27  2000/04/10 21:41:26  lewisg
91 * move alignment menus into ddv, udv from cn3d
92 *
93 * Revision 1.26  2000/04/10 20:58:42  hurwitz
94 * added GUI controls for DeleteBlock in DDE
95 *
96 * Revision 1.25  2000/04/07 16:21:08  hurwitz
97 * made delete block faster, added delete block to edit menu
98 *
99 * Revision 1.24  2000/03/27 22:15:05  lewisg
100 * add show/hide row dialog
101 *
102 * Revision 1.23  2000/03/25 00:22:09  hurwitz
103 * put DDE_StackPtr in DDV_Main, add to stack inside DDE api's, added insert char, delete char, home and end keyboard control
104 *
105 * Revision 1.22  2000/03/14 22:08:21  hurwitz
106 * undo and redo working properly, restore-original function added
107 *
108 * Revision 1.21  2000/03/10 23:01:43  hurwitz
109 * added undo and redo functions, first pass
110 *
111 * Revision 1.20  2000/03/06 22:45:58  hurwitz
112 * can shift right boundary of an aligned block left and right, DDVRuler updates added
113 *
114 * Revision 1.19  2000/03/01 22:49:41  lewisg
115 * import bioseq, neatlyindex, get rid of dead code
116 *
117 * Revision 1.18  2000/02/04 16:05:41  durand
118 * add click action to select a row
119 *
120 * Revision 1.17  2000/01/26 13:38:55  durand
121 * update the GUI for the editor. Add functions to create the data to be used by the editor
122 *
123 * Revision 1.16  2000/01/12 21:52:17  durand
124 * add import function; update menus when DDV is loaded from Cn3D
125 *
126 * Revision 1.15  2000/01/11 15:05:23  durand
127 * remove network stuff
128 *
129 * Revision 1.14  2000/01/10 15:09:45  durand
130 * Use Entrez instead of ID1
131 *
132 * Revision 1.13  1999/12/20 20:20:41  lewisg
133 * allow cn3d to do color and ddv to do case when both are running
134 *
135 * Revision 1.12  1999/12/07 21:40:14  durand
136 * add mouse modes menu and caret facility for the editor
137 *
138 * Revision 1.11  1999/12/03 23:17:23  lewisg
139 * Patrick's new global update msg, argument passing when launching ddv, experimental editing
140 *
141 * Revision 1.10  1999/11/29 15:26:25  durand
142 * designed a new GUI to fix problems under MacOS, Linux and SGI
143 *
144 * Revision 1.9  1999/11/09 17:09:00  durand
145 * transfer some functions from ddvgraph to ddvcreate, so that ddvcreate remains Vibrant free and can be compiled with BLAST
146 *
147 * Revision 1.8  1999/11/03 21:29:48  durand
148 * add CTRL and SHFT keys for mouse selection. redesign the loader functions of DDV to properly register the message callbacks
149 *
150 * Revision 1.7  1999/10/29 14:15:40  durand
151 * add simple mouse selection functions
152 *
153 * Revision 1.6  1999/10/23 14:54:34  durand
154 * resolve external symbol g_hParent
155 *
156 * Revision 1.5  1999/10/22 20:12:47  durand
157 * add Export command (text, HTML and Phylip formats)
158 *
159 * Revision 1.4  1999/10/22 14:19:43  durand
160 * update the code for the startup functions of DDV drawing panel
161 *
162 * Revision 1.3  1999/10/20 13:17:19  durand
163 * add display for disc. SeqAlign tails
164 *
165 * Revision 1.2  1999/10/15 21:57:36  durand
166 * add a UI for display options
167 *
168 * Revision 1.1  1999/09/30 14:10:27  durand
169 * add ddv to toolkit
170 *
171 * Revision 1.7  1999/09/23 19:06:50  lewisg
172 * increase maxtemp number of cached sequences
173 *
174 * Revision 1.6  1999/09/21 14:19:08  durand
175 * add mouse click management layout
176 *
177 * Revision 1.5  1999/09/09 21:55:07  durand
178 * instantiate the Fle|Close command of DDV
179 *
180 * Revision 1.4  1999/07/20 14:58:01  durand
181 * use the Color Manager to display colored MSA
182 *
183 * Revision 1.3  1999/06/30 14:57:21  durand
184 * update DDV loader functions
185 *
186 * Revision 1.2  1999/06/28 22:07:21  durand
187 * add loader functions and clean the code with Lint and Purify
188 *
189 * Revision 1.1  1999/06/19 17:21:07  durand
190 * add Vibrant DDV code
191 *
192 *
193 *
194 * ==========================================================================
195 */
196 
197 #ifndef _DDVMAIN_
198 #define _DDVMAIN_
199 
200 #include <ncbi.h>
201 #include <vibrant.h>
202 #include <ddvopen.h>
203 #include <pgppop.h>
204 #include <ddvcolor.h>
205 #include <ddvcreate.h>
206 
207 
208 #ifdef __cplusplus
209 extern "C" {
210 #endif
211 
212 
213 /******************************************************************************
214 
215 	ERROR / Information messages from DDV_OPEN module
216 
217 ******************************************************************************/
218 #define DVV_MSG_M_OK 1
219 
220 /******************************************************************************
221 
222 	defines
223 
224 ******************************************************************************/
225 
226 /* maximum number of sequences to hold in memory */
227 #define DDV_MAXTEMP 500
228 /*caret style */
229 #define DDV_CARET_BAR 1
230 /*mouse mode*/
231 #define DDV_MOUSEMODE_QUERY           0
232 #define DDV_MOUSEMODE_SELECT          1
233 #define DDV_MOUSEMODE_EDIT            2
234 #define DDV_MOUSEMODE_CREATEBLOCK     3
235 #define DDV_MOUSEMODE_LAUNCHEDITOR    4
236 #define DDV_MOUSEMODE_SELECT_ONE_ROW  5
237 #define DDV_MOUSEMODE_MERGEBLOCKS1    6
238 #define DDV_MOUSEMODE_MERGEBLOCKS2    7
239 #define DDV_MOUSEMODE_SPLITBLOCK      8
240 #define DDV_MOUSEMODE_DELETEBLOCK     9
241 
242 /*timer control*/
243 #define DDV_SET_TIMER 1
244 #define DDV_TEST_TIMER 2
245 /*action associated with the timer*/
246 #define DDV_INVAL_REGION 1
247 #define DDV_NOTHING 2
248 
249 /******************************************************************************
250 
251 	Data structures
252 
253 ******************************************************************************/
254 /*used to display the caret (editor mode only)*/
255 typedef struct ddvcaretinfo{
256 	Int4  old_row;/*zero-based values; display coordinates*/
257 	Int4  old_col;
258 	Int4  new_row;/*zero-based values; display coordinates*/
259 	Int4  new_col;
260 	Uint1 style; /*see DDV_CARET_* defines */
261 } DDVCaretInfo, PNTR DDVCaretInfoPtr;
262 
263 /*used to remember the selected row (editor mode only)*/
264 typedef struct ddveditrowinfo{
265 	Int4  curEditRow;/*zero-based values; row for applying delete, move*/
266 	Int4  curMasterRow;/*zero-based values; this row is the master*/
267 } DDVEditRowInfo, PNTR DDVEditRowInfoPtr;
268 
269 typedef struct ddv_global{
270 	DDV_ColorGlobal * colorp;
271 } DDV_Global, PNTR DDV_GlobalPtr;
272 
273 typedef struct ddvmenu {
274 	/*file menu*/
275 	MenU File;
276 	IteM FileOpen;/*open file command*/
277 	IteM EntrezOpen;/*open from ID1 command*/
278 	IteM FileClose;/*close file command*/
279   IteM SaveEdits;/* save changes made in editor*/
280 	IteM FileExport;/*export a seqalign*/
281     IteM ImportSeq;/* import a sequence */
282     IteM ImportNucSeqAlign;/* import a nuc SeqAlign */
283     IteM ImportProtSeqAlign;/* import a prot SeqAlign */
284     IteM Hide;/* show/hide dialog */
285 	IteM QuitViewer;/*close the viewer*/
286 	/*Edit menu*/
287 	MenU Edit;
288 	IteM DeleteRow;
289 	IteM MoveRowLeft;
290 	IteM MoveRowRight;
291   IteM LeftBoundaryLeft;
292   IteM LeftBoundaryRight;
293   IteM RightBoundaryLeft;
294   IteM RightBoundaryRight;
295   IteM DeleteBlock;
296   IteM CreateBlock;
297   IteM Prev;
298   IteM Next;
299   IteM Orig;
300     /*Align menu */
301     MenU Align;
302     MenU AddRow;
303     MenU FromFile;
304     MenU FromNet;
305     IteM Deselect;
306     IteM BlastFile;
307     IteM BlastNet;
308 	/*Options menu*/
309 	MenU Options;
310 	IteM DispStyles;/*display styles*/
311 	ChoicE MouseMode;/*mouse mode (query, selection, edit)*/
312     ChoicE Justify;/*justify (left, right, center)*/
313     IteM ShowLowerPanel;
314 	IteM ConfigNet;/*Entrez Network Conf. dlg*/
315   IteM LaunchEditor;
316   IteM MergeBlocks;
317   IteM SplitBlock;
318   IteM DeleteDDVBlock;
319 	} DdvMenu, PNTR DdvMenuPtr;
320 
321 typedef struct ddvmsadata {
322 	MsaParaGPopList pgp_l;/*ParaG list*/
323 	Uint2			entityID;/*currently displayed SeqAlign*/
324 	Uint2			itemID;/*  */
325 	} DdvMSAData, PNTR DdvMSADataPtr;
326 
327 typedef struct ddvmainwin {
328 	Boolean UseNetwork;
329 		/*main win menu*/
330 	DdvMenu	MainMenu;/*menu command list*/
331 	ButtoN  gotoBtn;
332 	TexT    gotoValRow;
333 	TexT    gotoValCol;
334 	GrouP   StatusGroup;
335 	GrouP   StatusGroupLower;
336 	Boolean	Show_logo;
337 	FonT	f1;	/*tree fonts used to display the software logo*/
338 	FonT	f2;
339 	FonT	f3;
340 		/*viewer data used only when AutonomeViewer is TRUE */
341 	Boolean	AutonomeViewer;/*viewer is standalone ?*/
342 	WindoW	hWndMain;/*handle to the main window*/
343 	PaneL   hWndDDV;/*handle of the current DDV panel*/
344     PaneL   hUpperPanel;/*handle of the upper DDV panel (the multiple)*/
345     PaneL   hLowerPanel;/*handle of the DDV panel (the pairwise) */
346 	PrompT   InfoPanel;
347 	PrompT   UpperInfoPanel;
348 	PrompT   LowerInfoPanel;
349 		/*use to open a file*/
350 	UdvFetchSeqEntryProc  fetchSepProc;/*function to get a gi over the Network*/
351 	Nlm_ItmActnProc   NetCfgMenuProc;
352 	StartNetworkProc  NetStartProc;
353     Boolean EditAllowed;  /* editing is allowed */
354 	}DdvMainWin,PNTR DdvMainWinPtr;
355 
356 typedef struct ddvtimerdata {
357 	Int4 col;/*one-based; disp coord*/
358 	Int4 row;/*one-based; disp coord*/
359 	Int2 delay;
360 	Uint1 status;
361 	Uint1 action;
362 }DdvTimerData, PNTR DdvTimerDataPtr;
363 
364 typedef struct ddvmain {
365     WindoW             hParent;
366     PaneL              hWndDDV;/*panel's handle*/
367     UnDViewerGraphData GrData;/*graphical data*/
368     DdvMSAData         MSA_d;/*data to display*/
369     DDV_Global         Globals;/*shared color data, among others*/
370     UDV_mouse_select   ms;/*mouse selection info*/
371     DDV_Disp_Opt       ddo;
372     DDVCaretInfo       dci;/*caret position and style (editor only)*/
373     DDVEditRowInfo     deri;/*some rows info to apply edit commands*/
374     DdvTimerData       dtd;/*last goto position*/
375     Uint1              MouseMode;
376     Uint1              SavedMouseMode;
377     Uint2              userkey;
378     Uint2              procid;
379     Uint2              proctype;
380     Int4               MasterViewer;/*the viewer launching ddv*/
381     Boolean	           bEditor;/*true if use DDV with editor functions*/
382     DDE_StackPtr       dsp;/*data for editor*/
383     Int4               BlockIndex;/*the first block of merge 2 blocks*/
384     Int4               SaveCol;/*col where split line is drawn*/
385     		/*SAP list when open a File or fetch an DB entry*/
386 	ValNodePtr		vnp_ali;/*SeqAlign List*/
387 	DdvOpenData        dod;/*what is open in DDV*/
388 	} DdvMain, PNTR DdvMainPtr;
389 
390 #define NUMARGS 2
391 extern Args DDV_myargs[NUMARGS];
392 
393 #ifdef __cplusplus
394 }
395 #endif
396 
397 #endif /* ndef _DDVMAIN_ */
398 
399