1 /*   dlogutil.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:  dlogutil.h
27 *
28 * Author:  Jonathan Kans
29 *
30 * Version Creation Date:   1/22/95
31 *
32 * $Revision: 6.125 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date     Name        Description of modification
39 * -------  ----------  -----------------------------------------------------
40 *
41 *
42 * ==========================================================================
43 */
44 
45 #ifndef _DLOGUTIL_
46 #define _DLOGUTIL_
47 
48 #include <vibrant.h>
49 #include <document.h>
50 #include <sqnutils.h>
51 #include <prtutil.h>
52 #include <asn.h>
53 #include <objall.h>
54 #include <objfeat.h>
55 #include <objfdef.h>
56 #include <sequtil.h>
57 
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 #define CHANGE_VIEW_NOTABS        0
64 #define CHANGE_VIEW_FOLDERTABS    1
65 #define CHANGE_VIEW_TEXTTABS      2
66 #define CHANGE_VIEW_RADIOBUTTONS  3
67 #define CHANGE_VIEW_POPUP         4
68 
69 extern StdPrintOptionsPtr  spop;
70 
71 extern Boolean SetupPrintOptions (void);
72 extern void FreePrintOptions (void);
73 
74 extern EnumFieldAssoc  months_alist [];
75 extern EnumFieldAssoc  new_pseudogene_alist [];
76 extern EnumFieldAssoc  legacy_pseudogene_alist [];
77 
78 extern void DatePtrToVibrant (DatePtr dp, PopuP dateMonth, TexT dateDay, TexT dateYear);
79 extern DatePtr VibrantToDatePtr (PopuP dateMonth, TexT dateDay, TexT dateYear);
80 
81 extern ValNodePtr AddStringToValNodeChain (ValNodePtr head, CharPtr str, Uint1 choice);
82 
83 #define DESCRIPTOR_FORM_BLOCK       \
84   FORM_MESSAGE_BLOCK                \
85   DialoG          data;
86 
87 
88 #define FEATURE_FORM_BLOCK            \
89   DESCRIPTOR_FORM_BLOCK               \
90   DialoG            commonRadio;      \
91   GrouP             commonSubGrp [8]; \
92   Int2              commonPage;       \
93   ButtoN            partial;          \
94   ButtoN            exception;        \
95   ButtoN            pseudo;           \
96   PopuP             pseudogene;       \
97   EnumFieldAssocPtr pseudoalist;      \
98   DialoG            experiment;       \
99   DialoG            inference;        \
100   TexT              comment;          \
101   TexT              title;            \
102   TexT              exceptText;       \
103   PopuP             evidence;         \
104   Handle            gene;             \
105   PopuP             genePopup;        \
106   LisT              geneList;         \
107   ValNodePtr        geneNames;        \
108   GrouP             useGeneXref;      \
109   GrouP             newGeneGrp;       \
110   TexT              geneSymbol;       \
111   TexT              geneAllele;       \
112   TexT              geneDesc;         \
113   TexT              locusTag;         \
114   TexT              geneSynonym;      \
115   ButtoN            editGeneBtn;      \
116   TexT              protXrefName;     \
117   TexT              protXrefDesc;     \
118   DialoG            location;         \
119   DialoG            product;          \
120   DialoG            featcits;         \
121   DialoG            dbxrefs;          \
122   DialoG            gbquals;          \
123   DialoG            usrobjext;        \
124   TexT              featid;           \
125   TexT              fidxref;          \
126   ButtoN            leave_dlg_up;     \
127   UserObjectPtr     goTermUserObj;    \
128   Int2              badInfAttempts;   \
129   Boolean           acceptBadInf;
130 
131 typedef struct descform {
132   DESCRIPTOR_FORM_BLOCK
133 } DescriptorForm, PNTR DescriptorFormPtr;
134 
135 typedef struct featform {
136   FEATURE_FORM_BLOCK
137 } FeatureForm, PNTR FeatureFormPtr;
138 
139 extern Int2 LIBCALLBACK DescriptorPropagate (Pointer data);
140 extern Boolean DescFormReplaceWithoutUpdateProc (ForM f);
141 extern Boolean DescFormReplaceWithoutUpdateProcEx (ForM f, Boolean feature_or_molinfo_change);
142 extern void StdDescFormActnProc (ForM f);
143 extern void StdDescFormActnProcNoFeatureChangeNoMolInfoChange (ForM f);
144 
145 extern void StdDescFormCleanupProc (GraphiC g, VoidPtr data);
146 
147 extern Boolean FeatFormReplaceWithoutUpdateProc (ForM f);
148 extern void StdFeatFormActnProc (ForM f);
149 
150 extern void StdSeqFeatPtrToFeatFormProc (ForM f, Pointer data);
151 extern void StdInitFeatFormProc (ForM f);
152 extern void StdFeatFormCleanupProc (GraphiC g, VoidPtr data);
153 extern void StdFeatFormAcceptButtonProc (ButtoN b);
154 
155 extern void InferenceDialogToGBQuals (DialoG d, SeqFeatPtr sfp, Boolean convertBadToNote);
156 extern void GBQualsToInferenceDialog (DialoG d, SeqFeatPtr sfp);
157 
158 extern DialoG CreateExperimentDialog (GrouP prnt);
159 extern void ExperimentDialogToGbquals (SeqFeatPtr sfp, DialoG d);
160 extern void GBQualsToExperimentDialog (SeqFeatPtr sfp, DialoG d);
161 
162 /*
163 extern void ExtendGeneFeatIfOnMRNA (Uint2 entityID, SeqEntryPtr sep);
164 */
165 
166 extern OMUserDataPtr ItemAlreadyHasEditor (Uint2 entityID, Uint4 itemID, Uint2 itemtype, Uint2 procid);
167 extern Uint2 GetProcIdForItemEditor (Uint2 entityID, Uint2 itemID, Uint1 itemtype, Uint2 subinputtype);
168 extern OMUserDataPtr EntityAlreadyHasViewer (Uint2 entityID);
169 extern Boolean MakeViewerIndependent (Uint2 entityID, OMUserDataPtr omudp);
170 
171 extern Int2 LIBCALLBACK StdVibrantEditorMsgFunc (OMMsgStructPtr ommsp);
172 
173 extern Boolean TestInference (FeatureFormPtr ffp, CharPtr badInfQual, size_t len, CharPtr badInfMssg);
174 
175 extern void InitPseudogenePopup (FeatureFormPtr ffp, PopuP p, Boolean ispseudo, CharPtr pseudogene, Boolean indexerVersion);
176 
177 /*****************************************************************************
178 *
179 *   Various specific spreadsheet or editor dialogs.
180 *
181 *****************************************************************************/
182 
183 extern DialoG CreateAuthorDialog (GrouP prnt, Uint2 rows, Int2 spacing);
184 extern DialoG CreateAuthorDialogEx (GrouP prnt, Uint2 rows, Int2 spacing, Boolean use_import_btn, Nlm_ChangeNotifyProc change_notify, Pointer change_data);
185 
186 extern DialoG CreateDateDialogEx (GrouP prnt, CharPtr title, Int4 start_year, Int4 num_years);
187 extern DialoG CreateDateDialog (GrouP prnt, CharPtr title);
188 
189 extern DialoG CreateAffilDialog (GrouP prnt, CharPtr title);
190 extern DialoG CreatePublisherAffilDialog (GrouP prnt, CharPtr title);
191 extern DialoG CreateProceedingsDialog (GrouP prnt, CharPtr title);
192 
193 /* The Ext versions split the affil dialogs into two superimposed pages,
194    both of which are initially hidden, that can go in separate folder tabs */
195 
196 extern DialoG CreateExtAffilDialog (GrouP prnt, CharPtr title,
197                                     GrouP PNTR grp1, GrouP PNTR grp2);
198 extern DialoG CreateExtPublisherAffilDialog (GrouP prnt, CharPtr title,
199                                              GrouP PNTR grp1, GrouP PNTR grp2);
200 extern DialoG CreateExtProceedingsDialog (GrouP prnt, CharPtr title,
201                                           GrouP PNTR grp1, GrouP PNTR grp2);
202 
203 extern GrouP CreateCommonFeatureGroup (GrouP h, FeatureFormPtr ffp,
204                                        SeqFeatPtr sfp, Boolean hasGeneControl,
205                                        Boolean hasCitationTab);
206 extern GrouP CreateCommonFeatureGroupEx (GrouP h, FeatureFormPtr ffp,
207                                          SeqFeatPtr sfp, Boolean hasGeneControl,
208                                          Boolean hasCitationTab, Boolean hasGeneSuppress);
209 extern void UpdateGeneLocation (SeqFeatPtr gene, SeqLocPtr old_feat_loc,
210                                 SeqLocPtr new_feat_loc, Uint2 entityID);
211 extern void PopulateGenePopup (FeatureFormPtr ffp);
212 extern void SeqFeatPtrToCommon (FeatureFormPtr ffp, SeqFeatPtr sfp);
213 extern void SetNewFeatureDefaultInterval (FeatureFormPtr ffp);
214 extern DialoG CreateImportFields (GrouP h, CharPtr name, SeqFeatPtr sfp, Boolean allowProductGBQual);
215 extern DialoG NewCreateImportFields (GrouP h, CharPtr name, SeqFeatPtr sfp, Boolean allowProductGBQual);
216 
217 
218 extern DialoG CreateIntervalEditorDialog (GrouP h, CharPtr title, Uint2 rows,
219                                           Int2 spacing, SeqEntryPtr sep,
220                                           Boolean nucsOK, Boolean protsOK);
221 
222 typedef void (*IntEdPartialProc) (FeatureFormPtr ffp, Boolean partial5, Boolean partial3, Boolean order);
223 
224 extern DialoG CreateIntervalEditorDialogEx (GrouP h, CharPtr title, Uint2 rows,
225                                             Int2 spacing, SeqEntryPtr sep,
226                                             Boolean nucsOK, Boolean protsOK,
227                                             Boolean useBar, Boolean showPartials,
228                                             Boolean allowGaps, FeatureFormPtr ffp,
229                                             IntEdPartialProc proc);
230 
231 extern DialoG CreateIntervalEditorDialogExEx (GrouP h, CharPtr title, Uint2 rows,
232                                               Int2 spacing, SeqEntryPtr sep,
233                                               Boolean nucsOK, Boolean protsOK,
234                                               Boolean useBar, Boolean showPartials,
235                                               Boolean allowGaps, FeatureFormPtr ffp,
236                                               IntEdPartialProc proc,
237                                               Boolean use_aln, Boolean show_seqid,
238                                               TaglistCallback tlp_callback,
239                                               Pointer callback_data,
240                                               Boolean allow_nulls_in_list);
241 
242 extern void DisplayErrorMessages (CharPtr title, ValNodePtr err_list);
243 
244 extern Boolean AdjustFromForGap (Int4Ptr p_from, SeqAlignPtr salp, Int4 aln_len, Int4 aln_row);
245 extern Boolean AdjustToForGap (Int4Ptr p_to, SeqAlignPtr salp, Int4 aln_row);
246 
247 extern void SetSequenceAndStrandForIntervalPage (DialoG d);
248 extern void StdFeatIntEdPartialCallback (FeatureFormPtr ffp, Boolean partial5, Boolean partial3, Boolean order);
249 
250 extern DialoG CreateVisibleStringDialog (GrouP h, Uint2 rows,
251                                          Int2 spacing, Int2 width);
252 
253 extern DialoG CreateDbtagDialog (GrouP h, Uint2 rows, Int2 spacing,
254                                  Int2 width1, Int2 width2);
255 
256 /*****************************************************************************
257 *
258 *   Miscellaneous functions.
259 *
260 *****************************************************************************/
261 
262 /*
263 *  The TextViewProcsPtr may be registered with a call to SetAppProperty
264 *  e.g., SetAppProperty ("TextDisplayForm", &viewprocs), where viewprocs
265 *  is a persistent structure filled with callback function pointers specific
266 *  for a given application.
267 */
268 
269 typedef struct textviewprocs {
270   WndActnProc      activateForm;
271   WndActnProc      closeForm;
272   WndActnProc      createMenus;
273 
274   FormMessageFunc  handleMessages;
275 
276   Int2             minPixelWidth;
277   Int2             minPixelHeight;
278   Boolean          useScrollText;
279 
280   FonT             displayFont;
281 
282   Char             screenMode;
283 
284 } TextViewProcs, PNTR TextViewProcsPtr;
285 
286 typedef CharPtr (*Nlm_RepopulateViewer) PROTO ((Pointer userdata));
287 typedef Pointer (*Nlm_RepopulateDataFree) PROTO ((Pointer userdata));
288 
289 extern void LaunchGeneralTextViewer (CharPtr path, CharPtr title);
290 extern void LaunchAsnTextViewer (Pointer from, AsnWriteFunc writefunc, CharPtr title);
291 extern void LaunchGeneralTextViewerWithRepopulate
292          (CharPtr path, CharPtr title,
293          Nlm_RepopulateViewer repopulate_func, Pointer repopulate_data,
294          Nlm_RepopulateDataFree free_data_func);
295 
296 extern Boolean FileToScrollText (TexT t, CharPtr path);
297 extern void ScrollTextToFile (TexT t, CharPtr path);
298 
299 extern void FileToClipboard (CharPtr path);
300 
301 /*
302 *  The StdEditorProcsPtr may be registered with a call to SetAppProperty
303 *  e.g., SetAppProperty ("StdEditorForm", &viewprocs), where viewprocs
304 *  is a persistent structure filled with callback function pointers specific
305 *  for a given application.
306 */
307 
308 typedef struct stdeditorprocs {
309   WndActnProc      activateForm;
310   FormMessageFunc  handleMessages;
311 
312   Boolean          duplicateExisting;
313 
314   Char             screenMode;
315 
316 } StdEditorProcs, PNTR StdEditorProcsPtr;
317 
318 #ifndef WIN_MAC
319 extern void CreateStdEditorFormMenus (WindoW w);
320 #endif
321 
322 /*
323 *  When duplicating instead of editing, the editors call the following
324 *  function to change the baseFormPtr itemID and itemtype to the closest
325 *  Bioseq or BioseqSet, thus adding the new item to that parent.
326 */
327 
328 extern Boolean SetClosestParentIfDuplicating (BaseFormPtr bfp);
329 
330 /*
331 *  The HelpMessageFunc may be registered with a call to SetAppProperty
332 *  e.g., SetAppProperty ("HelpMessageProc", helpproc), where helpproc
333 *  is an application-supplied callback function that takes character
334 *  strings for the heading and section.
335 */
336 
337 typedef void (*HelpMessageFunc) (CharPtr, CharPtr);
338 
339 /*****************************************************************************
340 *
341 *   Miscellaneous functions.
342 *
343 *****************************************************************************/
344 
345 extern CharPtr SaveStringFromTextAndStripNewlines (TexT t);
346 extern CharPtr StripNewlines (CharPtr str);
347 extern void NewlinesToTildes (CharPtr str);
348 
349 /* GetRidOfEmptyFeatsDescStrings takes either an entityID or a SeqEntryPtr */
350 
351 extern void GetRidOfEmptyFeatsDescStrings (Uint2 entityID, SeqEntryPtr sep);
352 
353 /*****************************************************************************
354 *
355 *   LaunchEntrezURL constructs a web-Entrez URL query.  Parameter choices are:
356 *
357 *     Database      Report Formats
358 *
359 *      PubMed        DocSum, Brief, Abstract, Citation, MEDLINE, ASN.1, ExternalLink
360 *      Nucleotide    DocSum, Brief, GenBank, ASN.1, FASTA, ExternalLink
361 *      Protein       DocSum, Brief, GenPept, ASN.1, FASTA, ExternalLink
362 *      Genome        DocSum, Brief, ASN.1, ExternalLink
363 *      Popset        DocSum, Brief, ASN.1, FASTA, ExternalLink
364 *      Structure     DocSum, Brief
365 *      OMIM          DocSum, Text, Synopsis, Variants, MiniMIM, ASN.1, ExternalLink
366 *      Taxonomy      DocSum, Brief, TxInfo, TxTree, ExternalLink
367 *
368 *****************************************************************************/
369 
370 NLM_EXTERN void LaunchEntrezURL (CharPtr database, Int4 uid, CharPtr format);
371 
372 /* this function creates a dialog for selecting publications in a record */
373 extern DialoG FeatCitEditDialog (GrouP parent, Uint2 entityID);
374 
375 /* This structure and the functions after it are used for
376  * modal dialogs with two choices.
377  */
378 typedef struct modalacceptcancel
379 {
380   Boolean accepted;
381   Boolean cancelled;
382   Boolean third_option;
383 } ModalAcceptCancelData, PNTR ModalAcceptCancelPtr;
384 
385 extern void ModalAcceptButton (ButtoN b);
386 extern void ModalCancelButton (ButtoN b);
387 extern void ModalThirdOptionButton (ButtoN b);
388 NLM_EXTERN Int4 ThreeOptionsDlg (CharPtr title_txt, CharPtr explain_txt, CharPtr opt1, CharPtr opt2, CharPtr opt3);
389 
390 typedef void (*TableDisplayDblClick) PROTO((PoinT, CharPtr, CharPtr, Pointer));
391 typedef Boolean (*TableDisplayLeftInRed) PROTO ((Int4, ValNodePtr, Pointer));
392 extern DialoG TableDisplayDialog (GrouP parent, Int4 width, Int4 height,
393                                   Int4 frozen_header, Int4 frozen_left,
394                                   TableDisplayDblClick dbl_click,
395                                   Pointer dbl_click_data,
396                                   TableDisplayLeftInRed,
397                                   Pointer left_in_red_data);
398 extern DialoG EditableTableDisplayDialog (GrouP parent, Int4 width, Int4 height,
399                                   Int4 frozen_header, Int4 frozen_left,
400                                   TableDisplayDblClick dbl_click,
401                                   Pointer dbl_click_data,
402                                   TableDisplayLeftInRed left_in_red,
403                                   Pointer left_in_red_data);
404 extern ValNodePtr FreeTableDisplayRowList (ValNodePtr row_list);
405 extern void PrintTableDisplayRowListToFile (ValNodePtr row_list, FILE *fp);
406 extern ValNodePtr CopyTableDisplayRowList (ValNodePtr row_list);
407 extern CharPtr GetRowListCellText (ValNodePtr row_list, Int4 row, Int4 column);
408 extern FonT GetTableDisplayDefaultFont (void);
409 
410 
411 #define TALL_SELECTION_LIST 6
412 #define SHORT_SELECTION_LIST 4
413 /* err_msg is the message to put in the results from TestDialog if nothing is selected */
414 /* choice_list should be a valnode list of strings to use for the names of the choices. */
415 /* All is automatically included as a choice if allow_multi is true. */
416 /* The ValNodeList returned is a list of integers indicating the position of the item
417  * in the list: 1 is the first item, 2 is the second item, etc. */
418 extern DialoG SelectionDialog
419 (GrouP h,
420  Nlm_ChangeNotifyProc     change_notify,
421  Pointer                  change_userdata,
422  Boolean                  allow_multi,
423  CharPtr                  err_msg,
424  ValNodePtr               choice_list,
425  Int2                     list_height);
426 
427 extern DialoG SelectionDialogEx
428 (GrouP h,
429  Nlm_ChangeNotifyProc     change_notify,
430  Pointer                  change_userdata,
431  Boolean                  allow_multi,
432  CharPtr                  err_msg,
433  ValNodePtr               choice_list,
434  Int2                     list_height,
435  Boolean                  force_list);
436 
437 extern DialoG SelectionDialogExEx
438 (GrouP h,
439  Nlm_ChangeNotifyProc     change_notify,
440  Pointer                  change_userdata,
441  Boolean                  allow_multi,
442  CharPtr                  err_msg,
443  ValNodePtr               choice_list,
444  Int2                     list_height,
445  Boolean                  force_list,
446  Boolean                  force_popup);
447 
448 
449 /* This function should free just the data associated with the ValNode */
450 typedef void (*FreeValNodeProc) PROTO ((ValNodePtr));
451 /* This function should copy just this ValNode, not the chain */
452 typedef ValNodePtr (*CopyValNodeDataProc) PROTO ((ValNodePtr));
453 typedef ValNodePtr (*RemapValNodeProc) PROTO ((ValNodePtr));
454 typedef Boolean (*MatchValNodeProc) PROTO ((ValNodePtr, ValNodePtr));
455 typedef CharPtr (*NameFromValNodeProc) PROTO ((ValNodePtr));
456 
457 extern DialoG ValNodeSelectionDialogExEx
458 (GrouP h,
459  ValNodePtr               choice_list,
460  Int2                     list_height,
461  NameFromValNodeProc      name_proc,
462  FreeValNodeProc          free_vn_proc,
463  CopyValNodeDataProc      copy_vn_proc,
464  MatchValNodeProc         match_vn_proc,
465  CharPtr                  err_name,
466  Nlm_ChangeNotifyProc     change_notify,
467  Pointer                  change_userdata,
468  Boolean                  allow_multi,
469  Boolean                  force_list,
470  Boolean                  force_popup,
471  RemapValNodeProc         remap_vn_proc);
472 extern DialoG ValNodeSelectionDialogEx
473 (GrouP h,
474  ValNodePtr               choice_list,
475  Int2                     list_height,
476  NameFromValNodeProc      name_proc,
477  FreeValNodeProc          free_vn_proc,
478  CopyValNodeDataProc      copy_vn_proc,
479  MatchValNodeProc         match_vn_proc,
480  CharPtr                  err_name,
481  Nlm_ChangeNotifyProc     change_notify,
482  Pointer                  change_userdata,
483  Boolean                  allow_multi,
484  Boolean                  force_list,
485  RemapValNodeProc         remap_vn_proc);
486 extern DialoG ValNodeSelectionDialog
487 (GrouP h,
488  ValNodePtr               choice_list,
489  Int2                     list_height,
490  NameFromValNodeProc      name_proc,
491  FreeValNodeProc          free_vn_proc,
492  CopyValNodeDataProc      copy_vn_proc,
493  MatchValNodeProc         match_vn_proc,
494  CharPtr                  err_name,
495  Nlm_ChangeNotifyProc     change_notify,
496  Pointer                  change_userdata,
497  Boolean                  allow_multi);
498 
499 extern DialoG EnumAssocSelectionDialog
500 (GrouP                 h,
501  Nlm_EnumFieldAssocPtr eap,
502  CharPtr               err_name,
503  Boolean               allow_multi,
504  Nlm_ChangeNotifyProc  change_notify,
505  Pointer               change_userdata);
506 
507 extern CharPtr ValNodeStringName (ValNodePtr vnp);
508 extern void ValNodeSimpleDataFree (ValNodePtr vnp);
509 extern ValNodePtr ValNodeStringCopy (ValNodePtr vnp);
510 extern Boolean ValNodeChoiceMatch (ValNodePtr vnp1, ValNodePtr vnp2);
511 extern Boolean ValNodeStringMatch (ValNodePtr vnp1, ValNodePtr vnp2);
512 
513 /* choice list is a list of strings */
514 extern DialoG StringComboDialog
515 (GrouP h,
516  ValNodePtr               choice_list,
517  Int2                     list_height,
518  Int2                     list_width,
519  Nlm_ChangeNotifyProc     change_notify,
520  Pointer                  change_userdata);
521 
522 extern DialoG SequenceSelectionDialog
523 (GrouP h,
524  Nlm_ChangeNotifyProc     change_notify,
525  Pointer                  change_userdata,
526  Boolean                  allow_multi,
527  Boolean                  show_nucs,
528  Boolean                  show_prots,
529  Uint2                    entityID);
530 
531 extern DialoG SequenceSelectionDialogEx
532 (GrouP h,
533  Nlm_ChangeNotifyProc     change_notify,
534  Pointer                  change_userdata,
535  Boolean                  allow_multi,
536  Boolean                  allow_none,
537  Boolean                  show_nucs,
538  Boolean                  show_prots,
539  Uint2                    entityID,
540  Int4                     list_height);
541 
542 extern DialoG SubSourceTypeDialog
543 (GrouP                    h,
544  Int2                     list_height,
545  Nlm_ChangeNotifyProc     change_notify,
546  Pointer                  change_userdata,
547  Boolean                  allow_multi,
548  Boolean                  force_list,
549  Boolean                  include_note);
550 
551 extern DialoG OrgModTypeDialog
552 (GrouP                    h,
553  Int2                     list_height,
554  Nlm_ChangeNotifyProc     change_notify,
555  Pointer                  change_userdata,
556  Boolean                  allow_multi,
557  Boolean                  force_list,
558  Boolean                  include_note);
559 
560 
561 typedef CharPtr (*GetClickableItemText) (ValNodePtr item_list);
562 
563 extern DialoG
564 CreateClickableListDialog
565 (GrouP h,
566  CharPtr label1,
567  CharPtr label2,
568  ClickableCallback item_single_click_callback,
569  ClickableCallback item_double_click_callback,
570  Pointer         item_click_callback_data,
571  GetClickableItemText get_item_text);
572 
573 extern DialoG
574 CreateClickableListDialogEx
575 (GrouP h,
576  CharPtr label1,
577  CharPtr label2,
578  CharPtr help1,
579  CharPtr help2,
580  ClickableCallback item_single_click_callback,
581  ClickableCallback item_double_click_callback,
582  Pointer         item_click_callback_data,
583  GetClickableItemText get_item_text,
584  Int4            left_width,
585  Int4            right_width,
586  Boolean         horizontal,
587  Boolean         show_find);
588 
589 extern DialoG
590 CreateClickableListDialogExEx
591 (GrouP h,
592  CharPtr label1,
593  CharPtr label2,
594  CharPtr help1,
595  CharPtr help2,
596  ClickableCallback item_single_click_callback,
597  ClickableCallback item_double_click_callback,
598  Pointer         item_click_callback_data,
599  GetClickableItemText get_item_text,
600  Int4            left_width,
601  Int4            right_width,
602  Boolean         horizontal,
603  Boolean         show_find,
604  Boolean         display_chosen);
605 
606 extern DialoG
607 CreateClickableListDialogExExEx
608 (GrouP h,
609  CharPtr label1,
610  CharPtr label2,
611  CharPtr help1,
612  CharPtr help2,
613  ClickableCallback item_single_click_callback,
614  ClickableCallback item_double_click_callback,
615  Pointer         item_click_callback_data,
616  GetClickableItemText get_item_text,
617  Int4            num_item_text_columns,
618  Int4            left_width,
619  Int4            right_width,
620  Boolean         horizontal,
621  Boolean         show_find,
622  Boolean         display_chosen);
623 
624 extern void SetClickableListDialogTitles (DialoG d, CharPtr title1, CharPtr title2, CharPtr help1, CharPtr help2);
625 extern void SetClickableListDisplayChosen (DialoG d, Boolean set);
626 
627 extern void ScrollToNextClickableTextDescription (CharPtr txt, DialoG d);
628 extern void ScrollToPreviousClickableTextDescription (CharPtr txt, DialoG d);
629 
630 extern CharPtr GetSelectedClickableListText (DialoG d);
631 
632 extern void GetAlignmentsInSeqEntryCallback (SeqAnnotPtr sap, Pointer userdata);
633 extern void CreateSeqAlignLabel (SeqAlignPtr salp, CharPtr buf, Int4 buf_size);
634 
635 
636 typedef struct existingtext
637 {
638   Int4    existing_text_choice;
639 } ExistingTextData, PNTR ExistingTextPtr;
640 
641 typedef enum {
642   eExistingTextChoiceReplaceOld = 1,
643   eExistingTextChoiceAppendSemi,
644   eExistingTextChoiceAppendSpace,
645   eExistingTextChoiceAppendColon,
646   eExistingTextChoiceAppendNone,
647   eExistingTextChoicePrefixSemi,
648   eExistingTextChoicePrefixSpace,
649   eExistingTextChoicePrefixColon,
650   eExistingTextChoicePrefixNone,
651   eExistingTextChoiceLeaveOld,
652   eExistingTextChoiceCancel } EExistingTextChoice;
653 
654 extern CharPtr
655 HandleExistingText
656 (CharPtr existing_text,
657  CharPtr new_text,
658  ExistingTextPtr etp);
659 
660 extern ExistingTextPtr GetExistingTextHandlerInfo (Int4 num_found, Boolean non_text);
661 
662 typedef enum {
663   EditApplyFindLocation_anywhere = 1,
664   EditApplyFindLocation_beginning,
665   EditApplyFindLocation_end
666 } EditApplyFindLocation;
667 
668 typedef struct applyvalue
669 {
670   ValNodePtr        field_list;
671   ExistingTextPtr   etp;
672   CharPtr           new_text;
673   CharPtr           text_to_replace;
674   EditApplyFindLocation where_to_replace;
675 
676 } ApplyValueData, PNTR ApplyValuePtr;
677 
678 
679 typedef struct editapply
680 {
681   CharPtr               find_txt;
682   EditApplyFindLocation find_location;
683   CharPtr               repl_txt;
684   CharPtr               apply_txt;
685 } EditApplyData, PNTR EditApplyPtr;
686 
687 extern EditApplyPtr EditApplyFree (EditApplyPtr eap);
688 extern EditApplyPtr EditApplyNew (void);
689 
690 typedef enum {
691   eEditApplyChoice_Apply = 0,
692   eEditApplyChoice_Edit } EEditApplyChoice;
693 
694 extern DialoG EditApplyDialog
695 (GrouP                    h,
696  Int4                     action_choice,
697  CharPtr                  apply_label,
698  ValNodePtr               choice_list,
699  Nlm_ChangeNotifyProc     change_notify,
700  Pointer                  change_userdata);
701 
702 /* For the global inference editor */
703 typedef struct inferenceparsedata
704 {
705   CharPtr category;
706   CharPtr type;
707   Boolean same_species;
708   CharPtr first_field;
709   CharPtr second_field;
710 } InferenceParseData, PNTR InferenceParsePtr;
711 
712 extern InferenceParsePtr ParseInferenceText (CharPtr inference);
713 extern CharPtr InferenceTextFromStruct (InferenceParsePtr ipp);
714 
715 typedef struct inferencefieldedit
716 {
717   CharPtr field_type;
718   Int4 field_choice;
719   EditApplyPtr edit_apply;
720 } InferenceFieldEditData, PNTR InferenceFieldEditPtr;
721 
722 extern InferenceFieldEditPtr InferenceFieldEditFree (InferenceFieldEditPtr ifep);
723 
724 typedef enum {
725   eInferenceRemove = 0,
726   eInferenceEditCategory,
727   eInferenceEditType,
728   eInferenceApplyTypeFields,
729   eInferenceEditTypeFields,
730   eNumInferenceEditActions } EInferenceEditAction;
731 
732 
733 typedef struct inferenceedit {
734   EInferenceEditAction action;
735   CharPtr category_from;
736   CharPtr category_to;
737   CharPtr type_from;
738   CharPtr type_to;
739 
740   InferenceFieldEditPtr field_edit;
741 } InferenceEditData, PNTR InferenceEditPtr;
742 
743 extern InferenceEditPtr InferenceEditFree (InferenceEditPtr iep);
744 
745 extern DialoG CreateInferenceEditDialog
746 (GrouP                    h,
747  Nlm_ChangeNotifyProc     change_notify,
748  Pointer                  change_userdata);
749 
750 typedef enum {
751  eValueEditSimpleText = 0,
752  eValueEditTrueFalse,
753  eValueEditLatLon,
754  eValueEditSpecimenVoucher,
755  eValueEditAltitude,
756  eNumValueEditors
757 } EValueEdit;
758 
759 /* In name_vnp, choice is type of editor, ptrvalue is string with choice name */
760 typedef struct namevaluepair {
761   ValNodePtr name_vnp;
762   CharPtr    value;
763 } NameValuePairData, PNTR NameValuePairPtr;
764 
765 extern NameValuePairPtr NameValuePairFree (NameValuePairPtr nvp);
766 extern NameValuePairPtr NameValuePairCopy (NameValuePairPtr nvp);
767 extern ValNodePtr NameValuePairListFree (ValNodePtr vnp);
768 
769 #define VALUE_LIST_PARENT_FIELDS \
770   DIALOG_MESSAGE_BLOCK \
771   TexT note;
772 
773 
774 typedef struct valuelistparent {
775   VALUE_LIST_PARENT_FIELDS
776 } ValueListParentData, PNTR ValueListParentPtr;
777 
778 
779 extern DialoG
780 ValueListDialog
781 (GrouP           h,
782  Uint2           num_rows,
783  Int2            width,
784  ValNodePtr      choice_list,
785  ValueListParentPtr parent,
786  TaglistCallback change_notify,
787  Pointer         change_userdata);
788 
789 extern DialoG CreateSubSourceDialog (GrouP h, EnumFieldAssocPtr al);
790 extern DialoG CreateOrgModDialog (GrouP h, EnumFieldAssocPtr al, TexT taxname);
791 
792 extern Boolean IsNonTextModifier (CharPtr mod_name);
793 
794 
795 typedef Boolean (*ParseOK) PROTO ((CharPtr));
796 
797 extern Boolean ParseCollectionDateOk (CharPtr txt);
798 extern DialoG CollectionDateDialog (GrouP h, SeqEntryPtr sep, CharPtr name,
799                                TaglistCallback tlp_callback,
800                                Pointer callback_data);
801 
802 extern DialoG CreateRptUnitRangeDialog (GrouP h, SeqEntryPtr sep, CharPtr name,
803                                          TaglistCallback tlp_callback,
804                                          Pointer callback_data);
805 
806 extern void CreateStandardEditMenu (WindoW w);
807 
808 extern void CleanupEvidenceGBQuals (GBQualPtr PNTR prevgbq);
809 extern void VisStringDialogToGbquals (SeqFeatPtr sfp, DialoG d, CharPtr qual);
810 
811 extern void RememberSqnTempFile (CharPtr file);
812 extern void FreeSqnTempFiles (void);
813 
814 /* For fixing special characters */
815 NLM_EXTERN Boolean FixSpecialCharacters (Uint2 entityID);
816 extern Boolean FixSpecialCharactersForStringsInList (ValNodePtr find_list, CharPtr exp_text, Boolean force_fix);
817 NLM_EXTERN Boolean FixSpecialCharactersForObject (Uint2 datatype, Pointer objdata, CharPtr msg, Boolean force_fix, BoolPtr changed);
818 
819 /* for functions that act on all open records */
820 NLM_EXTERN ValNodePtr GetBaseFormList (void);
821 NLM_EXTERN ValNodePtr GetViewedSeqEntryList (void);
822 NLM_EXTERN SeqEntryPtr RestoreFromFileEx (CharPtr path, Boolean convert_seqsubmit_to_pub);
823 NLM_EXTERN SeqEntryPtr RestoreFromFile (CharPtr path);
824 NLM_EXTERN Uint2 RestoreEntityIDFromFileEx (CharPtr path, Uint2 entityID, Boolean convert_seqsubmit_to_pub);
825 NLM_EXTERN Uint2 RestoreEntityIDFromFile (CharPtr path, Uint2 entityID);
826 
827 
828 NLM_EXTERN Int2 PanelOffsetFromCharOffsetEx (DoC doc, FonT font, Int2 item, Int2 col, Int2 char_offset);
829 NLM_EXTERN Int2 GetTextSelectCharOffsetEx (PoinT pt, DoC doc, FonT font, Int2 item, Int2 row, Int2 col);
830 NLM_EXTERN CharPtr GetSelectedDocText (DoC doc, Int2 item_start, Int2 row_start, Int2 col_start, Int2 char_start,
831                                        Int2 item_stop, Int2 row_stop, Int2 col_stop, Int2 char_stop,
832                                        Int2Ptr only_these_columns, Int2 num_col);
833 
834 
835 /* for feature replace */
836 NLM_EXTERN ValNodePtr FeatureReplaceListFree (ValNodePtr vnp);
837 NLM_EXTERN void ActOnFeatureReplaceList (ValNodePtr list);
838 NLM_EXTERN DialoG FeatureReplaceListDialog (GrouP h, Int4 width, Nlm_ChangeNotifyProc change_notify, Pointer change_userdata);
839 NLM_EXTERN Boolean AddFeaturesToReplaceList (DialoG d, ValNodePtr feature_list);
840 NLM_EXTERN ValNodePtr RemoveFeaturesFromReplaceList (DialoG d);
841 NLM_EXTERN ValNodePtr FeatureReplaceListFromSeqAnnot (SeqAnnotPtr sap);
842 NLM_EXTERN DialoG FeatureSelectListDialog (GrouP h, Int4 width);
843 NLM_EXTERN ValNodePtr RemoveSelectedFeaturesFromList (DialoG d);
844 NLM_EXTERN void AddFeaturesToList (DialoG d, ValNodePtr features);
845 NLM_EXTERN void SortSeqFeatInAnnot (SeqAnnotPtr sap);
846 NLM_EXTERN SeqFeatPtr GetSelectedNewFeature (DialoG d);
847 NLM_EXTERN void ScrollToMatchingFeatures (DialoG d, SeqFeatPtr sfp);
848 NLM_EXTERN Boolean AutomatchFeatures (DialoG d, ValNodePtr PNTR existing_features);
849 
850 NLM_EXTERN void CloseLog (LogInfoPtr lip);
851 NLM_EXTERN void ShowLog (LogInfoPtr lip);
852 
853 NLM_EXTERN void TextToFeatID (TexT t, ChoicePtr cp);
854 NLM_EXTERN void TextToFeatXref (TexT t, SeqFeatPtr sfp);
855 
856 NLM_EXTERN DialoG DescriptorStreamEditor (GrouP h,  Nlm_ChangeNotifyProc change_notify, Pointer change_userdata);
857 NLM_EXTERN void SetDescriptorStreamEditorIdList (DialoG d, SeqIdPtr sip_list);
858 NLM_EXTERN void ClearTextBtn (ButtoN b);
859 
860 #ifdef __cplusplus
861 }
862 #endif
863 
864 #endif /* ndef _DLOGUTIL_ */
865 
866