NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/desktop/udvopen.c |
source navigation diff markup identifier search freetext search file search |
1 /* udvopen.c 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information (NCBI) 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government do not place any restriction on its use or reproduction. 13 * We would, however, appreciate having the NCBI and the author cited in 14 * any work or product based on this material 15 * 16 * Although all reasonable efforts have been taken to ensure the accuracy 17 * and reliability of the software and data, the NLM and the U.S. 18 * Government do not and cannot warrant the performance or results that 19 * may be obtained by using this software or data. The NLM and the U.S. 20 * Government disclaim all warranties, express or implied, including 21 * warranties of performance, merchantability or fitness for any particular 22 * purpose. 23 * 24 * =========================================================================== 25 * 26 * File Name: udvopen.c 27 * 28 * Author: Patrick Durand 29 * 30 * Version Creation Date: 5/3/99 31 * 32 * $Revision: 6.21 $ 33 * 34 * File Description: open/close/choose sequence/file from disk/network 35 * 36 * Modifications: 37 * -------------------------------------------------------------------------- 38 * $Log: udvopen.c,v $ 39 * Revision 6.21 2006/07/13 17:13:18 bollin 40 * use Uint4 instead of Uint2 for itemID values 41 * 42 * Revision 6.20 2000/07/26 17:26:26 lewisg 43 * fix code for c++ inclusion 44 * 45 * Revision 6.19 2000/06/16 14:57:02 lewisg 46 * move entrez calls out of desktop 47 * 48 * Revision 6.18 2000/05/01 21:21:13 lewisg 49 * make features dialogs modal 50 * 51 * Revision 6.17 2000/04/27 22:21:58 lewisg 52 * misc bugs/features 53 * 54 * Revision 6.16 2000/04/13 13:58:03 durand 55 * allowed udv to display reverse complement sequence 56 * 57 * Revision 6.15 2000/04/10 20:33:40 lewisg 58 * fix show/hide for blast multiple, make blast multiple API generic 59 * 60 * Revision 6.14 2000/03/15 19:32:20 lewisg 61 * launch only single udv window 62 * 63 * Revision 6.13 2000/03/06 19:54:40 durand 64 * updated the function AccessionToGi_Entrez 65 * 66 * Revision 6.12 2000/03/02 15:47:51 durand 67 * use MovableModalWindow for dialog boxes 68 * 69 * Revision 6.11 2000/02/16 14:49:39 durand 70 * replace GatherProcLaunch by GatherSpecificProcLaunch 71 * 72 * Revision 6.10 2000/01/11 15:03:19 durand 73 * remove network stuff 74 * 75 * Revision 6.9 2000/01/10 15:18:40 durand 76 * use Entrez instead of ID1 77 * 78 * Revision 6.8 1999/11/29 15:17:55 durand 79 * designed a new GUI; fixed problems under Win95 and Linux 80 * 81 * Revision 6.7 1999/11/19 15:01:48 durand 82 * speed up mouse selection ; avoid sequence flashing during selection ; update menu functionalities 83 * 84 * Revision 6.6 1999/11/09 21:06:59 durand 85 * add sequence selection manager 86 * 87 * Revision 6.5 1999/10/02 15:11:16 durand 88 * update the code to be used by wwwudv 89 * 90 * Revision 6.4 1999/09/07 15:32:39 durand 91 * add BBS and RefSeq to databases list 92 * 93 * Revision 6.3 1999/06/07 15:39:44 durand 94 * add LOG line to keep track of the history 95 * 96 * 97 * 98 * ========================================================================== 99 */ 100 101 #include <udviewer.h> 102 #if 0 103 #include <blast.h> 104 #include <netblap3.h> 105 #endif 106 107 108 typedef struct dlgfileopendata {/*use to manage the FileOpen dialog box*/ 109 WindoW parent; /*main window of the application*/ 110 TexT FNameEditCtrl; /*handle of the file text control*/ 111 ButtoN Ok; /*handle of the Ok button*/ 112 GrouP ReadMode; /*handle of the file type control*/ 113 } DlgFileOpenData, PNTR DlgFileOpenDataPtr; 114 115 116 /*local struct used only by the Download sequence dialog box*/ 117 typedef struct udvnetopen { 118 WindoW hWndMain; /*main window*/ 119 TexT Entry; /*Entrez entry*/ 120 PopuP AccessType; /*database type*/ 121 ButtoN ok; /*ok button*/ 122 UDVMainMenuPtr mmp; /*main menu*/ 123 } UDVNetOpen, PNTR UDVNetOpenPtr; 124 125 /*local struct used only by the Choose sequence dialog box*/ 126 typedef struct udvchooseseq { 127 WindoW hWndMain; /*main window*/ 128 LisT bsp_list; /*listbox of bsps*/ 129 } UDVChooseSeq, PNTR UDVChooseSeqPtr; 130 131 static Char szAppName[]="OneD-Viewer"; 132 133 static Uint1 UDV_DataBaseID[]={ 134 SEQID_GENBANK, 135 SEQID_EMBL, 136 SEQID_PIR, 137 SEQID_SWISSPROT, 138 SEQID_GI, 139 SEQID_DDBJ, 140 SEQID_PRF, 141 SEQID_PDB, 142 SEQID_OTHER,/*RefSeq*/ 143 SEQID_GIBBSQ}; 144 145 146 /******************************************************************************* 147 148 Function : UDV_Init_vdp_struct() 149 150 Purpose : free memory of a bsp 151 152 Parameters : vdp; contains data to delete 153 EraseParaG; TRUE means delete vdp->ParaG 154 EraseMainTitle; TRUE means restore default viewer window name 155 EraseInfoPanel; TRUE means delete content of InfoPanel 156 157 Return value : none 158 159 *******************************************************************************/ 160 NLM_EXTERN void UDV_Init_vdp_struct(PaneL p,ViewerDialogDataPtr vdp, 161 Boolean EraseParaG,Boolean EraseMainTitle,Boolean EraseInfoPanel) 162 { 163 BaR vsb; 164 165 if (!vdp) return; 166 167 if (EraseParaG) UDV_FreeListParaG(&vdp->ParaG); 168 169 MemSet(&vdp->bsp_i,0,sizeof(BspInfo)); 170 171 /*invalid Item selection identifier*/ 172 vdp->Item_select.eIDsel=(Uint2)-1; 173 vdp->Item_select.iIDsel=(Uint2)-1; 174 vdp->Item_select.iTypeSel=(Uint2)-1; 175 vdp->Old_Item_select=vdp->Item_select; 176 177 /*reinit scrollbar*/ 178 vsb = GetSlateVScrollBar ((SlatE)p); 179 CorrectBarMax(vsb,0); 180 CorrectBarValue(vsb,0); 181 CorrectBarPage(vsb,0,0); 182 183 /*reset winmain title*/ 184 if (EraseMainTitle){ 185 if (vdp->Parent) 186 SetTitle(vdp->Parent,szAppName); 187 } 188 189 /*reset infopanel title*/ 190 if (EraseInfoPanel && vdp->InfoPanel) 191 SetTitle(vdp->InfoPanel,"Ready !"); 192 } 193 194 /******************************************************************************* 195 196 Function : SearchBioseq() 197 198 Purpose : store bsps of a SeqEntry 199 200 Parameters : see Toolbox doc ! 201 202 Return value : none 203 204 *******************************************************************************/ 205 NLM_EXTERN Boolean LIBCALLBACK SearchBioseq (BioseqPtr bsp, 206 SeqMgrBioseqContextPtr context) 207 { 208 ValNodePtr PNTR BspTable; 209 210 BspTable=(ValNodePtr PNTR)context->userdata; 211 212 if (bsp) { 213 ValNodeAddInt(BspTable,1, 214 UDV_EncodeIdxFeat(context->entityID,context->itemID)); 215 } 216 217 return(TRUE); 218 } 219 220 221 /******************************************************************************* 222 223 Function : UDV_analyze_SEP_for_open() 224 225 Purpose : analyse a SEP coming form a local SeqEntry file or from Entrez, 226 and find the BSPs. 227 228 Parameters : the_set; SeqEntry to analyze 229 vmp; general data software 230 w; window which has called this function 231 mon; monitor 232 233 Return value : If error, return FALSE. 234 235 *******************************************************************************/ 236 NLM_EXTERN Boolean UDV_analyze_SEP_for_open(FILE *fp,SeqEntryPtr the_set, 237 ViewerMainPtr vmp,WindoW w) 238 { 239 BioseqPtr bsp; 240 Boolean bRet=TRUE,bReadOk=FALSE; 241 Pointer dataptr; 242 Uint2 datatype,entityID,eID; 243 Uint4 iID; 244 MonitorPtr mon; 245 RecT rcP; 246 WindoW temport; 247 248 if (vmp->hFeatDlg){/*Features List Dlg Box*/ 249 SetStatus(vmp->MainMenu.ShowFeatureList,FALSE); 250 Remove(vmp->hFeatDlg); 251 vmp->hFeatDlg=NULL; 252 } 253 /*free data, remove viewer*/ 254 if (vmp->vdp){ 255 UDV_FreeVDPstruct(vmp->vdp,FALSE); 256 257 SetValue(vmp->MainMenu.ScalePosChoice,3); 258 SetStatus(vmp->MainMenu.ShowFeature,TRUE); 259 UDV_set_MainMenus(&vmp->MainMenu,FALSE); 260 UDV_set_MainControls(vmp,FALSE); 261 } 262 if (vmp->BspTable){ 263 ValNodeFree(vmp->BspTable); 264 vmp->BspTable=NULL; 265 vmp->BspChoice=0; 266 } 267 if (vmp->dataptr && vmp->datatype){ 268 ObjMgrFree(vmp->datatype,vmp->dataptr); 269 vmp->datatype=0; 270 vmp->dataptr=NULL; 271 } 272 273 mon = MonitorStrNewEx (szAppName, 30, FALSE); 274 WatchCursor(); 275 276 if (fp!=NULL){/*open a file*/ 277 /*Read the file*/ 278 MonitorStrValue (mon, "Reading ASN.1 file"); 279 Update (); 280 dataptr = ReadAsnFastaOrFlatFile (fp, &datatype, NULL, 281 FALSE, FALSE, FALSE, FALSE); 282 /*register for ObjMgr*/ 283 entityID = ObjMgrRegister (datatype, dataptr); 284 if(datatype == OBJ_SEQSUB || datatype == OBJ_SEQENTRY || 285 datatype == OBJ_BIOSEQ || datatype == OBJ_BIOSEQSET){ 286 bReadOk=TRUE; 287 } 288 } 289 else if (the_set!=NULL){/*retrieve a Network Entry*/ 290 /*a complete verification of sep is done elsewhere; here 291 sep can be only Bioseq or BioseqSet*/ 292 if (IS_Bioseq (the_set)) datatype = OBJ_BIOSEQ; 293 else datatype = OBJ_BIOSEQSET; 294 295 dataptr=(Pointer)the_set->data.ptrvalue; 296 /*register for ObjMgr*/ 297 entityID = ObjMgrRegister (datatype, dataptr); 298 bReadOk=TRUE; 299 300 } 301 302 if (bReadOk){ 303 Boolean bReverse; 304 /*compute the global Feature Index*/ 305 MonitorStrValue (mon, "Building Feature index..."); 306 Update (); 307 if (vmp->vdp) 308 bReverse=vmp->vdp->bDisplayRevComp; 309 else 310 bReverse=FALSE; 311 UDV_CreateOneFeatureIndex(entityID,NULL,bReverse); 312 /*scan the BSPs*/ 313 SeqMgrExploreBioseqs (entityID, NULL, (Pointer) &vmp->BspTable, 314 SearchBioseq, TRUE, TRUE, TRUE); 315 } 316 317 if (vmp->BspTable==NULL){ 318 MonitorFree (mon); 319 ArrowCursor(); 320 Message (MSG_ERROR, "No sequence found in your entry."); 321 bRet=FALSE; 322 goto error; 323 } 324 325 vmp->entityID=entityID; 326 vmp->datatype=datatype; 327 vmp->dataptr=dataptr; 328 329 /*choose the first sequence by default*/ 330 UDV_DecodeIdxFeat ((Uint4)vmp->BspTable->data.intvalue,&eID,&iID); 331 bsp=GetBioseqGivenIDs (eID, iID, OBJ_BIOSEQ); 332 if (bsp){ 333 vmp->BspChoice=1; 334 ArrowCursor(); 335 MonitorFree (mon); 336 vmp->Show_logo=FALSE; 337 if (vmp->UDVprocid!=0){ 338 GatherSpecificProcLaunch(vmp->UDVprocid, "OneD-Viewer", 339 OMPROC_VIEW, FALSE, eID, iID, OBJ_BIOSEQ); 340 } 341 else{ 342 GatherProcLaunch(OMPROC_VIEW, FALSE, eID, iID, OBJ_BIOSEQ, 343 OBJ_BIOSEQ, 0, OBJ_BIOSEQ, 0); 344 } 345 346 temport=SavePort(vmp->hWndMain); 347 Select(vmp->vdp->UnDViewer); 348 ObjectRect(vmp->vdp->UnDViewer,&rcP); 349 InvalRect(&rcP); 350 Update(); 351 RestorePort(temport); 352 } 353 else { 354 MonitorFree (mon); 355 ArrowCursor(); 356 Message (MSG_ERROR, "No sequence found in your file."); 357 bRet=FALSE; 358 } 359 360 error: 361 if (!bRet){/*show the logo in case of error*/ 362 vmp->Show_logo=TRUE; 363 UDV_set_MainMenus(&vmp->MainMenu,FALSE); 364 UDV_set_MainControls(vmp,FALSE); 365 } 366 return (bRet); 367 } 368 369 /******************************************************************************* 370 371 Function : AccessionToGi_Entrez() 372 373 Purpose : given s string, retrieve the UID 374 375 Parameters : string, either a name or an accession number 376 type; entry choosen by the nice user in the dataBase type 377 popup list 378 379 Return value : none 380 381 *******************************************************************************/ 382 static Int4 AccessionToGi_Entrez (CharPtr string,Int2 type) 383 { 384 SeqIdPtr sip; 385 Int4 uid=0; 386 Uint1 Choice; 387 388 sip=(SeqIdPtr)ValNodeNew(NULL); 389 if (!sip) return(0); 390 391 Choice=UDV_DataBaseID[type-1]; 392 393 switch(Choice){ 394 case SEQID_GENBANK: 395 case SEQID_EMBL: 396 case SEQID_PIR: 397 case SEQID_DDBJ: 398 case SEQID_PRF: 399 case SEQID_SWISSPROT: 400 case SEQID_OTHER:{ 401 TextSeqIdPtr tsip; 402 403 tsip=TextSeqIdNew(); 404 if (!tsip) break; 405 sip->data.ptrvalue=(VoidPtr)tsip; 406 sip->choice = Choice; 407 /*try to retrieve an uid; to avoid the user to know whether string 408 is an accession or a name, this function tests both*/ 409 tsip->name=StringSave(string); 410 uid=GetGIForSeqId(sip); 411 if (uid==0){ 412 *tsip->name='\0'; 413 tsip->accession=StringSave(string); 414 } 415 TextSeqIdFree(tsip); 416 break; 417 } 418 case SEQID_GIBBSQ: 419 sip->data.intvalue=(Int4)atoi(string); 420 sip->choice = Choice; 421 uid=GetGIForSeqId(sip); 422 break; 423 case SEQID_GI: 424 if (!StrToLong(string,&uid)) uid=0; 425 break; 426 case SEQID_PDB:{ 427 PDBSeqIdPtr psip; 428 429 psip=PDBSeqIdNew(); 430 if (!psip) break; 431 sip->data.ptrvalue=(VoidPtr)psip; 432 /*type is one of the SEQID_... reported in objloc.h*/ 433 sip->choice = Choice; 434 /*try to retrieve an uid; to avoid the user to know whether string 435 is an accession or a name, this function tests both*/ 436 psip->mol=StringSave(string); 437 psip->chain=0; /* 0 = no chain set. default = 32 */ 438 psip->rel=NULL; 439 uid=GetGIForSeqId(sip); 440 PDBSeqIdFree(psip); 441 break; 442 } 443 } 444 445 ValNodeFree(sip); 446 return(uid); 447 } 448 449 450 /******************************************************************************* 451 452 Function : UDV_NetOpen_okProc() 453 454 Purpose : manage ok button of the Network open dialog box 455 456 Parameters : g; button 457 458 Return value : none 459 460 *******************************************************************************/ 461 static void UDV_NetOpen_okProc(ButtoN g) 462 { 463 WindoW hOpenDlg; 464 UDVNetOpenPtr unop; 465 Char szAccess[50]={""}; 466 Int2 AccessType; 467 Int4 uid=0; 468 ViewerMainPtr vmp; 469 MonitorPtr mon; 470 SeqEntryPtr sep=NULL; 471 Boolean bReadok=FALSE; 472 UdvGlobalsPtr ugp=NULL; 473 474 hOpenDlg=(WindoW)ParentWindow(g); 475 476 if (!hOpenDlg) return; 477 478 unop = (UDVNetOpenPtr) GetObjectExtra (hOpenDlg); 479 480 if (unop==NULL) return; 481 482 vmp = (ViewerMainPtr) GetObjectExtra (unop->hWndMain); 483 if (vmp==NULL) return; 484 485 Hide(hOpenDlg); 486 487 /*retrieve and analyze Accession or Gi*/ 488 GetTitle(unop->Entry, szAccess, sizeof(szAccess)); 489 490 if (StringHasNoText (szAccess)) { 491 Message (MSG_OK, "Please enter an accession number or an entry name"); 492 Show (hOpenDlg); 493 Select (hOpenDlg); 494 Select (unop->Entry); 495 return; 496 } 497 498 AccessType=GetValue(unop->AccessType); 499 WatchCursor(); 500 uid=AccessionToGi_Entrez(szAccess,AccessType); 501 /*Connect ID1 with a valid UID*/ 502 if (uid==0){ 503 ArrowCursor(); 504 Message (MSG_OK, "Unable to find your record in the database."); 505 Show (hOpenDlg); 506 Select (hOpenDlg); 507 Select (unop->Entry); 508 return; 509 } 510 else{ 511 mon = MonitorStrNewEx (szAppName, 30, FALSE); 512 MonitorStrValue (mon, "Retrieving your record..."); 513 Update (); 514 515 ugp=(UdvGlobalsPtr)GetAppProperty("UdvGlobals"); 516 if (ugp && ugp->fetchSepProc) { 517 sep=ugp->fetchSepProc(uid, 0); 518 } 519 520 ArrowCursor(); 521 MonitorFree (mon); 522 if (sep){ 523 if (IS_Bioseq (sep) || IS_Bioseq_set (sep)) bReadok=TRUE; 524 else bReadok=FALSE; 525 } 526 else bReadok=FALSE; 527 528 if (bReadok){ 529 UDV_analyze_SEP_for_open(NULL,sep,vmp,unop->hWndMain); 530 } 531 else{ 532 Message (MSG_OK, "Unable to retrieve your record in the database."); 533 } 534 } 535 536 /*enable main menus and delete Download dlg box*/ 537 UDV_set_PullMenus(unop->mmp,TRUE); 538 Remove(hOpenDlg); 539 } 540 541 /******************************************************************************* 542 543 Function : UDV_NetOpen_cancelProc() 544 545 Purpose : manage ok button of the Network open dialog box 546 547 Parameters : g; button 548 549 Return value : none 550 551 *******************************************************************************/ 552 static void UDV_NetOpen_cancelProc(ButtoN g) 553 { 554 WindoW hOpenDlg; 555 UDVNetOpenPtr unop; 556 557 hOpenDlg=(WindoW)ParentWindow(g); 558 559 if (!hOpenDlg) return; 560 561 unop = (UDVNetOpenPtr) GetObjectExtra (hOpenDlg); 562 563 if (unop==NULL) return; 564 565 /*enable main menus and delete Download dlg box*/ 566 UDV_set_PullMenus(unop->mmp,TRUE); 567 Remove(hOpenDlg); 568 } 569 570 /******************************************************************************* 571 572 Function : UDV_NetOpen_access() 573 574 Purpose : manage Accession edit control of the Download dialog box 575 576 Parameters : t; edit control 577 578 Return value : none 579 580 *******************************************************************************/ 581 static void UDV_NetOpen_access(TexT t) 582 { 583 Char szAccess[50]={""}; 584 WindoW hOpenDlg; 585 UDVNetOpenPtr unop; 586 587 hOpenDlg=(WindoW)ParentWindow(t); 588 589 if (!hOpenDlg) return; 590 591 unop = (UDVNetOpenPtr) GetObjectExtra (hOpenDlg); 592 593 if (unop==NULL) return; 594 595 GetTitle(t, szAccess, sizeof(szAccess)); 596 597 if (StringLen(szAccess) == 0) 598 Disable(unop->ok); 599 else Enable(unop->ok); 600 601 return; 602 } 603 604 /******************************************************************************* 605 606 Function : UDV_NetOpen() 607 608 Purpose : retrieve a file from Download dialog box 609 610 Parameters : g; button 611 612 Return value : none 613 614 *******************************************************************************/ 615 NLM_EXTERN void UDV_NetOpen (IteM i) 616 { 617 GrouP c,g; 618 WindoW w,hWinMain; 619 UDVNetOpenPtr unop; 620 ViewerMainPtr vmp; 621 UdvGlobalsPtr ugp; 622 623 hWinMain=(WindoW)ParentWindow(i); 624 625 if (!hWinMain) return; 626 627 vmp = (ViewerMainPtr) GetObjectExtra (hWinMain); 628 if (vmp==NULL) return; 629 630 /*init the Network, if needed*/ 631 ugp=(UdvGlobalsPtr)GetAppProperty("UdvGlobals"); 632 if (ugp && ugp->NetStartProc){ 633 if (!ugp->NetStartProc(vmp->UseNetwork)) return; 634 } 635 636 w = MovableModalWindow (-50, -33, -10, -10, "Download From NCBI", NULL); 637 638 if (w==NULL) return; 639 640 unop=(UDVNetOpenPtr)MemNew(sizeof(UDVNetOpen)); 641 if (unop==NULL) { 642 Remove(w); 643 return; 644 } 645 unop->hWndMain=hWinMain; 646 647 SetGroupSpacing (w, 10, 10); 648 649 /*accesion*/ 650 g = NormalGroup (w, 3, 0, "Entry", systemFont,NULL); 651 652 #ifdef WIN_MAC 653 unop->AccessType = PopupList (g, TRUE, NULL); 654 #endif 655 656 #ifndef WIN_MAC 657 unop->AccessType = PopupList (g, FALSE, NULL); 658 #endif 659 660 PopupItem(unop->AccessType,"GENBANK"); 661 PopupItem(unop->AccessType,"EMBL"); 662 PopupItem(unop->AccessType,"PIR"); 663 PopupItem(unop->AccessType,"SWISSPROT"); 664 PopupItem(unop->AccessType,"GI number"); 665 PopupItem(unop->AccessType,"DDBJ"); 666 PopupItem(unop->AccessType,"PRF"); 667 PopupItem(unop->AccessType,"PDB"); 668 PopupItem(unop->AccessType,"RefSeq"); 669 PopupItem(unop->AccessType,"BBS"); 670 671 SetValue (unop->AccessType, 6); 672 673 unop->Entry = DialogText (g, "", 10, UDV_NetOpen_access); 674 675 /*retrieve - cancel*/ 676 c = HiddenGroup (w, 4, 0, NULL); 677 SetGroupSpacing (c, 10, 2); 678 unop->ok=DefaultButton (c, "Retrieve", UDV_NetOpen_okProc); 679 Disable (unop->ok); 680 PushButton (c, "Cancel", UDV_NetOpen_cancelProc); 681 682 SetObjectExtra (w, (Pointer) unop, StdCleanupExtraProc); 683 684 /*display*/ 685 AlignObjects (ALIGN_CENTER, (HANDLE) g, (HANDLE) c, NULL); 686 RealizeWindow (w); 687 Show (w); 688 Select (w); 689 Update (); 690 691 /*disable all menus*/ 692 unop->mmp=&vmp->MainMenu; 693 UDV_set_PullMenus(unop->mmp,FALSE); 694 } 695 696 /******************************************************************************* 697 698 Function : UDV_FOpenTextProc() 699 700 Purpose : manage File name edit control of the FileOpen dialog box 701 702 Parameters : t; edit control 703 704 Return value : none 705 706 *******************************************************************************/ 707 static void UDV_FOpenTextProc(TexT t) 708 { 709 Char szFName[PATH_MAX]={""}; 710 WindoW hOpenDlg; 711 DlgFileOpenDataPtr dfodp; 712 713 hOpenDlg=(WindoW)ParentWindow(t); 714 715 if (!hOpenDlg) return; 716 717 dfodp = (DlgFileOpenDataPtr) GetObjectExtra (hOpenDlg); 718 719 if (dfodp==NULL) return; 720 721 GetTitle(t, szFName, sizeof(szFName)-1); 722 723 if (StringLen(szFName) == 0) 724 Disable(dfodp->Ok); 725 else Enable(dfodp->Ok); 726 727 return; 728 } 729 730 /******************************************************************************* 731 732 Function : UDV_FOpenBrowseProc() 733 734 Purpose : manage browse button of the FileOpen dialog box 735 736 Parameters : g; button 737 738 Return value : none 739 740 *******************************************************************************/ 741 static void UDV_FOpenBrowseProc(ButtoN g) 742 { 743 DlgFileOpenDataPtr dfodp; 744 WindoW hOpenDlg; 745 Char path[PATH_MAX]={""}; 746 747 hOpenDlg=(WindoW)ParentWindow(g); 748 749 if (!hOpenDlg) return; 750 751 dfodp = (DlgFileOpenDataPtr) GetObjectExtra (hOpenDlg); 752 753 if (dfodp==NULL) return; 754 if (!dfodp->FNameEditCtrl) return; 755 756 if (GetInputFileName (path, sizeof(path), NULL, NULL)){ 757 SetTitle(dfodp->FNameEditCtrl, path); 758 UDV_FOpenTextProc(dfodp->FNameEditCtrl); 759 } 760 761 return; 762 } 763 764 /******************************************************************************* 765 766 Function : UDV_FOpenCancelProc() 767 768 Purpose : manage cancel button of the FileOpen dialog box 769 770 Parameters : g; button 771 772 Return value : none 773 774 *******************************************************************************/ 775 static void UDV_FOpenCancelProc(ButtoN g) 776 { 777 WindoW hOpenDlg; 778 DlgFileOpenDataPtr dfodp; 779 ViewerMainPtr vmp; 780 781 hOpenDlg=(WindoW)ParentWindow(g); 782 783 if (!hOpenDlg) return; 784 dfodp = (DlgFileOpenDataPtr) GetObjectExtra (hOpenDlg); 785 786 if (dfodp){ 787 vmp = (ViewerMainPtr) GetObjectExtra (dfodp->parent); 788 Enable(vmp->MainMenu.FileOpen); 789 } 790 791 Remove(hOpenDlg); 792 UDV_set_PullMenus(&vmp->MainMenu,TRUE); 793 } 794 795 796 /******************************************************************************* 797 798 Function : UDV_FOpenAcceptProc() 799 800 Purpose : manage ok button of the FileOpen dialog box 801 802 Parameters : g; button 803 804 Return value : none 805 806 *******************************************************************************/ 807 static void UDV_FOpenAcceptProc(ButtoN g) 808 { 809 WindoW hOpenDlg,w; 810 DlgFileOpenDataPtr dfodp; 811 ViewerMainPtr vmp; 812 Char szFName[PATH_MAX]={""}; 813 Boolean isBinary; 814 FILE *fp; 815 UdvGlobalsPtr ugp; 816 817 hOpenDlg=(WindoW)ParentWindow(g); 818 819 if (!hOpenDlg) return; 820 dfodp = (DlgFileOpenDataPtr) GetObjectExtra (hOpenDlg); 821 822 if (dfodp){ 823 w=dfodp->parent; 824 vmp = (ViewerMainPtr) GetObjectExtra (w); 825 if (vmp!=NULL){ 826 /*try to connect Entrez; if failure, still ok : the user can 827 use DDV with a local file. Otherwise he/she will be in trouble ;-)*/ 828 ugp=(UdvGlobalsPtr)GetAppProperty("UdvGlobals"); 829 if (ugp && ugp->NetStartProc){ 830 if (!ugp->NetStartProc(vmp->UseNetwork)) return; 831 } 832 833 Enable(vmp->MainMenu.FileOpen); 834 /*file name*/ 835 GetTitle(dfodp->FNameEditCtrl, szFName, sizeof(szFName)); 836 837 /*file reading mode*/ 838 if (GetValue(dfodp->ReadMode)==2) isBinary=TRUE; 839 else isBinary=FALSE; 840 841 Remove(hOpenDlg); 842 843 /* open the i/o files in the correct mode */ 844 if ((fp = FileOpen (szFName, isBinary?"rb":"r")) == NULL){ 845 Message (MSG_ERROR, "Unable to open your file."); 846 goto error; 847 } 848 849 UDV_analyze_SEP_for_open(fp,NULL,vmp,w); 850 FileClose(fp); 851 } 852 } 853 854 error: 855 UDV_set_PullMenus(&vmp->MainMenu,TRUE); 856 } 857 858 /******************************************************************************* 859 860 Function : UDV_FileOpen() 861 862 Purpose : callback of the File|Open command 863 864 Parameters : i; command item 865 866 Return value : none 867 868 *******************************************************************************/ 869 NLM_EXTERN void UDV_FileOpen(IteM i) 870 { 871 DlgFileOpenDataPtr dfodp; 872 ViewerMainPtr vmp; 873 WindoW hWinMain,hOpenDlg; 874 GrouP g,g4; 875 ButtoN b,b1,b2; 876 TexT t1; 877 878 hWinMain=(WindoW)ParentWindow(i); 879 880 if (!hWinMain) return; 881 882 vmp = (ViewerMainPtr) GetObjectExtra (hWinMain); 883 884 if (vmp==NULL) return; 885 886 dfodp=(DlgFileOpenDataPtr)MemNew(sizeof(DlgFileOpenData)); 887 if (!dfodp) return; 888 MemSet(dfodp,0,sizeof(DlgFileOpenData)); 889 890 hOpenDlg = MovableModalWindow(-30, -20, -10, -10, 891 "OneD-Viewer - Open a local file", NULL); 892 g = NormalGroup(hOpenDlg, 2, 1, "File name:", systemFont, NULL); 893 SetGroupMargins(g, 10, 10); 894 SetGroupSpacing(g, 10, 20); 895 t1 = DialogText(g,"",25, UDV_FOpenTextProc); 896 b = PushButton(g, " browse...", UDV_FOpenBrowseProc); 897 898 g = HiddenGroup(hOpenDlg, 3, 1, NULL); 899 SetGroupMargins(g, 10, 10); 900 SetGroupSpacing(g, 30, 30); 901 902 g4 = NormalGroup(g, 2, 1, "File type", systemFont, NULL); 903 SetGroupMargins(g4, 10, 10); 904 RadioButton(g4, "Ascii"); 905 RadioButton(g4, "Binary"); 906 SetValue(g4, 1); 907 908 b1 = DefaultButton(g, "OK", UDV_FOpenAcceptProc); 909 b2 = PushButton(g, "Cancel", UDV_FOpenCancelProc); 910 911 Disable(b1); 912 913 dfodp->parent=hWinMain; 914 dfodp->FNameEditCtrl=t1; 915 dfodp->Ok=b1; 916 dfodp->ReadMode=g4; 917 918 SetObjectExtra (hOpenDlg, (Pointer) dfodp, StdCleanupExtraProc); 919 920 Select(hOpenDlg); 921 Show(hOpenDlg); 922 923 /*allow only one FOpen dlg at a time*/ 924 UDV_set_PullMenus(&vmp->MainMenu,FALSE); 925 } 926 927 /******************************************************************************* 928 929 Function : UDV_FileClose() 930 931 Purpose : callback of the File|Close command 932 933 Parameters : i; command item 934 935 Return value : none 936 937 *******************************************************************************/ 938 NLM_EXTERN void UDV_FileClose(IteM i) 939 { 940 ViewerMainPtr vmp; 941 WindoW hWinMain; 942 RecT rcP; 943 944 hWinMain=(WindoW)ParentWindow(i); 945 946 if (!hWinMain) return; 947 948 vmp = (ViewerMainPtr) GetObjectExtra (hWinMain); 949 950 if (vmp==NULL) return; 951 952 if (vmp->vdp==NULL) return; 953 954 if (vmp->hFeatDlg){/*Features List Dlg Box*/ 955 SetStatus(vmp->MainMenu.ShowFeatureList,FALSE); 956 Remove(vmp->hFeatDlg); 957 vmp->hFeatDlg=NULL; 958 } 959 960 UDV_FreeVDPstruct(vmp->vdp,FALSE); 961 962 if (vmp->BspTable){ 963 ValNodeFree(vmp->BspTable); 964 vmp->BspTable=NULL; 965 vmp->BspChoice=0; 966 } 967 if (vmp->dataptr && vmp->datatype){ 968 ObjMgrFree(vmp->datatype,vmp->dataptr); 969 vmp->datatype=0; 970 vmp->dataptr=NULL; 971 vmp->entityID=0; 972 } 973 974 /*Update main window title and menus*/ 975 SetValue(vmp->MainMenu.ScalePosChoice,3); 976 SetStatus(vmp->MainMenu.ShowFeature,TRUE); 977 UDV_set_MainMenus(&vmp->MainMenu,FALSE); 978 UDV_set_MainControls(vmp,FALSE); 979 SetTitle(hWinMain,szAppName); 980 SetTitle(vmp->vdp->InfoPanel,"Ready !"); 981 982 vmp->Show_logo=TRUE; 983 Select(vmp->vdp->UnDViewer); 984 Select(vmp->vdp->UnDViewer); 985 ObjectRect(vmp->vdp->UnDViewer,&rcP); 986 InvalRect(&rcP); 987 Update(); 988 } 989 990 /******************************************************************************* 991 992 Function : UDV_CSeq_okProc() 993 994 Purpose : manage ok button of the Choose sequence dialog box 995 996 Parameters : g; button 997 998 Return value : none 999 1000 *******************************************************************************/ 1001 static void UDV_CSeq_okProc(ButtoN g) 1002 { 1003 ViewerDialogDataPtr vdp; 1004 UDVChooseSeqPtr ucsp; 1005 ViewerMainPtr vmp; 1006 Int2 value; 1007 WindoW hOpenDlg,temport; 1008 ValNodePtr vnp; 1009 Uint2 nCompt=1,eID; 1010 Uint4 iID; 1011 BioseqPtr bsp=NULL; 1012 RecT rcP; 1013 Char szBuf[255]={""}; 1014 1015 hOpenDlg=(WindoW)ParentWindow(g); 1016 if (!hOpenDlg) return; 1017 1018 ucsp=(UDVChooseSeqPtr)GetObjectExtra (hOpenDlg); 1019 if (ucsp==NULL) goto error; 1020 1021 vmp = (ViewerMainPtr) GetObjectExtra (ucsp->hWndMain); 1022 if (vmp==NULL) goto error; 1023 1024 UDV_set_PullMenus(&vmp->MainMenu,TRUE); 1025 1026 vdp = vmp->vdp; 1027 if (vdp == NULL) return; 1028 1029 value=GetValue(ucsp->bsp_list);/*one-base value*/ 1030 if (vmp->BspChoice==value) goto error; 1031 1032 /*look for a new bsp*/ 1033 for (vnp=vmp->BspTable ; vnp!=NULL ;vnp=vnp->next){ 1034 if (nCompt==value){ 1035 UDV_DecodeIdxFeat ((Uint4)vnp->data.intvalue,&eID,&iID); 1036 bsp=GetBioseqGivenIDs (eID, iID, OBJ_BIOSEQ); 1037 vmp->BspChoice=value; 1038 break; 1039 } 1040 nCompt++; 1041 } 1042 1043 if (bsp){ 1044 if (vmp->hFeatDlg){/*Features List Dlg Box*/ 1045 SetStatus(vmp->MainMenu.ShowFeatureList,FALSE); 1046 Remove(vmp->hFeatDlg); 1047 vmp->hFeatDlg=NULL; 1048 } 1049 /*free data, remove viewer*/ 1050 UDV_FreeVDPstruct(vmp->vdp,FALSE); 1051 1052 SetValue(vmp->MainMenu.ScalePosChoice,3); 1053 SetStatus(vmp->MainMenu.ShowFeature,TRUE); 1054 UDV_set_MainMenus(&vmp->MainMenu,FALSE); 1055 UDV_set_MainControls(vmp,FALSE); 1056 1057 if (vmp->UDVprocid!=0){ 1058 GatherSpecificProcLaunch(vmp->UDVprocid, "OneD-Viewer", 1059 OMPROC_VIEW, FALSE, eID, iID, OBJ_BIOSEQ); 1060 } 1061 else if (vmp->GVprocid==0){ 1062 SetAppProperty("nonautonomous",(void *)vmp); 1063 GatherSpecificProcLaunch(vmp->UDVprocid, "OneD-Viewer", 1064 OMPROC_VIEW, FALSE, eID, iID, OBJ_BIOSEQ); 1065 RemoveAppProperty("nonautonomous"); 1066 } 1067 else{ 1068 GatherProcLaunch(OMPROC_VIEW, FALSE, eID, iID, OBJ_BIOSEQ, 1069 OBJ_BIOSEQ, 0, OBJ_BIOSEQ, 0); 1070 } 1071 1072 temport=SavePort(ucsp->hWndMain); 1073 Select(vdp->UnDViewer); 1074 ObjectRect(vdp->UnDViewer,&rcP); 1075 sprintf(szBuf,"%s - [%s - %d letters]",szAppName, 1076 vdp->bsp_i.bspAccNum, 1077 vdp->bsp_i.bspLength); 1078 SetTitle(ucsp->hWndMain,szBuf); 1079 InvalRect(&rcP); 1080 Update(); 1081 RestorePort(temport); 1082 } 1083 error: 1084 1085 Remove(hOpenDlg); 1086 } 1087 1088 1089 /******************************************************************************* 1090 1091 Function : UDV_CSeq_cancelProc() 1092 1093 Purpose : manage cancel button of the Choose sequence dialog box 1094 1095 Parameters : g; button 1096 1097 Return value : none 1098 1099 *******************************************************************************/ 1100 static void UDV_CSeq_cancelProc(ButtoN g) 1101 { 1102 WindoW hOpenDlg; 1103 UDVChooseSeqPtr ucsp; 1104 ViewerMainPtr vmp; 1105 1106 hOpenDlg=(WindoW)ParentWindow(g); 1107 if (!hOpenDlg) return; 1108 1109 ucsp=(UDVChooseSeqPtr)GetObjectExtra (hOpenDlg); 1110 if (ucsp==NULL) goto error; 1111 1112 vmp = (ViewerMainPtr) GetObjectExtra (ucsp->hWndMain); 1113 if (vmp==NULL) goto error; 1114 1115 UDV_set_PullMenus(&vmp->MainMenu,TRUE); 1116 1117 error: 1118 1119 Remove(hOpenDlg); 1120 } 1121 1122 /******************************************************************************* 1123 1124 Function : UDV_CreateListBioseqDlg() 1125 1126 Purpose : let the user choose between various bsp 1127 1128 Parameters : i; menu 1129 1130 Return value : none 1131 1132 *******************************************************************************/ 1133 NLM_EXTERN void UDV_CreateListBioseqDlg(IteM i) 1134 { 1135 GrouP g1,h,h1; 1136 LisT lBox; 1137 WindoW d,hWinMain; 1138 ValNodePtr vnp; 1139 BioseqPtr bsp; 1140 Char szName[21]={""}; 1141 Char szBuf[50]={""}; 1142 ViewerMainPtr vmp; 1143 UDVChooseSeqPtr ucsp; 1144 Uint2 eID; 1145 Uint4 iID; 1146 1147 ucsp=(UDVChooseSeqPtr)MemNew(sizeof(UDVChooseSeq)); 1148 if (ucsp==NULL) return; 1149 1150 hWinMain=(WindoW)ParentWindow(i); 1151 1152 if (!hWinMain) return; 1153 1154 vmp = (ViewerMainPtr) GetObjectExtra (hWinMain); 1155 1156 if (vmp==NULL) return; 1157 1158 if (vmp->BspTable==NULL) return; 1159 1160 d=/*DocumentWindow*/Nlm_MovableModalWindow(-50, -33 ,-10, -10, szAppName, NULL/*,NULL*/); 1161 if (d!=NULL){ 1162 UDV_set_PullMenus(&vmp->MainMenu,FALSE); 1163 /*create some controls*/ 1164 h=HiddenGroup(d, 3, 0, NULL); 1165 h1=HiddenGroup(h, 0, 2, NULL); 1166 StaticPrompt(h1,"Choose a sequence :",0,0,systemFont,'l'); 1167 1168 lBox=SingleList(h1,20,6,NULL); 1169 1170 g1=HiddenGroup(h, 0, 2, NULL); 1171 PushButton(g1, "Ok",UDV_CSeq_okProc); 1172 PushButton(g1, "Cancel",UDV_CSeq_cancelProc); 1173 /*fill in the list box*/ 1174 for (vnp=vmp->BspTable ; vnp!=NULL ;vnp=vnp->next){ 1175 UDV_DecodeIdxFeat ((Uint4)vnp->data.intvalue,&eID,&iID); 1176 bsp=GetBioseqGivenIDs (eID, iID, OBJ_BIOSEQ); 1177 if (bsp){ 1178 SeqIdWrite(bsp->id,szName, 1179 PRINTID_TEXTID_ACCESSION,20); 1180 if (szName){ 1181 sprintf(szBuf,"%s (%s)", 1182 szName, 1183 (ISA_na(bsp->mol) ? "nucleic seq.":"protein")); 1184 }else{ 1185 sprintf(szBuf,"Unknown name (%s)", 1186 (ISA_na(bsp->mol) ? "nucleic seq.":"protein")); 1187 } 1188 ListItem(lBox,szBuf); 1189 } 1190 } 1191 SetValue(lBox,vmp->BspChoice); 1192 1193 ucsp->bsp_list=lBox; 1194 ucsp->hWndMain=hWinMain; 1195 SetObjectExtra (d, (Pointer) ucsp, StdCleanupExtraProc); 1196 RealizeWindow(d); 1197 Show(d); 1198 } 1199 } 1200 1201 1202 #if 0 1203 1204 static CharPtr udvprotdbs [] = { 1205 "swissprot", "nr", "pdb", "month", "kabat", "yeast", NULL 1206 }; 1207 1208 1209 static MonitorPtr blastmon = NULL; /* ugh. used below */ 1210 1211 /***************************************************************************** 1212 1213 Function: UDV_BlastCallback 1214 1215 Purpose: creates, updates and deletes blast status dialog 1216 1217 *****************************************************************************/ 1218 static Boolean LIBCALLBACK UDV_BlastCallback (BlastResponse *brp, 1219 Boolean *cancel) 1220 { 1221 BlastProgressPtr bpp; 1222 Int4 completed = 0; 1223 Boolean retval; 1224 1225 *cancel=FALSE; 1226 switch (brp->choice) { 1227 case BlastResponse_start: 1228 if (blastmon != NULL) { 1229 MonitorFree (blastmon); 1230 blastmon = NULL; 1231 } 1232 bpp = (BlastProgressPtr) brp->data.ptrvalue; 1233 if (bpp != NULL) { 1234 completed = bpp->completed; 1235 } 1236 if (completed == 0) { 1237 completed = 100; 1238 } 1239 blastmon = MonitorIntNew ("BLAST", 0, completed); 1240 return TRUE; 1241 case BlastResponse_progress: 1242 if (blastmon != NULL) { 1243 bpp = (BlastProgressPtr) brp->data.ptrvalue; 1244 if (bpp != NULL) { 1245 completed = bpp->completed; 1246 } 1247 retval = MonitorIntValue (blastmon, completed); 1248 if (retval == FALSE) { 1249 *cancel = TRUE; 1250 MonitorFree (blastmon); 1251 blastmon = NULL; 1252 return FALSE; 1253 } 1254 } 1255 return TRUE; 1256 case BlastResponse_queued: 1257 return TRUE; 1258 case BlastResponse_done: 1259 if (blastmon != NULL) { 1260 MonitorFree (blastmon); 1261 blastmon = NULL; 1262 } 1263 return TRUE; 1264 default: 1265 break; 1266 } 1267 return FALSE; 1268 } 1269 1270 /***************************************************************************** 1271 1272 Function: UDV_BlastDlgOK 1273 1274 Purpose: OK button for UDV_BlastDlg 1275 1276 *****************************************************************************/ 1277 static void UDV_BlastDlgOK(ButtoN g) 1278 { 1279 UDV_BlastDlgData *bddp; 1280 Int2 value; 1281 WindoW hOpenDlg; 1282 BLAST_OptionsBlkPtr options; 1283 Int4 i; 1284 ValNode *pvn; 1285 Bioseq* bsp; 1286 BlastNet3Hptr bl3hp; 1287 BlastResponsePtr bl3rp; 1288 Char str[32], *program; 1289 1290 hOpenDlg=(WindoW)ParentWindow(g); 1291 if (!hOpenDlg) return; 1292 1293 bddp=(UDV_BlastDlgData *)GetObjectExtra (hOpenDlg); 1294 if (bddp == NULL) { 1295 ValNodeFree(bddp->pvnSips); 1296 Remove(hOpenDlg); 1297 return; 1298 } 1299 1300 1301 BlastInit("udv 1.0", &bl3hp, &bl3rp); 1302 value = GetValue(bddp->bsp_list); /*one-base value*/ 1303 1304 for(pvn = bddp->pvnSips, i = 1; i != value && pvn != NULL; 1305 i++, pvn = pvn->next); 1306 1307 if(pvn == NULL) { 1308 ValNodeFree(bddp->pvnSips); 1309 Remove(hOpenDlg); 1310 return; 1311 } 1312 1313 bsp = BioseqLockById((SeqId *)pvn->data.ptrvalue); 1314 1315 if(bsp == NULL) { 1316 ValNodeFree(bddp->pvnSips); 1317 Remove(hOpenDlg); 1318 return; 1319 } 1320 1321 if(ISA_aa(bsp->mol)) program = "blastp"; 1322 else program = "blastn"; 1323 1324 options = BLASTOptionNew (program, GetStatus(bddp->bGap)); 1325 GetTitle(bddp->tMax, str, sizeof(str)); 1326 options->hitlist_size = atoi(str); 1327 if (options->hitlist_size == 0) options->hitlist_size = 20; 1328 /* GetTitle(bddp->tExpect, str, sizeof(str)); 1329 options->expect_value = atof(str); 1330 if (options->expect_value == 0.0) options->expect_value = 0.001;*/ 1331 1332 Remove(hOpenDlg); 1333 1334 value = GetValue(bddp->db_list); /*one-base value*/ 1335 1336 bddp->salp = BlastBioseqNet(bl3hp, bsp, program, udvprotdbs[value-1], 1337 options, NULL, NULL, UDV_BlastCallback); 1338 BLASTOptionDelete(options); 1339 BioseqUnlock(bsp); 1340 ValNodeFree(bddp->pvnSips); 1341 if(bddp->salp == NULL) return; 1342 1343 if(bddp->callback) bddp->callback(bddp); 1344 } 1345 1346 /***************************************************************************** 1347 1348 Function: UDV_BlastDlgCancel 1349 1350 Purpose: cancel button for UDV_BlastDlg 1351 1352 *****************************************************************************/ 1353 static void UDV_BlastDlgCancel(ButtoN g) 1354 { 1355 WindoW hOpenDlg; 1356 UDV_BlastDlgData *bddp; 1357 1358 hOpenDlg=(WindoW)ParentWindow(g); 1359 if (!hOpenDlg) return; 1360 1361 bddp = (UDV_BlastDlgData *)GetObjectExtra (hOpenDlg); 1362 if (bddp != NULL) ValNodeFree(bddp->pvnSips); 1363 1364 Remove(hOpenDlg); 1365 } 1366 1367 /***************************************************************************** 1368 1369 Function: UDV_BlastDlg 1370 1371 Purpose: Creates blast many dialog 1372 1373 *****************************************************************************/ 1374 NLM_EXTERN void UDV_BlastDlg(UDV_BlastDlgData *bddp) 1375 { 1376 GrouP h2,h,h1, h3, h4, h5; 1377 WindoW d; 1378 Char szName[21]={""}; 1379 ValNode *pvn; 1380 Int4 i; 1381 1382 if(bddp == NULL) return; 1383 1384 d = MovableModalWindow(-50, -33 ,-10, -10, "Blast", NULL); 1385 if (d != NULL){ 1386 /*create some controls*/ 1387 h = HiddenGroup(d, 1, 5, NULL); 1388 h1 = HiddenGroup(h, 1, 2, NULL); 1389 StaticPrompt(h1,"Choose a sequence :",0,0,systemFont,'l'); 1390 1391 bddp->bsp_list = SingleList(h1,20,6,NULL); 1392 1393 h3 = HiddenGroup(h, 1, 1, NULL); 1394 bddp->bGap = CheckBox(h3, "Gapped", NULL); 1395 SetStatus(bddp->bGap, TRUE); 1396 1397 h4 = HiddenGroup(h, 2, 1, NULL); 1398 /* StaticPrompt(h4,"Expectation value:",0,0,systemFont,'l'); 1399 bddp->tExpect = DialogText(h4, "0.01", 8, (TxtActnProc) NULL); */ 1400 StaticPrompt(h4,"Maximum # of hits:",0,0,systemFont,'l'); 1401 bddp->tMax = DialogText(h4, "20", 5, (TxtActnProc) NULL); 1402 1403 h4 = HiddenGroup (h, 2, 1, NULL); 1404 StaticPrompt (h4, "Choose Database:", 0, 0, programFont, 'c'); 1405 1406 #ifdef WIN_MAC 1407 bddp->db_list = PopupList(h4, TRUE, NULL); 1408 #else 1409 bddp->db_list = PopupList(h4, FALSE, NULL); 1410 #endif 1411 for (i = 0; udvprotdbs [i] != NULL; i++) 1412 PopupItem(bddp->db_list, udvprotdbs [i]); 1413 SetValue(bddp->db_list,1); 1414 1415 h2 = HiddenGroup(h, 2, 1, NULL); 1416 PushButton(h2, "Ok", UDV_BlastDlgOK); 1417 PushButton(h2, "Cancel", UDV_BlastDlgCancel); 1418 1419 h5 = HiddenGroup(h, 1, 1, NULL); 1420 StaticPrompt(h5,"Warning: may take several minutes!",0,0,systemFont,'l'); 1421 1422 /*fill in the list box*/ 1423 for(pvn = bddp->pvnSips; pvn != NULL; pvn = pvn->next) { 1424 SeqIdWrite((SeqId *)pvn->data.ptrvalue,szName, 1425 PRINTID_TEXTID_ACCESSION,20); 1426 ListItem(bddp->bsp_list, szName); 1427 } 1428 SetValue(bddp->bsp_list,1); 1429 1430 SetObjectExtra (d, (Pointer) bddp, StdCleanupExtraProc); 1431 RealizeWindow(d); 1432 Show(d); 1433 } 1434 } 1435 1436 #endif /* 0 */ 1437
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |