1: /* 2: * Generated by the ICS builderXcessory (BX). 3: * 4: * 5: * Builder Xcessory 3.0. 6: * 7: */ 8: #include <Xm/Xm.h> 9: #include <Xm/Text.h> 10: #include <Xm/TextF.h> 11: #include <Xm/ToggleB.h> 12: #include <Xm/FileSB.h> 13: #include <Xm/List.h> 14: #include <X11/keysymdef.h> 15: #include <X11/cursorfont.h> 16: #include <stdio.h> 17: #include<time.h> 18: /* 19: * Standard includes for builtins. 20: */ 21: #include <string.h> 22: #include <ctype.h> 23: #include <math.h> 24: #include <malloc.h> 25: #include "splicer-creation-c.h" 26: #include "splicer_vars.h" 27: /* 28: * Macros to make code look nicer between ANSI and K&R. 29: */ 30: #ifndef ARGLIST 31: #if (NeedFunctionPrototypes == 0) 32: #define PROTOTYPE(p) () 33: #define ARGLIST(p) p 34: #define ARG(a, b) a b; 35: #define GRA(a, b) a b; 36: #define UARG(a, b) a b; 37: #define GRAU(a, b) a b; 38: #else 39: #define PROTOTYPE(p) p 40: #define ARGLIST(p) ( 41: #define ARG(a, b) a b, 42: #define GRA(a, b) a b) 43: #ifdef __cplusplus 44: #define UARG(a, b) a, 45: #define GRAU(a, b) a) 46: #else 47: #define UARG(a, b) a b, 48: #define GRAU(a, b) a b) 49: #endif 50: #endif 51: #endif 52: 53: Widget BxFindTopShell PROTOTYPE((Widget)); 54: WidgetList BxWidgetIdsFromNames PROTOTYPE((Widget, char*, char*)); 55: 56: void XmFileSelectionDoSearch(); 57: 58: 59: /* Function Name: BxExitCB 60: * 61: * Description: This functions expects an integer to be passed in 62: * client data. It calls the exit() system call with 63: * the integer value as the argument to the function. 64: * 65: * Arguments: Widget w: the activating widget. 66: * XtPointer client: the integer exit value. 67: * XtPointer call: the call data (unused). 68: */ 69: 70: /* ARGSUSED */ 71: void 72: BxExitCB ARGLIST((w, client, call)) 73: UARG( Widget, w) 74: ARG( XtPointer, client) 75: GRAU( XtPointer, call) 76: { 77: int exitValue = (int)client; 78: void exit(); 79: 80: SpExit(); 81: exit(exitValue); 82: } 83: 84: /* Function Name: SpDialogCB 85: * 86: * Description: This function causes the named dialog to be 87: * managed and displayed. 88: * 89: * 90: * Arguments: Widget w: the activating widget. 91: * XtPointer client: dialog to manage 92: * XtPointer call: the call data (unused). 93: */ 94: /* ARGSUSED */ 95: void 96: SpDialogCB(w, client, call) 97: Widget w; 98: XtPointer client; 99: XtPointer call; 100: { 101: } 102: 103: 104: /* Function Name: SpOkSaveReportCB 105: * 106: * Description: This function sets up the report file information and 107: * opens the file for use. 108: * 109: * 110: * Arguments: Widget w: the activating widget 111: * XtPointer client: unused 112: * XtPointer call: the call data (unused). 113: */ 114: /* ARGSUSED */ 115: void 116: SpOkSaveReportCB(w, client, call) 117: Widget w; 118: XtPointer client; 119: XtPointer call; 120: { 121: } 122: 123: /* Function Name: BxUnmanageCB 124: * 125: * Description: Given a string of the form: 126: * "(WL)[widgetName, widgetName, ...]" 127: * BxUnmanageCB attempts to convert the name to a Widget 128: * ID and unmanage the widget. 129: * 130: * Arguments: Widget w: the widget activating the callback. 131: * XtPointer client: the list of widget names to attempt 132: * to find and unmanage. 133: * XtPointer call: the call data (unused). 134: * 135: * Notes: * This function expects that there is an application 136: * shell from which all other widgets are descended. 137: */ 138: 139: /* ARGSUSED */ 140: void 141: BxUnmanageCB ARGLIST((w, client, call)) 142: ARG( Widget, w) 143: ARG( XtPointer, client) 144: GRAU( XtPointer, call) 145: { 146: WidgetList widgets; 147: int i; 148: 149: /* 150: * This function returns a NULL terminated WidgetList. The memory for 151: * the list needs to be freed when it is no longer needed. 152: */ 153: widgets = BxWidgetIdsFromNames(w, "BxUnmanageCB", (String)client); 154: 155: i = 0; 156: while( widgets && widgets[i] != NULL ) 157: { 158: XtUnmanageChild(widgets[i]); 159: i++; 160: } 161: XtFree((char *)widgets); 162: } 163: 164: /* Function Name: SpCloseOKCB 165: * 166: * Description: This function closes the selected data files. 167: * 168: * 169: * 170: * Arguments: Widget w: PushButtonCloseOK 171: * XtPointer client: unused 172: * XtPointer call: the call data (unused). 173: */ 174: /* ARGSUSED */ 175: void 176: SpCloseOKCB(w, client, call) 177: Widget w; 178: XtPointer client; 179: XtPointer call; 180: { 181: /*SUPPRESS 594*/ 182: } 183: 184: 185: /* Function Name: SpCloseDataCB 186: * 187: * Description: This function displays the close data file selection 188: * dialog that allows the user to select which of the 189: * open data files to close. 190: * 191: * Arguments: Widget w: pushButtonCloseData 192: * XtPointer client: unused 193: * XtPointer call: the call data (unused). 194: */ 195: /* ARGSUSED */ 196: void 197: SpCloseDataCB(w, client, call) 198: Widget w; 199: XtPointer client; 200: XtPointer call; 201: { 202: /*SUPPRESS 594*/ 203: } 204: 205: /* Function Name: BxManageCB 206: * 207: * Description: Given a string of the form: 208: * "(WL)[widgetName, widgetName, ...]" 209: * BxManageCB attempts to convert the name to a Widget 210: * ID and manage the widget. 211: * 212: * Arguments: Widget w: the widget activating the callback. 213: * XtPointer client: the list of widget names to attempt 214: * to find and manage. 215: * XtPointer call: the call data (unused). 216: * 217: * Notes: * This function expects that there is an application 218: * shell from which all other widgets are descended. 219: */ 220: 221: /* ARGSUSED */ 222: void 223: BxManageCB ARGLIST((w, client, call)) 224: ARG( Widget, w) 225: ARG( XtPointer, client) 226: GRAU( XtPointer, call) 227: { 228: WidgetList widgets; 229: int i; 230: 231: /* 232: * This function returns a NULL terminated WidgetList. The memory for 233: * the list needs to be freed when it is no longer needed. 234: */ 235: widgets = BxWidgetIdsFromNames(w, "BxManageCB", (String)client); 236: 237: i = 0; 238: while( widgets && widgets[i] != NULL ) 239: { 240: XtManageChild(widgets[i]); 241: i++; 242: } 243: XtFree((char *)widgets); 244: 245: } 246: 247: 248: /* Function Name: SpOpenFilterCB 249: * 250: * Description: This function updates the files and directories 251: * in the open data file menu after a new filter 252: * has been set. 253: * 254: * Arguments: Widget w: textOpenFilter 255: * XtPointer client: unused 256: * XtPointer call: the call data (unused). 257: */ 258: /* ARGSUSED */ 259: void 260: SpOpenFilterCB(w, client, call) 261: Widget w; 262: XtPointer client; 263: XtPointer call; 264: { 265: /*SUPPRESS 594*/ 266: SpUpdateOpen(FILE_FILTER); 267: 268: (void)sprintf(preview_input_path,"%s",current_path); 269: } 270: 271: /* Function Name: SpOpenSelectCB 272: * 273: * Description: This functions is called when the select file button 274: * is pressed in the open file dialog. It finds the 275: * selected files in the OpenFiles list and adds them 276: * to the OpenSelected list. A warning is issued if an 277: * attempt is made to add a duplicate file. 278: * 279: * Arguments: Widget w: widget pushButtonOpenSelect. 280: * XtPointer client: the user data (unused). 281: * XtPointer call: the call data (unused). 282: */ 283: /* ARGSUSED */ 284: void 285: SpOpenSelectCB(w, client, call) 286: Widget w; 287: XtPointer client; 288: XtPointer call; 289: { 290: XmString *selected,xmstring,*requested; 291: int item_count,selected_count,i,j,exists=False,count; 292: char *bufptr,*filename; 293: void XmListAddItem(),XmListSetPos(), XmListSetBottomPos(); 294: 295: /*SUPPRESS 594*/ 296: /* get selected items from file list */ 297: (void)XtVaGetValues(listOpenFiles, XmNselectedItemCount,&item_count, 298: XmNselectedItems,&requested, NULL); 299: (void)XtVaGetValues(listOpenSelected, XmNitemCount,&selected_count, 300: XmNitems,&selected, NULL); 301: count=selected_count; 302: /* loop through files. Do not include if it already exists */ 303: if(item_count < 1) { 304: return; 305: } 306: for(i=0;i<item_count;i++) 307: { 308: if(!XmStringGetLtoR(requested[i],XmFONTLIST_DEFAULT_TAG,&filename)) 309: { 310: message.error=True; 311: message.fatal=False; 312: message.caller=NONE; 313: message.type=XmDIALOG_WARNING; 314: message.default_button=XmDIALOG_OK_BUTTON; 315: if((message.label=(char*)calloc(200,CHAR_SIZE))==NULL) 316: SpBadMemAlloc("SpOpenSelectCB 0"); 317: else 318: (void)sprintf(message.label,"Unable to get requested filename from list!"); 319: SpManageMessage(message); 320: } 321: if((charptr=(char*)calloc((int)strlen(filename)+5,CHAR_SIZE))==NULL) 322: SpBadMemAlloc("SpOpenSelectCB 1"); 323: (void)sprintf(charptr,"%s",filename); 324: XtFree(filename); 325: xmstring=XmCvtCTToXmString(charptr); 326: /* check if file is already in selected list, if not add to list*/ 327: for(j=0;j<selected_count && !exists;j++) 328: if(XmStringCompare(xmstring,selected[j])) exists=True; 329: if(!exists) 330: { 331: XmListAddItem(listOpenSelected,xmstring,0); 332: count++; 333: } 334: else 335: { 336: if((bufptr=(char*)calloc((int)strlen(charptr)+50,CHAR_SIZE))==NULL) 337: SpBadMemAlloc("SpOpenSelectCB 2"); 338: (void)sprintf(bufptr,"File %s is already selected!",charptr); 339: SpManageWarningBox(bufptr); 340: free(bufptr); 341: } 342: XmStringFree(xmstring); 343: free(charptr); 344: exists=False; 345: } 346: /* clean up */ 347: XmListSetPos(listOpenSelected,1); 348: XmListDeselectAllItems(listOpenFiles); 349: XmListSetBottomPos(listOpenSelected,count); 350: } 351: 352: /* Function Name: SpOpenDeselectCB 353: * 354: * Description: This function removes the selected name(s) from 355: * the file selected list. 356: * 357: * 358: * Arguments: Widget w: pushButtonOpenDeselect 359: * XtPointer client: the integer exit value. 360: * XtPointer call: the call data (unused). 361: */ 362: /* ARGSUSED */ 363: void 364: SpOpenDeselectCB(w, client, call) 365: Widget w; 366: XtPointer client; 367: XtPointer call; 368: { 369: int position_count; 370: int *ptr_list = NULL; 371: Boolean XmListGetSelectedPos(); 372: void XmListDeletePos(); 373: 374: /* get list of selected file(s) and remove from listOpenSelected */ 375: 376: if(XmListGetSelectedPos(listOpenSelected,&ptr_list,&position_count)) { 377: while(--position_count>=0) 378: (void)XmListDeletePos(listOpenSelected,ptr_list[position_count]); 379: /* clean up area */ 380: if(ptr_list) XtFree((char *)ptr_list); 381: XmListDeselectAllItems(listOpenSelected); 382: } 383: } 384: 385: /* Function Name: SpOpenDirectoriesCB 386: * 387: * Description: This function updates the files and directories 388: * in the open data file menu after a new directory 389: * has been selected. 390: * 391: * Arguments: Widget w: listOpenDirectories 392: * XtPointer client: unused 393: * XtPointer call: the call data (unused). 394: */ 395: /* ARGSUSED */ 396: void 397: SpOpenDirectoriesCB(w, client, call) 398: Widget w; 399: XtPointer client; 400: XtPointer call; 401: { 402: /*SUPPRESS 594*/ 403: SpUpdateOpen(DIRECTORIES); 404: 405: (void)sprintf(preview_input_path,"%s",current_path); 406: } 407: 408: /* Function Name: SPOpenAffineCB 409: * 410: * Description: This function gets the current affine table values and 411: * opens a file selection dialog for affine table. 412: * 413: * Arguments: Widget w: the activating widget. 414: * XtPointer client: unused 415: * XtPointer call: the call data (unused). 416: */ 417: /* ARGSUSED */ 418: void 419: SpOpenAffineCB(w, client, call) 420: Widget w; 421: XtPointer client; 422: XtPointer call; 423: { 424: /*SUPPRESS 594*/ 425: 426: XmToggleButtonSetState(toggleButtonUseAffine,affine.usetable,FALSE); 427: XmToggleButtonSetState(toggleButtonNotUseAffine,!affine.usetable,FALSE); 428: if(affine.usetable == True) { 429: if((charptr=(char*)calloc((int)strlen(affine.filename)+5,CHAR_SIZE))==NULL) 430: SpBadMemAlloc("SpOpenAffineCB 1"); 431: (void)sprintf(charptr,"%s",affine.filename); 432: XmTextSetString(textFieldAffineFileName,charptr); 433: free(charptr); 434: XtSetSensitive(pushButtonSelectAffineFileName, True); 435: } 436: else { 437: XmTextSetString(textFieldAffineFileName,""); 438: XtSetSensitive(pushButtonSelectAffineFileName, False); 439: } 440: XtManageChild(formUseAffine); 441: } 442: 443: /* Function Name: SpCancelCB 444: * 445: * Description: This function is called by the cancel buttons in th 446: * splicer application. Different actions are taken depending 447: * on which widget has initiated the cancel. 448: * 449: * Arguments: Widget w: the activating widget. 450: * XtPointer client: form to close 451: * XtPointer call: the call data (unused). 452: */ 453: /* ARGSUSED */ 454: void 455: SpCancelCB(w, client, call) 456: Widget w; 457: XtPointer client; 458: XtPointer call; 459: { 460: XmString xmstring; 461: char *ctstring; 462: char cflag[200]; 463: int i; 464: 465: /*SUPPRESS 594*/ 466: /* close widget */ 467: Widget *closewidget = (Widget*)client; 468: XtUnmanageChild(*closewidget); 469: 470: /* change values if necessary */ 471: if(*closewidget==messageBoxWorking) 472: { 473: XtVaGetValues(*closewidget,XmNmessageString,&xmstring,NULL); 474: if(!XmStringGetLtoR(xmstring,XmFONTLIST_DEFAULT_TAG,&ctstring)) 475: { 476: message.error=True; 477: message.fatal=False; 478: message.caller=NONE; 479: message.type=XmDIALOG_WARNING; 480: message.default_button=XmDIALOG_OK_BUTTON; 481: if((message.label=(char*)calloc(200,CHAR_SIZE))==NULL) 482: SpBadMemAlloc("SpCanceCB 1"); 483: else 484: (void)sprintf(message.label,"Unable to get message from working box"); 485: SpManageMessage(message); 486: } 487: (void)sscanf(ctstring,"%s",cflag); 488: XtFree(ctstring); 489: for(i=0;i<NUM_CLEANUP_TYPES && (int)strcmp(cflag,cleanup_type[i]);i++); 490: if(i<NUM_CLEANUP_TYPES) 491: SpCleanUp(i); 492: SpManageWarningBox("Clean-up after halt attempted. Program may be unstable."); 493: XtRemoveWorkProc(work_id); 494: } 495: if(*closewidget==formOpen) { 496: open_dataform_is_up = NO; 497: } 498: } 499: 500: 501: /* Function Name: SpSmoothMethodsCB 502: * 503: * Description: This function is called when the data smoothing option 504: * is changed. It sets up the smoothing dialog properly for 505: * the selected method. 506: * 507: * Arguments: Widget w: a smooth method toggle button 508: * XtPointer client: none 509: * XtPointer call: the call data (unused). 510: */ 511: /* ARGSUSED */ 512: void 513: SpSmoothMethodsCB(w, client, call) 514: Widget w; 515: XtPointer client; 516: XtPointer call; 517: { 518: if(XmToggleButtonGetState(toggleButtonSmoothNone)) /* no filter */ 519: { 520: XmToggleButtonSetState(toggleButtonUnsmoothOnly,TRUE,FALSE); 521: XmToggleButtonSetState(toggleButtonSmoothOnly,FALSE,FALSE); 522: XmToggleButtonSetState(toggleButtonSmoothBoth,FALSE,FALSE); 523: XtSetSensitive(toggleButtonSmoothOnly,FALSE); 524: XtSetSensitive(toggleButtonSmoothBoth,FALSE); 525: XtSetSensitive(textFieldSmoothWidth,FALSE); 526: XtSetSensitive(optionMenuWidthUnits,FALSE); 527: 528: XmToggleButtonSetState(toggleButtonPlotUnsmooth, True, NULL); 529: XmToggleButtonSetState(toggleButtonPlotSmooth, False, NULL); 530: XmToggleButtonSetState(toggleButtonPlotBoth, False, NULL); 531: XtSetSensitive(toggleButtonPlotSmooth,FALSE); 532: XtSetSensitive(toggleButtonPlotUnsmooth,FALSE); 533: XtSetSensitive(toggleButtonPlotBoth,FALSE); 534: } 535: if(XmToggleButtonGetState(toggleButtonSmoothGaussian)) /* use gaussian filter */ 536: { 537: XmToggleButtonSetState(toggleButtonUnsmoothOnly,FALSE,FALSE); 538: XmToggleButtonSetState(toggleButtonSmoothOnly,FALSE,FALSE); 539: XmToggleButtonSetState(toggleButtonSmoothBoth,TRUE,FALSE); 540: XtSetSensitive(toggleButtonSmoothOnly,TRUE); 541: XtSetSensitive(toggleButtonSmoothBoth,TRUE); 542: XtSetSensitive(textFieldSmoothWidth,TRUE); 543: XtSetSensitive(optionMenuWidthUnits,TRUE); 544: 545: XmToggleButtonSetState(toggleButtonPlotUnsmooth, False, NULL); 546: XmToggleButtonSetState(toggleButtonPlotSmooth, False, NULL); 547: XmToggleButtonSetState(toggleButtonPlotBoth, True, NULL); 548: XtSetSensitive(toggleButtonPlotSmooth,TRUE); 549: XtSetSensitive(toggleButtonPlotUnsmooth,TRUE); 550: XtSetSensitive(toggleButtonPlotBoth,TRUE); 551: } 552: else if(XmToggleButtonGetState(toggleButtonSmoothOther)) /* use other filter */ 553: { 554: /* this option is not active, it sets the "none" option instead and 555: warns the user */ 556: XmToggleButtonSetState(toggleButtonSmoothOther,FALSE,FALSE); 557: XmToggleButtonSetState(toggleButtonSmoothNone,TRUE,FALSE); 558: XmToggleButtonSetState(toggleButtonUnsmoothOnly,TRUE,FALSE); 559: XmToggleButtonSetState(toggleButtonSmoothOnly,FALSE,FALSE); 560: XmToggleButtonSetState(toggleButtonSmoothBoth,FALSE,FALSE); 561: XtSetSensitive(toggleButtonSmoothOnly,FALSE); 562: XtSetSensitive(toggleButtonSmoothBoth,FALSE); 563: XtSetSensitive(textFieldSmoothWidth,FALSE); 564: XtSetSensitive(optionMenuWidthUnits,FALSE); 565: 566: XmToggleButtonSetState(toggleButtonPlotUnsmooth, True, NULL); 567: XmToggleButtonSetState(toggleButtonPlotSmooth, False, NULL); 568: XmToggleButtonSetState(toggleButtonPlotBoth, False, NULL); 569: XtSetSensitive(toggleButtonPlotSmooth,FALSE); 570: XtSetSensitive(toggleButtonPlotUnsmooth,FALSE); 571: XtSetSensitive(toggleButtonPlotBoth,FALSE); 572: 573: if((message.label=(char*)calloc(100,CHAR_SIZE))==NULL) 574: SpBadMemAlloc("Sp"); 575: (void)sprintf(message.label,"This Option is incomplete."); 576: SpManageMessage(message); 577: } 578: } 579: 580: 581: /* Function Name: SpOpenSmoothCB 582: * 583: * Description: This function sets up and manages the smoothing 584: * information dialog. 585: * 586: * Arguments: Widget w: pushButtonOpenSmooth 587: * XtPointer client: unused 588: * XtPointer call: the call data (unused). 589: */ 590: /* ARGSUSED */ 591: void 592: SpOpenSmoothCB(w, client, call) 593: Widget w; 594: XtPointer client; 595: XtPointer call; 596: { 597: /*SUPPRESS 594*/ 598: /* get current default values and set them in dialog */ 599: /* smoothing methods */ 600: if(smooth.method==NONE) 601: { 602: XmToggleButtonSetState(toggleButtonSmoothNone,TRUE,FALSE); 603: XmToggleButtonSetState(toggleButtonSmoothGaussian,FALSE,FALSE); 604: XmToggleButtonSetState(toggleButtonSmoothOther,FALSE,FALSE); 605: XtSetSensitive(textFieldSmoothWidth,FALSE); 606: XtSetSensitive(optionMenuWidthUnits,FALSE); 607: XtSetSensitive(toggleButtonSmoothOnly,FALSE); 608: XtSetSensitive(toggleButtonSmoothBoth,FALSE); 609: 610: XtSetSensitive(toggleButtonPlotSmooth,FALSE); 611: XtSetSensitive(toggleButtonPlotUnsmooth,FALSE); 612: XtSetSensitive(toggleButtonPlotBoth,FALSE); 613: } 614: else if(smooth.method==GAUSSIAN) 615: { 616: XmToggleButtonSetState(toggleButtonSmoothNone,FALSE,FALSE); 617: XmToggleButtonSetState(toggleButtonSmoothGaussian,TRUE,FALSE); 618: XmToggleButtonSetState(toggleButtonSmoothOther,FALSE,FALSE); 619: XtSetSensitive(textFieldSmoothWidth,TRUE); 620: XtSetSensitive(optionMenuWidthUnits,TRUE); 621: XtSetSensitive(toggleButtonSmoothBoth,TRUE); 622: XtSetSensitive(toggleButtonSmoothOnly,TRUE); 623: 624: XtSetSensitive(toggleButtonPlotSmooth,TRUE); 625: XtSetSensitive(toggleButtonPlotUnsmooth,TRUE); 626: XtSetSensitive(toggleButtonPlotBoth,TRUE); 627: } 628: else if (smooth.method==OTHER) 629: { 630: /* remember that this doesn't exist, use NONE instead */ 631: XmToggleButtonSetState(toggleButtonSmoothNone,TRUE,FALSE); 632: XmToggleButtonSetState(toggleButtonSmoothGaussian,FALSE,FALSE); 633: XmToggleButtonSetState(toggleButtonSmoothOther,FALSE,FALSE); 634: XtSetSensitive(textFieldSmoothWidth,FALSE); 635: XtSetSensitive(optionMenuWidthUnits,FALSE); 636: XtSetSensitive(toggleButtonSmoothOnly,FALSE); 637: XtSetSensitive(toggleButtonSmoothBoth,FALSE); 638: 639: XtSetSensitive(toggleButtonPlotSmooth,FALSE); 640: XtSetSensitive(toggleButtonPlotUnsmooth,FALSE); 641: XtSetSensitive(toggleButtonPlotBoth,FALSE); 642: } 643: else 644: SpManageWarningBox("Invalid Smoothing method used!"); 645: /* plot display choice */ 646: if(smooth.plot==UNSMOOTHED) 647: { 648: XmToggleButtonSetState(toggleButtonUnsmoothOnly,TRUE,FALSE); 649: XmToggleButtonSetState(toggleButtonSmoothBoth,FALSE,FALSE); 650: XmToggleButtonSetState(toggleButtonSmoothOnly,FALSE,FALSE); 651: 652: XmToggleButtonSetState(toggleButtonPlotUnsmooth,TRUE,NULL); 653: XmToggleButtonSetState(toggleButtonPlotSmooth,FALSE,NULL); 654: XmToggleButtonSetState(toggleButtonPlotBoth,FALSE,NULL); 655: } 656: else if(smooth.plot==SMOOTHED) 657: { 658: XmToggleButtonSetState(toggleButtonUnsmoothOnly,FALSE,FALSE); 659: XmToggleButtonSetState(toggleButtonSmoothBoth,FALSE,FALSE); 660: XmToggleButtonSetState(toggleButtonSmoothOnly,TRUE,FALSE); 661: 662: XmToggleButtonSetState(toggleButtonPlotUnsmooth,FALSE,NULL); 663: XmToggleButtonSetState(toggleButtonPlotSmooth,TRUE,NULL); 664: XmToggleButtonSetState(toggleButtonPlotBoth,FALSE,NULL); 665: } 666: else if(smooth.plot==SMOOTHEDBOTH) 667: { 668: XmToggleButtonSetState(toggleButtonUnsmoothOnly,FALSE,FALSE); 669: XmToggleButtonSetState(toggleButtonSmoothBoth,TRUE,FALSE); 670: XmToggleButtonSetState(toggleButtonSmoothOnly,FALSE,FALSE); 671: 672: XmToggleButtonSetState(toggleButtonPlotUnsmooth,FALSE,NULL); 673: XmToggleButtonSetState(toggleButtonPlotSmooth,FALSE,NULL); 674: XmToggleButtonSetState(toggleButtonPlotBoth,TRUE,NULL); 675: } 676: else 677: SpManageWarningBox("Invalid smoothing display option found!"); 678: /* smoothing options */ 679: if(smooth.width_units==DEPTH) 680: XtVaSetValues(optionMenuWidthUnits,XmNmenuHistory,pushButtonUnitsDepth,NULL); 681: else if(smooth.width_units==POINTS) 682: XtVaSetValues(optionMenuWidthUnits,XmNmenuHistory,pushButtonUnitsPoints,NULL); 683: else 684: SpManageWarningBox("Invalid smoothing units supplied."); 685: if((charptr=(char*)calloc(20,CHAR_SIZE))==NULL) 686: SpBadMemAlloc("SpOpenSmoothCB 1"); 687: (void)sprintf(charptr,"%d",smooth.width); 688: XmTextSetString(textFieldSmoothWidth,charptr); 689: free(charptr); 690: /* manage dialog */ 691: XtManageChild(formSmooth); 692: } 693: 694: /* Function Name: SpSmoothOKCB 695: * 696: * Description: This function saves the user selected smoothing 697: * values and unmanages the smoothing dialog. 698: * 699: * 700: * Arguments: Widget w: pushButtonSmoothOK 701: * XtPointer client: none 702: * XtPointer call: the call data (unused). 703: */ 704: /* ARGSUSED */ 705: void 706: SpSmoothOKCB(w, client, call) 707: Widget w; 708: XtPointer client; 709: XtPointer call; 710: { 711: int i; 712: Widget tmp_widget; 713: XmString xmstring; 714: Cursor cursor; 715: void SmoothData(), DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 716: 717: /*SUPPRESS 594*/ 718: /* get smooth method */ 719: if(XmToggleButtonGetState(toggleButtonSmoothNone)){ 720: smooth.method=NONE; 721: XtSetSensitive(toggleButtonPlotSmooth,FALSE); 722: XtSetSensitive(toggleButtonPlotUnsmooth,FALSE); 723: XtSetSensitive(toggleButtonPlotBoth,FALSE); 724: } 725: else if(XmToggleButtonGetState(toggleButtonSmoothGaussian)){ 726: smooth.method=GAUSSIAN; 727: XtSetSensitive(toggleButtonPlotSmooth,TRUE); 728: XtSetSensitive(toggleButtonPlotUnsmooth,TRUE); 729: XtSetSensitive(toggleButtonPlotBoth,TRUE); 730: } 731: else if(XmToggleButtonGetState(toggleButtonSmoothOther)){ 732: smooth.method=OTHER; 733: XtSetSensitive(toggleButtonPlotSmooth,FALSE); 734: XtSetSensitive(toggleButtonPlotUnsmooth,FALSE); 735: XtSetSensitive(toggleButtonPlotBoth,FALSE); 736: } 737: /* get plot display */ 738: if(XmToggleButtonGetState(toggleButtonUnsmoothOnly)){ 739: smooth.plot=UNSMOOTHED; 740: XmToggleButtonSetState(toggleButtonPlotUnsmooth,TRUE,NULL); 741: XmToggleButtonSetState(toggleButtonPlotSmooth,FALSE,NULL); 742: XmToggleButtonSetState(toggleButtonPlotBoth,FALSE,NULL); 743: } 744: else if(XmToggleButtonGetState(toggleButtonSmoothOnly)){ 745: smooth.plot=SMOOTHED; 746: XmToggleButtonSetState(toggleButtonPlotUnsmooth,FALSE,NULL); 747: XmToggleButtonSetState(toggleButtonPlotSmooth,TRUE,NULL); 748: XmToggleButtonSetState(toggleButtonPlotBoth,FALSE,NULL); 749: } 750: else if(XmToggleButtonGetState(toggleButtonSmoothBoth)){ 751: smooth.plot=SMOOTHEDBOTH; 752: XmToggleButtonSetState(toggleButtonPlotUnsmooth,FALSE,NULL); 753: XmToggleButtonSetState(toggleButtonPlotSmooth,FALSE,NULL); 754: XmToggleButtonSetState(toggleButtonPlotBoth,TRUE,NULL); 755: } 756: /* get width units */ 757: XtVaGetValues(optionMenuWidthUnits,XmNmenuHistory,&tmp_widget,NULL); 758: if(tmp_widget==pushButtonUnitsDepth) 759: smooth.width_units=DEPTH; 760: else if(tmp_widget==pushButtonUnitsPoints) 761: smooth.width_units=POINTS; 762: /* get width */ 763: charptr=XmTextGetString(textFieldSmoothWidth); 764: smooth.width = atoi(charptr); 765: XtFree(charptr); 766: if(smooth.method != NONE && (smooth.width <= 0 || 767: (smooth.width_units == DEPTH && smooth.width > MAXSMOOTHWIDTHDEPTH) || 768: (smooth.width_units == POINTS && smooth.width > MAXSMOOTHWIDTHPOINTS))) { 769: SpManageWarningBox("The width of the filter is unreasonable. Please re-enter."); 770: smooth.method = NONE; 771: return; 772: } 773: else if(smooth.method != NONE && smooth.width_units == POINTS && smooth.width < MINSMOOTHWIDTH) { 774: if((charptr=(char*)calloc(150,CHAR_SIZE))==NULL) 775: SpBadMemAlloc("SpSmoothOKCB"); 776: (void)sprintf(charptr, "The width of the filter is too small. Please create a filter as wide or wider than %d pts.", 777: MINSMOOTHWIDTH); 778: SpManageWarningBox(charptr); 779: free(charptr); 780: smooth.method = NONE; 781: return; 782: } 783: else if(have_data == DO && smooth.method != NONE && smooth.width_units == DEPTH && 784: smooth.width < MINSMOOTHWIDTH * average_depth_step) { 785: if((charptr=(char*)calloc(150,CHAR_SIZE))==NULL) 786: SpBadMemAlloc("SpSmoothOKCB"); 787: (void)sprintf(charptr, "The width of the filter is too small. Please create a filter as wide or wider than %d cms.", 788: MINSMOOTHWIDTH * average_depth_step); 789: SpManageWarningBox(charptr); 790: free(charptr); 791: smooth.method = NONE; 792: return; 793: } 794: if(smooth.method==NONE) 795: xmstring=XmCvtCTToXmString("No Smooth..."); 796: else 797: xmstring=XmCvtCTToXmString("Smooth..."); 798: XtVaSetValues(pushButtonOpenSmooth,XmNlabelString,xmstring,NULL); 799: XmStringFree(xmstring); 800: /* unmanage dialog */ 801: XtUnmanageChild(formSmooth); 802: 803: if(smooth.method != NONE && open_dataform_is_up == NO && have_data == DO) { 804: 805: cursor = XCreateFontCursor(XtDisplay(formSplicer), XC_watch); 806: if(cursor != BadAlloc && cursor != BadFont && cursor != BadValue) { 807: XDefineCursor(XtDisplay(formSplicer), XtWindow(formSplicer), cursor); 808: } 809: for(i=0; i<dataset_cnt; ++i) { 810: SmoothData(i); 811: } 812: if(cursor) { 813: XUndefineCursor(XtDisplay(formSplicer), XtWindow(formSplicer)); 814: XFreeCursor(XtDisplay(formSplicer), cursor); 815: } 816: 817: if(XtIsManaged(XtParent(drawingAreaEdit))) { 818: reason_for_redraw = DRAW_EVERYTHING; 819: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 820: } 821: if(have_splice == DO) { 822: if(XtIsManaged(XtParent(drawingAreaView))) { 823: reason_for_redraw = DRAW_EVERYTHING; 824: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 825: } 826: if(are_agemodelling == YES) { 827: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 828: reason_for_redraw = DRAW_EVERYTHING; 829: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 830: } 831: } 832: } 833: } 834: } 835: 836: /* Function Name: SpDecimateOKCB 837: * 838: * Description: This function saves the decimation options and 839: * closes the dialog. 840: * 841: * 842: * Arguments: Widget w: pushButtonDecimateOK 843: * XtPointer client: unused 844: * XtPointer call: the call data (unused). 845: */ 846: /* ARGSUSED */ 847: void 848: SpDecimateOKCB(w, client, call) 849: Widget w; 850: XtPointer client; 851: XtPointer call; 852: { 853: int i; 854: XmString xmstring; 855: Cursor cursor; 856: void DecimateData(), DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 857: 858: charptr=XmTextGetString(textFieldDecimate); 859: decimate_value = atoi(charptr); 860: 861: if(decimate_value>1) 862: xmstring=XmCvtCTToXmString("Decimate..."); 863: else 864: xmstring=XmCvtCTToXmString("No Decimate..."); 865: XtVaSetValues(pushButtonOpenDecimate,XmNlabelString,xmstring,NULL); 866: XmStringFree(xmstring); 867: /* unmanage dialog */ 868: XtUnmanageChild(formDecimate); 869: 870: /* if open_dataform_is_up == No then open data dialog is not up 871: therfore event came from progress menu, data menu decimate button push 872: */ 873: if(open_dataform_is_up == NO && have_data == DO) { 874: cursor = XCreateFontCursor(XtDisplay(formSplicer), XC_watch); 875: if(cursor != BadAlloc && cursor != BadFont && cursor != BadValue) { 876: XDefineCursor(XtDisplay(formSplicer), XtWindow(formSplicer), cursor); 877: } 878: 879: data[dset]->decimate_value = decimate_value; 880: DecimateData(dset, data[dset]->decimate_value); 881: 882: if(cursor) { 883: XUndefineCursor(XtDisplay(formSplicer), XtWindow(formSplicer)); 884: XFreeCursor(XtDisplay(formSplicer), cursor); 885: } 886: 887: if(XtIsManaged(XtParent(drawingAreaEdit))) { 888: reason_for_redraw = DRAW_EVERYTHING; 889: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 890: } 891: if(have_splice == DO) { 892: if(XtIsManaged(XtParent(drawingAreaView))) { 893: reason_for_redraw = DRAW_EVERYTHING; 894: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 895: } 896: if(are_agemodelling == YES) { 897: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 898: reason_for_redraw = DRAW_EVERYTHING; 899: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 900: } 901: } 902: } 903: } 904: } 905: 906: /* Function Name: SpOpenDecimateCB 907: * 908: * Description: This function displays the decimation options. 909: * 910: * 911: * 912: * Arguments: Widget w: pushButtonOpenDecimate 913: * XtPointer client: unused 914: * XtPointer call: the call data (unused). 915: */ 916: /* ARGSUSED */ 917: void 918: SpOpenDecimateCB(w, client, call) 919: Widget w; 920: XtPointer client; 921: XtPointer call; 922: { 923: /*SUPPRESS 594*/ 924: /* set values and display form */ 925: if((charptr=(char*)calloc(20,CHAR_SIZE))==NULL) 926: SpBadMemAlloc("SpOpenDecimateCB 1"); 927: if(open_dataform_is_up == NO && have_data == DO) { 928: (void)sprintf(charptr,"%d", data[dset]->decimate_value); 929: } 930: else { 931: (void)sprintf(charptr,"%d",decimate_value); 932: } 933: XmTextSetString(textFieldDecimate,charptr); 934: free(charptr); 935: XtManageChild(formDecimate); 936: } 937: 938: /* Function Name: SpUseAffineOKCB 939: * 940: * Description: This function saves the affine table defaults. 941: * 942: * Arguments: Widget w: pushButtonuseAffineOK 943: * XtPointer client: unused 944: * XtPointer call: the call data (unused). 945: */ 946: /* ARGSUSED */ 947: void 948: SpUseAffineOKCB(w, client, call) 949: Widget w; 950: XtPointer client; 951: XtPointer call; 952: { 953: char *testfile; 954: int readable; 955: XmString xmstring; 956: int VerifyFileReadable(); 957: 958: /*SUPPRESS 594*/ 959: if((affine.usetable=XmToggleButtonGetState(toggleButtonUseAffine))) 960: { 961: testfile = XmTextGetString(textFieldAffineFileName); 962: readable = VerifyFileReadable(testfile, OPEN, OPENAFFINE); 963: if(readable == NO) { 964: (void)sprintf(buffer,"Affine table name %s is not a readable file.",testfile); 965: free(testfile); 966: XmToggleButtonSetState(toggleButtonUseAffine, False, False); 967: XmToggleButtonSetState(toggleButtonNotUseAffine, True, False); 968: affine.usetable = False; 969: XmTextSetString(textFieldAffineFileName,""); 970: SpManageWarningBox(buffer); 971: return; 972: } 973: else { 974: XtFree(affine.filename); 975: if((affine.filename=(char*)calloc((int)strlen(testfile)+10, CHAR_SIZE)) == NULL) { 976: SpBadMemAlloc("SpUseAffineOKCB"); 977: } 978: (void)sprintf(affine.filename, "%s", testfile); 979: *strrchr(testfile,'/')= '\0'; 980: if((affine.dirname=(char*)calloc((int)strlen(testfile)+10, CHAR_SIZE)) == NULL) { 981: SpBadMemAlloc("SpUseAffineOKCB"); 982: } 983: (void)sprintf(affine.dirname, "%s", testfile); 984: free(testfile); 985: } 986: 987: xmstring=XmCvtCTToXmString("Use Affine..."); 988: } 989: else 990: { 991: xmstring=XmCvtCTToXmString("Don't Use Affine..."); 992: affine.usetable = False; 993: } 994: XtVaSetValues(pushButtonOpenAffine,XmNlabelString,xmstring,NULL); 995: XmStringFree(xmstring); 996: XtUnmanageChild(formUseAffine); 997: } 998: 999: /* Function Name: SpUseAffineCB 1000: * 1001: * Description: This function is called when the user has changed the 1002: * use affine table value. 1003: * 1004: * 1005: * Arguments: Widget w: toggleButtonUseAffine 1006: * XtPointer client: unused 1007: * XtPointer call: toggle button return. 1008: */ 1009: /* ARGSUSED */ 1010: void 1011: SpUseAffineCB(w, client, call) 1012: Widget w; 1013: XtPointer client; 1014: XtPointer call; 1015: { 1016: /*SUPPRESS 594*/ 1017: /* if Use affine is set, display file selection Dialog for Affine 1018: */ 1019: XmToggleButtonCallbackStruct *toggle_info=(XmToggleButtonCallbackStruct *) call; 1020: affine.usetable = True; 1021: if(toggle_info->set) { 1022: if((charptr=(char*)calloc((int)strlen(affine.filename)+5,CHAR_SIZE))==NULL) 1023: SpBadMemAlloc("SpOpenAffineCB 1"); 1024: (void)sprintf(charptr,"%s",affine.filename); 1025: XmTextSetString(textFieldAffineFileName,charptr); 1026: free(charptr); 1027: XtSetSensitive(pushButtonSelectAffineFileName, True); 1028: } 1029: } 1030: 1031: /* Function Name: SpCullOKCB 1032: * 1033: * Description: This function saves the culling options and closes the 1034: * dialog box. 1035: * 1036: * 1037: * Arguments: Widget w: pushButtonCullOK 1038: * XtPointer client: unused 1039: * XtPointer call: the call data (unused). 1040: */ 1041: /* ARGSUSED */ 1042: void 1043: SpCullOKCB(w, client, call) 1044: Widget w; 1045: XtPointer client; 1046: XtPointer call; 1047: { 1048: char *testfile; 1049: XmString xmstring; 1050: String cstring; 1051: int tmp_type,tmp_format, readable; 1052: Widget tmp_widget; 1053: Cursor cursor; 1054: void CullData(), DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 1055: int VerifyFileReadable(); 1056: 1057: /*SUPPRESS 594*/ 1058: 1059: /* if are using a cull table get its file name and check that 1060: it is readable 1061: */ 1062: if(XmToggleButtonGetState(toggleButtonUseCullTable) == True) { 1063: testfile = XmTextGetString(textFieldCullTableFilename); 1064: readable = VerifyFileReadable(testfile, OPEN, OPENCULLTABLE); 1065: if(readable == NO) { 1066: (void)sprintf(buffer,"Cull table name %s is not a readable file.",testfile); 1067: free(testfile); 1068: XmToggleButtonSetState(toggleButtonUseCullTable, False, False); 1069: XmToggleButtonSetState(toggleButtonDontUseCullTable, True, False); 1070: XmTextSetString(textFieldCullTableFilename,""); 1071: SpManageWarningBox(buffer); 1072: return; 1073: } 1074: else { 1075: XtFree(cull.filename); 1076: if((cull.filename=(char*)calloc((int)strlen(testfile)+10, CHAR_SIZE)) == NULL) { 1077: SpBadMemAlloc("SpUseAffineOKCB"); 1078: } 1079: (void)sprintf(cull.filename, "%s", testfile); 1080: *strrchr(testfile,'/')= '\0'; 1081: if((cull.dirname=(char*)calloc((int)strlen(testfile)+10, CHAR_SIZE)) == NULL) { 1082: SpBadMemAlloc("SpUseAffineOKCB"); 1083: } 1084: (void)sprintf(cull.dirname, "%s", testfile); 1085: free(testfile); 1086: } 1087: } 1088: 1089: /* save cull values */ 1090: if(XmToggleButtonGetState(toggleButtonCullParameters) == True && 1091: XmToggleButtonGetState(toggleButtonUseCullTable) == True) { 1092: cull.method = CULL_PARAMETER_AND_TABLE; 1093: } 1094: else if(XmToggleButtonGetState(toggleButtonCullParameters)) { 1095: cull.method=CULL_PARAMETERS; 1096: } 1097: else if(XmToggleButtonGetState(toggleButtonUseCullTable)) { 1098: cull.method=CULL_TABLE; 1099: } 1100: else { 1101: cull.method=NONE; 1102: } 1103: 1104: if(open_dataform_is_up == YES) { 1105: XtVaGetValues(optionMenuOpenFormat,XmNmenuHistory,&tmp_widget,NULL); 1106: XtVaGetValues(tmp_widget,XmNuserData,&tmp_format,NULL); 1107: } 1108: else if(have_data == DO) { 1109: tmp_format = data[dset]->in_format; 1110: } 1111: else { 1112: tmp_format = MST95REPORT; 1113: } 1114: 1115: if(tmp_format == ODPOTHER) { 1116: if(XmToggleButtonGetState(toggleButtonOpenFormatsOther1) == True) { 1117: tmp_format = ODPOTHER1; 1118: } 1119: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther2) == True) { 1120: tmp_format = ODPOTHER2; 1121: } 1122: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther3) == True) { 1123: tmp_format = ODPOTHER3; 1124: } 1125: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther4) == True) { 1126: tmp_format = ODPOTHER4; 1127: } 1128: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther5) == True) { 1129: tmp_format = ODPOTHER5; 1130: } 1131: else { 1132: tmp_format = ODPOTHER1; 1133: } 1134: } 1135: 1136: if(open_dataform_is_up == YES) { 1137: XtVaGetValues(optionMenuOpenType,XmNmenuHistory,&tmp_widget,NULL); 1138: XtVaGetValues(tmp_widget,XmNuserData,&tmp_type,NULL); 1139: } 1140: else if(have_data == DO) { 1141: tmp_type = data[dset]->type; 1142: } 1143: else { 1144: tmp_type = GRAPE; 1145: } 1146: 1147: switch (tmp_type) 1148: { 1149: case GRAPE: 1150: SpGetEquationValues(&cull.grape); 1151: break; 1152: case PWAVE: 1153: SpGetEquationValues(&cull.pwave); 1154: cstring=XmTextGetString(textFieldCullSignal); 1155: cull.pwave_signal_max=(float)atof(cstring); 1156: XtFree(cstring); 1157: break; 1158: case SUSCEPTIBILITY: 1159: SpGetEquationValues(&cull.susceptibility); 1160: break; 1161: case NATURALGAMMA: 1162: SpGetEquationValues(&cull.naturalgamma); 1163: break; 1164: case REFLECTANCEMST: 1165: SpGetEquationValues(&cull.reflectance); 1166: break; 1167: case OTHERTYPE: 1168: SpGetEquationValues(&cull.otherodp); 1169: break; 1170: default: 1171: break; 1172: } 1173: cstring=XmTextGetString(textFieldCullTop); 1174: cull.top=(float)atof(cstring); 1175: XtFree(cstring); 1176: if(XmToggleButtonGetState(toggleButtonCullUseAll)) 1177: cull.by_core_num=False; 1178: else 1179: cull.by_core_num=True; 1180: cstring=XmTextGetString(textFieldCullCoreNum); 1181: cull.max_core=(float)atof(cstring); 1182: XtFree(cstring); 1183: if(cull.method==NONE && cull.top <= 0.0 && !cull.by_core_num) 1184: xmstring=XmCvtCTToXmString("No Cull..."); 1185: else 1186: xmstring=XmCvtCTToXmString("Cull..."); 1187: XtVaSetValues(pushButtonOpenCull,XmNlabelString,xmstring,NULL); 1188: XmStringFree(xmstring); 1189: 1190: /* close dialog */ 1191: XtUnmanageChild(formCull); 1192: 1193: if(open_dataform_is_up == NO && have_data == DO) { 1194: cursor = XCreateFontCursor(XtDisplay(formSplicer), XC_watch); 1195: if(cursor != BadAlloc && cursor != BadFont && cursor != BadValue) { 1196: XDefineCursor(XtDisplay(formSplicer), XtWindow(formSplicer), cursor); 1197: } 1198: CullData(dset); 1199: if(cursor) { 1200: XUndefineCursor(XtDisplay(formSplicer), XtWindow(formSplicer)); 1201: XFreeCursor(XtDisplay(formSplicer), cursor); 1202: } 1203: 1204: if(XtIsManaged(XtParent(drawingAreaEdit))) { 1205: reason_for_redraw = DRAW_EVERYTHING; 1206: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 1207: } 1208: if(have_splice == DO) { 1209: if(XtIsManaged(XtParent(drawingAreaView))) { 1210: reason_for_redraw = DRAW_EVERYTHING; 1211: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 1212: } 1213: if(are_agemodelling == YES) { 1214: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 1215: reason_for_redraw = DRAW_EVERYTHING; 1216: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 1217: } 1218: } 1219: } 1220: } 1221: } 1222: 1223: /* Function Name: SpOpenCullCB 1224: 1225: * 1226: * Description: This function sets the cull values and opens the cull 1227: * menu dialog. 1228: * 1229: * 1230: * Arguments: Widget w: pushButtonOpenCull 1231: * XtPointer client: unused 1232: * XtPointer call: the call data (unused). 1233: */ 1234: /* ARGSUSED */ 1235: void 1236: SpOpenCullCB(w, client, call) 1237: Widget w; 1238: XtPointer client; 1239: XtPointer call; 1240: { 1241: Widget *tmp_widget; 1242: int tmp_type,tmp_format; 1243: XmString xmstring; 1244: 1245: /*SUPPRESS 594*/ 1246: /* set cull method type*/ 1247: 1248: if(cull.method==CULL_PARAMETERS || cull.method == CULL_PARAMETER_AND_TABLE) 1249: { 1250: XtSetSensitive(formCullOptions,True); 1251: XmToggleButtonSetState(toggleButtonCullParameters,True,True); 1252: } 1253: if(cull.method==CULL_TABLE || cull.method == CULL_PARAMETER_AND_TABLE) 1254: { 1255: XmToggleButtonSetState(toggleButtonUseCullTable,True,True); 1256: if((charptr=(char*)calloc((int)strlen(cull.filename)+10,CHAR_SIZE))==NULL) 1257: SpBadMemAlloc("SpOpenCullCB 0"); 1258: (void)sprintf(charptr,"%s",cull.filename); 1259: XtVaSetValues(textFieldCullTableFilename, XmNvalue, charptr, NULL); 1260: free(charptr); 1261: } 1262: if(cull.method!=CULL_PARAMETERS && cull.method != CULL_PARAMETER_AND_TABLE) 1263: { 1264: XtSetSensitive(formCullOptions,False); 1265: XmToggleButtonSetState(toggleButtonCullNone,True,True); 1266: } 1267: if(cull.method!=CULL_TABLE && cull.method != CULL_PARAMETER_AND_TABLE) 1268: { 1269: XmToggleButtonSetState(toggleButtonDontUseCullTable,True,True); 1270: XtVaSetValues(textFieldCullTableFilename, XmNvalue, "", NULL); 1271: XtSetSensitive(pushButtonSelectCullTableFilename, False); 1272: } 1273: else if(cull.method==CULL_TABLE || cull.method == CULL_PARAMETER_AND_TABLE) 1274: { 1275: XtSetSensitive(pushButtonSelectCullTableFilename, True); 1276: } 1277: 1278: if((charptr=(char*)calloc(20,CHAR_SIZE))==NULL) 1279: SpBadMemAlloc("SpOpenCullCB 1"); 1280: (void)sprintf(charptr,"%.1f",cull.pwave_signal_max); 1281: XmTextSetString(textFieldCullSignal,charptr); 1282: (void)sprintf(charptr,"%.1f",cull.top); 1283: XmTextSetString(textFieldCullTop,charptr); 1284: if(cull.by_core_num) 1285: XmToggleButtonSetState(toggleButtonCullByCore,True,True); 1286: else 1287: XmToggleButtonSetState(toggleButtonCullUseAll,True,True); 1288: (void)sprintf(charptr,"%d",cull.max_core); 1289: XmTextSetString(textFieldCullCoreNum,charptr); 1290: free(charptr); 1291: /* set type/format label */ 1292: if(open_dataform_is_up == YES) { 1293: XtVaGetValues(optionMenuOpenFormat,XmNmenuHistory,&tmp_widget,NULL); 1294: XtVaGetValues(*tmp_widget,XmNuserData,&tmp_format,NULL); 1295: } 1296: else if(have_data == DO) { 1297: tmp_format = data[dset]->in_format; 1298: } 1299: else { 1300: tmp_format = MST95REPORT; 1301: } 1302: 1303: if(tmp_format == ODPOTHER) { 1304: if(XmToggleButtonGetState(toggleButtonOpenFormatsOther1) == True) { 1305: tmp_format = ODPOTHER1; 1306: } 1307: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther2) == True) { 1308: tmp_format = ODPOTHER2; 1309: } 1310: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther3) == True) { 1311: tmp_format = ODPOTHER3; 1312: } 1313: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther4) == True) { 1314: tmp_format = ODPOTHER4; 1315: } 1316: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther5) == True) { 1317: tmp_format = ODPOTHER5; 1318: } 1319: else { 1320: tmp_format = ODPOTHER1; 1321: } 1322: } 1323: 1324: if(open_dataform_is_up == YES) { 1325: XtVaGetValues(optionMenuOpenType,XmNmenuHistory,&tmp_widget,NULL); 1326: XtVaGetValues(*tmp_widget,XmNuserData,&tmp_type,NULL); 1327: } 1328: else if(have_data == DO) { 1329: tmp_type = data[dset]->type; 1330: } 1331: else { 1332: tmp_type = GRAPE; 1333: } 1334: 1335: if((charptr=(char*)calloc((int)strlen(format[tmp_format])+(int)strlen(type[tmp_type])+50,CHAR_SIZE))==NULL) 1336: SpBadMemAlloc("SpOpenCullCB 2"); 1337: (void)sprintf(charptr,"Data Format: %s Type: %s",format[tmp_format],type[tmp_type]); 1338: xmstring=XmCvtCTToXmString(charptr); 1339: XtVaSetValues(labelCullFormatType,XmNlabelString,xmstring,NULL); 1340: XmStringFree(xmstring); 1341: free(charptr); 1342: XtSetSensitive(labelCullSignal,False); 1343: XtSetSensitive(textFieldCullSignal,False); 1344: switch(tmp_type) 1345: { 1346: case GRAPE: 1347: SpSetEquationValues(cull.grape); 1348: break; 1349: case PWAVE: 1350: SpSetEquationValues(cull.pwave); 1351: XtVaGetValues(optionMenuOpenFormat,XmNmenuHistory,&tmp_widget,NULL); 1352: XtVaGetValues(*tmp_widget,XmNuserData,&tmp_format,NULL); 1353: if(tmp_format == MST95REPORT) { 1354: XtSetSensitive(textFieldCullSignal,TRUE); 1355: XtSetSensitive(labelCullSignal,TRUE); 1356: } 1357: break; 1358: case SUSCEPTIBILITY: 1359: SpSetEquationValues(cull.susceptibility); 1360: break; 1361: case NATURALGAMMA: 1362: SpSetEquationValues(cull.naturalgamma); 1363: break; 1364: case REFLECTANCEMST: 1365: SpSetEquationValues(cull.reflectance); 1366: break; 1367: case OTHERTYPE: 1368: SpSetEquationValues(cull.otherodp); 1369: break; 1370: default: 1371: break; 1372: } 1373: /* manage dialog */ 1374: XtManageChild(formCull); 1375: } 1376: 1377: /* Function Name: SpOpenOKCB 1378: * 1379: * Description: This function saves the open data file values 1380: * and closes the form. 1381: * 1382: * Arguments: Widget w: pushButtonOpenOK 1383: * XtPointer client: unused 1384: * XtPointer call: the call data (unused). 1385: */ 1386: /* ARGSUSED */ 1387: void 1388: SpOpenOKCB(w, client, call) 1389: Widget w; 1390: XtPointer client; 1391: XtPointer call; 1392: { 1393: XmString *items; 1394: int info_len,i,tmp_len,len; 1395: char *info,*charptr,*tmp_buf,*filename, *openfilter; 1396: Widget tmp_widget; 1397: 1398: /*SUPPRESS 594*/ 1399: 1400: /* check if have exceeded number of datasets allowed 1401: */ 1402: if(dataset_cnt + 1 > NDATASET) { 1403: message.error=False; 1404: message.fatal=False; 1405: message.caller=OPENOK; 1406: message.type=XmDIALOG_WARNING; 1407: message.default_button=XmDIALOG_OK_BUTTON; 1408: if((message.label=(char*)calloc(100,CHAR_SIZE))==NULL) 1409: SpBadMemAlloc("SpOpenOKCB 1"); 1410: (void)sprintf(message.label,"You have exceeded the number of data sets allowed!"); 1411: SpManageMessage(message); 1412: return; 1413: } 1414: 1415: /* get file names */ 1416: XtVaGetValues(listOpenSelected, XmNitemCount,&openfileinfo.num_in_files, XmNitems,&items, NULL); 1417: /* no data files selected */ 1418: if(openfileinfo.num_in_files<=0) 1419: { 1420: message.error=False; 1421: message.fatal=False; 1422: message.caller=OPENOK; 1423: message.type=XmDIALOG_WARNING; 1424: message.default_button=XmDIALOG_OK_BUTTON; 1425: if((message.label=(char*)calloc(50,CHAR_SIZE))==NULL) 1426: SpBadMemAlloc("SpOpenOKCB 1"); 1427: (void)sprintf(message.label,"You must select at least one data file!"); 1428: SpManageMessage(message); 1429: return; 1430: } 1431: if((openfileinfo.in_file_names=(char**)calloc(openfileinfo.num_in_files,sizeof(char*)))==NULL) 1432: SpBadMemAlloc("SpOpenOKCB 2"); 1433: for(i=0;i<openfileinfo.num_in_files;i++) 1434: { 1435: if(!XmStringGetLtoR(items[i],XmFONTLIST_DEFAULT_TAG,&filename)) 1436: { 1437: message.error=True; 1438: message.fatal=False; 1439: message.caller=OPENOK; 1440: message.type=XmDIALOG_WARNING; 1441: message.default_button=XmDIALOG_OK_BUTTON; 1442: if((message.label=(char*)calloc(200,CHAR_SIZE))==NULL) 1443: SpBadMemAlloc("SpOpenOKCB 1a"); 1444: else 1445: (void)sprintf(message.label,"SpOpenOKCB: Unable to get filename from list"); 1446: SpManageMessage(message); 1447: } 1448: else 1449: { 1450: 1451: openfilter = XmTextGetString(textOpenFilter); 1452: len = (int)strlen(openfilter); 1453: if(strcmp(&openfilter[len-1], "*") == 0) { 1454: *strrchr(openfilter,'*')= '\0'; 1455: } 1456: len = (int)strlen(openfilter); 1457: if(strcmp(&openfilter[len-1], "/") == 0) { 1458: *strrchr(openfilter,'/')= '\0'; 1459: } 1460: if((openfileinfo.in_file_names[i]=(char*)calloc((int)strlen(openfilter)+(int)strlen(filename)+5,CHAR_SIZE))==NULL) 1461: SpBadMemAlloc("SpOpenOKCB 1b"); 1462: 1463: (void)sprintf(openfileinfo.in_file_names[i],"%s/%s",openfilter,filename); 1464: XtFree(openfilter); 1465: XtFree(filename); 1466: } 1467: } 1468: /* get format & type */ 1469: XtVaGetValues(optionMenuOpenFormat,XmNmenuHistory,&tmp_widget,NULL); 1470: XtVaGetValues(tmp_widget,XmNuserData,&openfileinfo.in_data_format,NULL); 1471: 1472: if(openfileinfo.in_data_format == ODPOTHER) { 1473: if(XmToggleButtonGetState(toggleButtonOpenFormatsOther1) == True) { 1474: openfileinfo.in_data_format = ODPOTHER1; 1475: } 1476: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther2) == True) { 1477: openfileinfo.in_data_format = ODPOTHER2; 1478: } 1479: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther3) == True) { 1480: openfileinfo.in_data_format = ODPOTHER3; 1481: } 1482: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther4) == True) { 1483: openfileinfo.in_data_format = ODPOTHER4; 1484: } 1485: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther5) == True) { 1486: openfileinfo.in_data_format = ODPOTHER5; 1487: } 1488: else { 1489: openfileinfo.in_data_format = ODPOTHER1; 1490: } 1491: } 1492: if(openfileinfo.in_data_format == JANUS) { 1493: if(XmToggleButtonGetState(toggleButtonJanusClean) == True) { 1494: openfileinfo.in_data_format = JANUSCLEAN; 1495: } 1496: else if(XmToggleButtonGetState(toggleButtonJanusOrig) == True) { 1497: openfileinfo.in_data_format = JANUSORIG; 1498: } 1499: } 1500: 1501: XtVaGetValues(optionMenuOpenType,XmNmenuHistory,&tmp_widget,NULL); 1502: XtVaGetValues(tmp_widget,XmNuserData,&openfileinfo.in_data_type,NULL); 1503: 1504: /* make tmp buffer */ 1505: tmp_len=1000; 1506: if((tmp_buf=(char*)calloc(tmp_len,CHAR_SIZE))==NULL) 1507: SpBadMemAlloc("SpOpenOKCB 5"); 1508: /* create output text */ 1509: info_len=2000; 1510: if((info=(char*)calloc(info_len,CHAR_SIZE))==NULL) 1511: SpBadMemAlloc("SPOpenOKCB 6"); 1512: (void)sprintf(info,"\nSplicer Input Files:\n"); 1513: for(i=0;i<openfileinfo.num_in_files;i++) 1514: { 1515: if((int)strlen(info)+(int)strlen(openfileinfo.in_file_names[i])+2 >= info_len) 1516: { 1517: info_len+=500; 1518: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1519: SpBadMemAlloc("SpOpenOKCB 7"); 1520: else 1521: info=charptr; 1522: } 1523: (void)strcat(info,openfileinfo.in_file_names[i]); 1524: (void)strcat(info,"\n"); 1525: } 1526: if((len=50+(int)strlen(type[openfileinfo.in_data_type]))>tmp_len) 1527: { 1528: tmp_len=len; 1529: if((charptr=(char*)realloc(tmp_buf,tmp_len*CHAR_SIZE))==NULL) 1530: SpBadMemAlloc("SpOpenOKCB 8"); 1531: else 1532: tmp_buf=charptr; 1533: } 1534: (void)sprintf(tmp_buf,"\nData Type: %s\n",type[openfileinfo.in_data_type]); 1535: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1536: { 1537: info_len+=500; 1538: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1539: SpBadMemAlloc("SpOpenOKCB 9"); 1540: else 1541: info=charptr; 1542: } 1543: (void)strcat(info,tmp_buf); 1544: if((len=50+(int)strlen(format[openfileinfo.in_data_format]))>tmp_len) 1545: { 1546: tmp_len=len; 1547: if((charptr=(char*)realloc(tmp_buf,tmp_len*CHAR_SIZE))==NULL) 1548: SpBadMemAlloc("SpOpenOKCB 10"); 1549: else 1550: tmp_buf=charptr; 1551: } 1552: (void)sprintf(tmp_buf,"\nData File Format: %s\n",format[openfileinfo.in_data_format]); 1553: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1554: { 1555: info_len+=500; 1556: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1557: SpBadMemAlloc("SpOpenOKCB 11"); 1558: else 1559: info=charptr; 1560: } 1561: (void)strcat(info,tmp_buf); 1562: if((len=50+(int)strlen(affine.filename)*2)>tmp_len) 1563: { 1564: tmp_len=len; 1565: if((charptr=(char*)realloc(tmp_buf,tmp_len*CHAR_SIZE))==NULL) 1566: SpBadMemAlloc("SpOpenOKCB 12"); 1567: else 1568: tmp_buf=charptr; 1569: } 1570: if(affine.usetable) 1571: (void)sprintf(tmp_buf,"\nAffine Table: %s\n",affine.filename); 1572: else 1573: (void)sprintf(tmp_buf,"\nNo Affine Table used.\n"); 1574: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1575: { 1576: info_len+=500; 1577: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1578: SpBadMemAlloc("SpOpenOKCB 13"); 1579: else 1580: info=charptr; 1581: } 1582: (void)strcat(info,tmp_buf); 1583: if((len=50+(int)strlen(smooth_units[smooth.width_units])+(int)strlen(plot_display[smooth.plot]))>tmp_len) 1584: { 1585: tmp_len=len; 1586: if((charptr=(char*)realloc(tmp_buf,tmp_len*CHAR_SIZE))==NULL) 1587: SpBadMemAlloc("SpOpenOKCB 14"); 1588: else 1589: tmp_buf=charptr; 1590: } 1591: if(smooth.method==GAUSSIAN) 1592: (void)sprintf(tmp_buf,"\nGaussian Smoothing: %d %s\nPlot Display: %s\n", 1593: smooth.width,smooth_units[smooth.width_units], 1594: plot_display[smooth.plot]); 1595: else 1596: (void)sprintf(tmp_buf,"\nNo data smoothing.\n"); 1597: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1598: { 1599: info_len+=500; 1600: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1601: SpBadMemAlloc("SpOpenOKCB 15"); 1602: else 1603: info=charptr; 1604: } 1605: (void)strcat(info,tmp_buf); 1606: if((len=100+(int)strlen(cull.filename))>tmp_len) 1607: { 1608: tmp_len=len; 1609: if((charptr=(char*)realloc(tmp_buf,tmp_len*CHAR_SIZE))==NULL) 1610: SpBadMemAlloc("SpOpenOKCB 16"); 1611: else 1612: tmp_buf=charptr; 1613: } 1614: 1615: if(cull.method!=CULL_TABLE && cull.method!=CULL_PARAMETERS && cull.method!=CULL_PARAMETER_AND_TABLE) 1616: { 1617: (void)sprintf(tmp_buf,"\nNo culling by data values.\n"); 1618: } 1619: else 1620: { 1621: if(cull.method == CULL_PARAMETER_AND_TABLE) 1622: { 1623: (void)sprintf(tmp_buf,"\nCull Table: %s\n",cull.filename); 1624: strcat(tmp_buf, "Culling will be done with user set parameters.\n"); 1625: } 1626: else if(cull.method==CULL_TABLE) 1627: { 1628: (void)sprintf(tmp_buf,"\nCull Table: %s\n",cull.filename); 1629: } 1630: else if(cull.method==CULL_PARAMETERS) 1631: { 1632: (void)sprintf(tmp_buf,"\nCulling will be done with user set parameters.\n"); 1633: } 1634: } 1635: 1636: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1637: { 1638: info_len+=500; 1639: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1640: SpBadMemAlloc("SpOpenOKCB 17"); 1641: else 1642: info=charptr; 1643: } 1644: (void)strcat(info,tmp_buf); 1645: (void)sprintf(tmp_buf,"Top %.1f cm will be removed from core.\n",cull.top); 1646: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1647: { 1648: info_len+=500; 1649: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1650: SpBadMemAlloc("SpOpenOKCB 18"); 1651: else 1652: info=charptr; 1653: } 1654: (void)strcat(info,tmp_buf); 1655: if(cull.by_core_num) 1656: (void)sprintf(tmp_buf,"Only cores <= %d will be used.\n",cull.max_core); 1657: else 1658: (void)sprintf(tmp_buf,"All cores will be used.\n"); 1659: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1660: { 1661: info_len+=500; 1662: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1663: SpBadMemAlloc("SpOpenOKCB 19"); 1664: else 1665: info=charptr; 1666: } 1667: (void)strcat(info,tmp_buf); 1668: if(decimate_value>1) 1669: (void)sprintf(tmp_buf,"\nDecimation: every %d point will be used.\n",decimate_value); 1670: else 1671: (void)sprintf(tmp_buf,"\nEvery data point will be used.\n"); 1672: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1673: { 1674: info_len+=500; 1675: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1676: SpBadMemAlloc("SpOpenOKCB 20"); 1677: else 1678: info=charptr; 1679: } 1680: (void)strcat(info,tmp_buf); 1681: (void)sprintf(tmp_buf,"\nNote: multiple data values will be averaged.\n"); 1682: if((int)strlen(info)+(int)strlen(tmp_buf)+2 >=info_len) 1683: { 1684: info_len+=500; 1685: if((charptr=(char*)realloc(info,info_len*CHAR_SIZE))==NULL) 1686: SpBadMemAlloc("SpOpenOKCB 21"); 1687: else 1688: info=charptr; 1689: } 1690: (void)strcat(info,tmp_buf); 1691: 1692: /* display information window */ 1693: XmTextSetString(textOpenInfo,info); 1694: XtManageChild(formOpenInfo); 1695: free(info); 1696: free(tmp_buf); 1697: } 1698: 1699: /* Function Name: SpOpenDataCB 1700: * 1701: * Description: This function displays the dialog for choosing data 1702: * values for opening data files. 1703: * 1704: * 1705: * Arguments: Widget w: pushButtonOpenData 1706: * XtPointer client: unused 1707: * XtPointer call: the call data (unused). 1708: */ 1709: /* ARGSUSED */ 1710: void 1711: SpOpenDataCB(w, client, call) 1712: Widget w; 1713: XtPointer client; 1714: XtPointer call; 1715: { 1716: XmString xmstring; 1717: Widget *tmp_widget; 1718: int len, tmp_format; 1719: FILE *fptr; 1720: char errorstring[500], *str; 1721: /*SUPPRESS 594*/ 1722: message.error=False; 1723: errorstring[0]='\0'; 1724: open_dataform_is_up = YES; 1725: if(dataset_cnt > 1) { 1726: decimate_value = 1; 1727: } 1728: if(affine.usetable) 1729: { 1730: if((fptr=fopen(affine.filename,"r"))==NULL) 1731: { 1732: message.error=True; 1733: (void)sprintf(errorstring,"Affine table not found!"); 1734: affine.usetable=False; 1735: xmstring=XmCvtCTToXmString("Don't Use Affine..."); 1736: } 1737: else 1738: { 1739: fclose(fptr); 1740: xmstring=XmCvtCTToXmString("Use Affine..."); 1741: } 1742: } 1743: else 1744: xmstring=XmCvtCTToXmString("Don't Use Affine..."); 1745: XtVaSetValues(pushButtonOpenAffine,XmNlabelString,xmstring,NULL); 1746: XmStringFree(xmstring); 1747: if(cull.method==NONE && cull.top<=0.0 && !cull.by_core_num) 1748: xmstring=XmCvtCTToXmString("No Cull..."); 1749: else if(cull.method==CULL_TABLE) 1750: { 1751: if((fptr=fopen(cull.filename,"r"))==NULL) 1752: { 1753: message.error=True; 1754: (void)strcat(errorstring," Cull Table not found!"); 1755: cull.method=NONE; 1756: if(cull.top<=0.0 && !cull.by_core_num) 1757: xmstring=XmCvtCTToXmString("No Cull..."); 1758: } 1759: else 1760: { 1761: fclose(fptr); 1762: xmstring=XmCvtCTToXmString("Cull..."); 1763: } 1764: } 1765: else 1766: xmstring=XmCvtCTToXmString("Cull..."); 1767: XtVaSetValues(pushButtonOpenCull,XmNlabelString,xmstring,NULL); 1768: XmStringFree(xmstring); 1769: if(smooth.method==None) 1770: xmstring=XmCvtCTToXmString("No Smooth..."); 1771: else 1772: xmstring=XmCvtCTToXmString("Smooth..."); 1773: XtVaSetValues(pushButtonOpenSmooth,XmNlabelString,xmstring,NULL); 1774: XmStringFree(xmstring); 1775: if(decimate_value>1) 1776: xmstring=XmCvtCTToXmString("Decimate..."); 1777: else 1778: xmstring=XmCvtCTToXmString("No Decimate..."); 1779: XtVaSetValues(pushButtonOpenDecimate,XmNlabelString,xmstring,NULL); 1780: XmStringFree(xmstring); 1781: 1782: if(openfileinfo.in_data_format == MST95REPORT) { 1783: XtVaSetValues(optionMenuOpenFormat, XmNmenuHistory, pushButtonOpenMST95Report, NULL); 1784: XtSetSensitive(pushButtonOpenReflectance, True); 1785: XtSetSensitive(pushButtonOpenGrape, True); 1786: XtSetSensitive(pushButtonOpenPwave, True); 1787: XtSetSensitive(pushButtonOpenSusceptibility, True); 1788: XtSetSensitive(pushButtonOpenNaturalGamma, True); 1789: XtSetSensitive(pushButtonOpenOtherType, False); 1790: } 1791: else if(openfileinfo.in_data_format == TKREPORT) { 1792: XtVaSetValues(optionMenuOpenFormat, XmNmenuHistory, pushButtonOpenTKReport, NULL); 1793: XtSetSensitive(pushButtonOpenReflectance, True); 1794: XtSetSensitive(pushButtonOpenGrape, True); 1795: XtSetSensitive(pushButtonOpenPwave, True); 1796: XtSetSensitive(pushButtonOpenSusceptibility, True); 1797: XtSetSensitive(pushButtonOpenNaturalGamma, True); 1798: XtSetSensitive(pushButtonOpenOtherType, False); 1799: } 1800: else if(openfileinfo.in_data_format == ODPOTHER || openfileinfo.in_data_format == ODPOTHER1 || 1801: openfileinfo.in_data_format == ODPOTHER2 || openfileinfo.in_data_format == ODPOTHER3 || 1802: openfileinfo.in_data_format == ODPOTHER4 || openfileinfo.in_data_format == ODPOTHER5) { 1803: XtVaSetValues(optionMenuOpenFormat, XmNmenuHistory, pushButtonOpenODPOther, NULL); 1804: XtSetSensitive(pushButtonOpenReflectance, True); 1805: XtSetSensitive(pushButtonOpenGrape, True); 1806: XtSetSensitive(pushButtonOpenPwave, True); 1807: XtSetSensitive(pushButtonOpenSusceptibility, True); 1808: XtSetSensitive(pushButtonOpenNaturalGamma, True); 1809: XtSetSensitive(pushButtonOpenOtherType, True); 1810: } 1811: else if(openfileinfo.in_data_format == OSUSCAT) { 1812: XtVaSetValues(optionMenuOpenFormat, XmNmenuHistory, pushButtonOpenOSUSCAT, NULL); 1813: XtSetSensitive(pushButtonOpenReflectance, True); 1814: XtSetSensitive(pushButtonOpenGrape, False); 1815: XtSetSensitive(pushButtonOpenPwave, False); 1816: XtSetSensitive(pushButtonOpenSusceptibility, False); 1817: XtSetSensitive(pushButtonOpenNaturalGamma, False); 1818: XtSetSensitive(pushButtonOpenOtherType, False); 1819: } 1820: else if(openfileinfo.in_data_format == JANUSCLEAN || openfileinfo.in_data_format == JANUSORIG) { 1821: XtVaSetValues(optionMenuOpenFormat, XmNmenuHistory, pushButtonOpenJANUS, NULL); 1822: XtSetSensitive(pushButtonOpenReflectance, True); 1823: XtSetSensitive(pushButtonOpenGrape, True); 1824: XtSetSensitive(pushButtonOpenPwave, True); 1825: XtSetSensitive(pushButtonOpenSusceptibility, True); 1826: XtSetSensitive(pushButtonOpenNaturalGamma, True); 1827: XtSetSensitive(pushButtonOpenOtherType, False); 1828: } 1829: else { 1830: openfileinfo.in_data_format = MST95REPORT; 1831: XtVaSetValues(optionMenuOpenFormat, XmNmenuHistory, pushButtonOpenMST95Report, NULL); 1832: XtSetSensitive(pushButtonOpenReflectance, True); 1833: XtSetSensitive(pushButtonOpenGrape, False); 1834: XtSetSensitive(pushButtonOpenPwave, False); 1835: XtSetSensitive(pushButtonOpenSusceptibility, False); 1836: XtSetSensitive(pushButtonOpenNaturalGamma, False); 1837: XtSetSensitive(pushButtonOpenOtherType, False); 1838: } 1839: if(openfileinfo.in_data_format == JANUSORIG) { 1840: XmToggleButtonSetState(toggleButtonHeaderNo, True, NULL); 1841: XmToggleButtonSetState(toggleButtonHeaderYes, False, NULL); 1842: XtSetSensitive(toggleButtonHeaderNo, False); 1843: XtSetSensitive(toggleButtonHeaderYes, False); 1844: XtSetSensitive(textFieldNHeader, False); 1845: } 1846: else { 1847: XtSetSensitive(toggleButtonHeaderNo, True); 1848: XtSetSensitive(toggleButtonHeaderYes, True); 1849: XtSetSensitive(textFieldNHeader, True); 1850: } 1851: if(openfileinfo.in_data_format == JANUSCLEAN) { 1852: XmToggleButtonSetState(toggleButtonJanusOrig, False, NULL); 1853: XmToggleButtonSetState(toggleButtonJanusClean, True, NULL); 1854: } 1855: else if(openfileinfo.in_data_format == JANUSORIG) { 1856: XmToggleButtonSetState(toggleButtonJanusOrig, True, NULL); 1857: XmToggleButtonSetState(toggleButtonJanusClean, False, NULL); 1858: } 1859: else { 1860: XmToggleButtonSetState(toggleButtonJanusOrig, True, NULL); 1861: XmToggleButtonSetState(toggleButtonJanusClean, False, NULL); 1862: } 1863: 1864: /* set data type. note that format type OSUSCAT is always reflectance 1865: */ 1866: if(openfileinfo.in_data_format == OSUSCAT) { 1867: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenReflectance, NULL); 1868: } 1869: else if(openfileinfo.in_data_type == GRAPE) { 1870: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenGrape, NULL); 1871: } 1872: else if(openfileinfo.in_data_type == PWAVE) { 1873: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenPwave, NULL); 1874: } 1875: else if(openfileinfo.in_data_type == SUSCEPTIBILITY) { 1876: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenSusceptibility, NULL); 1877: } 1878: else if(openfileinfo.in_data_type == NATURALGAMMA) { 1879: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenNaturalGamma, NULL); 1880: } 1881: else if(openfileinfo.in_data_type == REFLECTANCEMST) { 1882: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenReflectance, NULL); 1883: } 1884: else if(openfileinfo.in_data_type == OTHERTYPE) { 1885: if(openfileinfo.in_data_format == MST95REPORT || openfileinfo.in_data_format == TKREPORT || 1886: openfileinfo.in_data_format == JANUSCLEAN || openfileinfo.in_data_format == JANUSORIG) { 1887: /*MST95 and TK and Janus formats do not have an other type */ 1888: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenGrape, NULL); 1889: } 1890: else { 1891: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenOtherType, NULL); 1892: } 1893: } 1894: else { 1895: openfileinfo.in_data_type = GRAPE; 1896: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenGrape, NULL); 1897: } 1898: 1899: XtFree(current_path); 1900: current_path=NULL; 1901: if((current_path=(char*)calloc((int)strlen(open_data_directory)+5,CHAR_SIZE))==NULL) 1902: SpBadMemAlloc("SpOpenData"); 1903: (void)sprintf(current_path, "%s", open_data_directory); 1904: 1905: len = (int)strlen(current_path); 1906: if(strcmp(¤t_path[len-1], "/") == 0) { 1907: *strrchr(current_path,'/')= '\0'; 1908: } 1909: 1910: if((str=(char*)calloc((int)strlen(current_path)+5,CHAR_SIZE))==NULL) 1911: SpBadMemAlloc("SpOpenData"); 1912: (void)sprintf(str,"%s/*",current_path); 1913: XtVaSetValues(textOpenFilter, XmNvalue, str, NULL); 1914: free(str); 1915: 1916: SpUpdateOpen(FILE_FILTER); 1917: 1918: (void)sprintf(preview_input_path,"%s",current_path); 1919: 1920: XtVaGetValues(optionMenuOpenFormat,XmNmenuHistory,&tmp_widget,NULL); 1921: XtVaGetValues(*tmp_widget,XmNuserData,&tmp_format,NULL); 1922: XtManageChild(formOpen); 1923: if(message.error) 1924: SpManageWarningBox(errorstring); 1925: } 1926: 1927: /* Function Name: SpCullSaveCB 1928: * 1929: * Description: This function opens the fileSelection dialog box for 1930: * saving the cull table. 1931: * 1932: * 1933: * Arguments: Widget w: pushButtonSaveCull 1934: * XtPointer client: unused 1935: * XtPointer call: the call data (unused). 1936: */ 1937: /* ARGSUSED */ 1938: void 1939: SpCullSaveCB(w, client, call) 1940: Widget w; 1941: XtPointer client; 1942: XtPointer call; 1943: { 1944: } 1945: 1946: /* Function Name: SpFileSelectionBoxOKCB 1947: * 1948: * Description: This function is called by the OK button in a 1949: * fileSelectionBox. It saves the file and filter 1950: * values and opens the appropriate file. 1951: * 1952: * Arguments: Widget w: the activating widget. 1953: * XtPointer client: fileselection widget 1954: * XtPointer call: fileselection callback struct. 1955: */ 1956: /* ARGSUSED */ 1957: void 1958: SpFileSelectionBoxOKCB(w, client, call) 1959: Widget w; 1960: XtPointer client; 1961: XtPointer call; 1962: { 1963: } 1964: 1965: /* Function Name: SpVerifyFloatCB 1966: * 1967: * Description: This function checks that the text value of the 1968: * widget supplied is a valid floating point field. 1969: * 1970: * 1971: * Arguments: Widget w: the activating widget. 1972: * XtPointer client: unused 1973: * XtPointer call: TextVerifyCallback 1974: */ 1975: /* ARGSUSED */ 1976: void 1977: SpVerifyFloatCB(w, client, call) 1978: Widget w; 1979: XtPointer client; 1980: XtPointer call; 1981: { 1982: int i=0,len,decimal_found=False; 1983: char numbuffer[200]; 1984: /*SUPPRESS 594*/ 1985: /* get text strings */ 1986: char *oldtext = XmTextGetString(w); 1987: XmTextVerifyCallbackStruct *textcall=(XmTextVerifyCallbackStruct*)call; 1988: /* check that new value is numeric */ 1989: for(i=0;i<textcall->text->length&& textcall->doit==True;i++) 1990: { 1991: if(!(isdigit(textcall->text->ptr[i])) && textcall->text->ptr[i]!='.' 1992: && textcall->text->ptr[i]!='-') 1993: textcall->doit = False; 1994: } 1995: /* check that altered value will be OK */ 1996: if(textcall->doit) 1997: { 1998: /* create new value */ 1999: numbuffer[0]='\0'; 2000: if(textcall->startPos > 0) 2001: { 2002: (void)strncpy(numbuffer,oldtext,textcall->startPos); 2003: numbuffer[textcall->startPos]='\0'; 2004: } 2005: if(textcall->text->ptr != NULL) 2006: (void)strcat(numbuffer,textcall->text->ptr); 2007: if(textcall->endPos < (int)strlen(oldtext)) 2008: (void)strcat(numbuffer,&oldtext[textcall->endPos]); 2009: /* check if valid floating point */ 2010: len=(int)strlen(numbuffer); 2011: for(i=0;i<len && textcall->doit;i++) 2012: { 2013: if(!isdigit(numbuffer[i]) && !(numbuffer[i]=='-' && i==0) && 2014: !(numbuffer[i]=='.' && !decimal_found)) 2015: textcall->doit=False; 2016: if(numbuffer[i]=='.') decimal_found=True; 2017: } 2018: } 2019: XtFree(oldtext); 2020: } 2021: 2022: /* Function Name: SpCullJoinCB 2023: * 2024: * Description: This function is called by the join option menu 2025: * in the cull dialog. It set the sensitivity of th 2026: * second set of equation values. 2027: * 2028: * Arguments: Widget w: the cull join pushbuttons 2029: * XtPointer client: unused 2030: * XtPointer call: the call data (unused). 2031: */ 2032: /* ARGSUSED */ 2033: void 2034: SpCullJoinCB(w, client, call) 2035: Widget w; 2036: XtPointer client; 2037: XtPointer call; 2038: { 2039: /*SUPPRESS 594*/ 2040: Widget *tmpwidget=(Widget*)w; 2041: if(*tmpwidget==pushButtonCullOnly) 2042: { 2043: XtSetSensitive(equationMenuCull2.EquationMenu,FALSE); 2044: XtSetSensitive(textFieldCullValue2,FALSE); 2045: } 2046: else 2047: { 2048: XtSetSensitive(equationMenuCull2.EquationMenu,True); 2049: XtSetSensitive(textFieldCullValue2,True); 2050: } 2051: } 2052: /* Function Name: BxVerifyNumericCB 2053: * Description: Used as the XmNmodifyVerify callback on a text 2054: * or text field widget. Allows only numeric characters 2055: * to be entered [no decimal point or sign is allowed]. 2056: * Arguments: Widget w: the widget calling the function. 2057: * XtPointer client: unused 2058: * XtPointer call: pointer to XmTextVerifyCallbackStruct 2059: */ 2060: 2061: /* ARGSUSED */ 2062: void 2063: BxVerifyNumericCB ARGLIST((w, client, call)) 2064: UARG( Widget, w) 2065: UARG( XtPointer, client) 2066: GRA( XtPointer, call) 2067: { 2068: int i; 2069: XmTextVerifyCallbackStruct *theVerifyCB; 2070: XmTextBlock textBlock; /* the text to be inserted */ 2071: 2072: theVerifyCB = (XmTextVerifyCallbackStruct *)call; 2073: textBlock = theVerifyCB->text; 2074: 2075: for ( i=0; i < textBlock->length; i++) 2076: { 2077: if ( !(isascii(textBlock->ptr[i])) || !(isdigit(textBlock->ptr[i])) ) 2078: { 2079: theVerifyCB->doit = False; 2080: } 2081: } 2082: /* 2083: * keyboard bell will be rung by default 2084: */ 2085: } 2086: 2087: /* Function Name: SpOpenInfoOKCB 2088: * 2089: * Description: This function OKs the user selected input 2090: * information and starts the data reading. 2091: * 2092: * 2093: * Arguments: Widget w: pushButtonOpenInfoOK 2094: * XtPointer client: unused 2095: * XtPointer call: the call data (unused). 2096: */ 2097: /* ARGSUSED */ 2098: void 2099: SpOpenInfoOKCB(w, client, call) 2100: Widget w; 2101: XtPointer client; 2102: XtPointer call; 2103: { 2104: char *info; 2105: 2106: /*SUPPRESS 594*/ 2107: XtWorkProc SpInputData; 2108: XtUnmanageChild(formOpenInfo); 2109: info=XmTextGetString(textOpenInfo); 2110: SpUpdateReport(info); 2111: XtFree(info); 2112: done_reading = False; 2113: work_id=XtAppAddWorkProc(app,SpInputData,messageBoxWorking); 2114: XtManageChild(messageBoxWorking); 2115: XtPopup(XtParent(messageBoxWorking),XtGrabNone); 2116: } 2117: 2118: /* Function Name: SplicerHelpCB 2119: * 2120: * Description: THis function calls the splicer help program using 2121: * the file name passed by the calling widget. 2122: * 2123: * 2124: * Arguments: Widget w: the activating widget. 2125: * XtPointer client: name of help file 2126: * XtPointer call: the call data (unused). 2127: */ 2128: /* ARGSUSED */ 2129: void 2130: SplicerHelpCB(w, client, call) 2131: Widget w; 2132: XtPointer client; 2133: XtPointer call; 2134: { 2135: /*SUPPRESS 594*/ 2136: char *helpfiles_path, *help_path,*getenv(); 2137: /* get text string */ 2138: char *helpbuffer= (char*) client; 2139: /* put together command and submit it */ 2140: 2141: if((helpfiles_path=(char*)calloc(1000,CHAR_SIZE))==NULL) 2142: SpBadMemAlloc("SplicerHelpCB 1"); 2143: if((help_path=(char*)calloc(1000,CHAR_SIZE))==NULL) 2144: SpBadMemAlloc("SplicerHelpCB 2"); 2145: (void)strcpy(helpfiles_path,(char*)getenv("SPLICER_HELPFILES_PATH")); 2146: (void)strcpy(help_path,(char*)getenv("SPLICER_HELP_PATH")); 2147: if((charptr=(char*)calloc((int)strlen(helpfiles_path) + (int)strlen(help_path)+(int)strlen(helpbuffer)+200,CHAR_SIZE))==NULL) 2148: SpBadMemAlloc("SplicerHelpCB 3"); 2149: (void)sprintf(charptr,"%s/hsplicer-c -bg %s -fg %s <%s/%s & ", help_path, prgbgcolor, prgfgcolor, helpfiles_path,helpbuffer); 2150: (void)system(charptr); 2151: free(charptr); 2152: free(helpfiles_path); 2153: free(help_path); 2154: } 2155: 2156: /* Function Name: SpAffineSaveCB 2157: * 2158: * Description: This function sets the defaults for the save affine 2159: * dialog and opens the dialog. 2160: * 2161: * Arguments: Widget w: pushButtonSaveAffine 2162: * XtPointer client: the integer exit value. 2163: * XtPointer call: the call data (unused). 2164: */ 2165: /* ARGSUSED */ 2166: void 2167: SpAffineSaveCB(w, client, call) 2168: Widget w; 2169: XtPointer client; 2170: XtPointer call; 2171: { 2172: } 2173: 2174: /* ARGSUSED */ 2175: void 2176: SpManageCB(w, client, call) 2177: Widget w; 2178: XtPointer client; 2179: XtPointer call; 2180: { 2181: /*SUPPRESS 594*/ 2182: } 2183: 2184: /* Function Name: SpExitCB 2185: * 2186: * Description: This function cleans up and exits the program. 2187: * 2188: * Arguments: Widget w: pushButtonOK from messageBoxExit 2189: * XtPointer client: the integer exit value. 2190: * XtPointer call: the call data (unused). 2191: */ 2192: /* ARGSUSED */ 2193: void 2194: SpExitCB(w, client, call) 2195: Widget w; 2196: XtPointer client; 2197: XtPointer call; 2198: { 2199: /*SUPPRESS 594*/ 2200: int exitValue = (int)client; 2201: void exit(), SpWriteReport(); 2202: 2203: /* write the report 2204: */ 2205: if(write_report == NO) { 2206: } 2207: else { 2208: SpWriteReport(); 2209: } 2210: 2211: SpExit(); 2212: exit(exitValue); 2213: } 2214: 2215: /* Function Name: SpClearWorkspaceCB 2216: * 2217: * Description: This function cleans up all opened data strucutures 2218: * and clears windows. 2219: * 2220: * Arguments: Widget w: pushButtonOK from messageBoxClearWorkspace 2221: * XtPointer client: the integer exit value. 2222: * XtPointer call: the call data (unused). 2223: */ 2224: /* ARGSUSED */ 2225: void 2226: SpClearWorkspaceCB(w, client, call) 2227: Widget w; 2228: XtPointer client; 2229: XtPointer call; 2230: { 2231: /*SUPPRESS 594*/ 2232: if(have_data == DO) { 2233: SpCleanUp(ALL); 2234: } 2235: } 2236: 2237: /* Function Name: SpCreateReportCB 2238: * 2239: * Description: writes time to start of report text 2240: * 2241: * Arguments: Widget w: the activating widget. 2242: * XtPointer client: the integer exit value. 2243: * XtPointer call: the call data (unused). 2244: */ 2245: 2246: /* ARGSUSED */ 2247: void 2248: SpCreateReportCB(w, client, call) 2249: Widget w; 2250: XtPointer client; 2251: XtPointer call; 2252: { 2253: } 2254: 2255: /* ARGSUSED */ 2256: void 2257: SpCreateCB(w, client, call) 2258: Widget w; 2259: XtPointer client; 2260: XtPointer call; 2261: { 2262: String drawingAreaEditTranslations; 2263: XtActionsRec drawingAreaEditButtonActions; 2264: String drawingAreaViewTranslations; 2265: XtActionsRec drawingAreaViewButtonActions; 2266: String drawingAreaTieCorrelationTranslations; 2267: XtActionsRec drawingAreaTieCorrelationButtonActions; 2268: String drawingAreaSpliceCorrelationTranslations; 2269: XtActionsRec drawingAreaSpliceCorrelationButtonActions; 2270: String drawingAreaDepthOffsetTranslations; 2271: XtActionsRec drawingAreaDepthOffsetButtonActions; 2272: String drawingAreaAgeDepthTranslations; 2273: XtActionsRec drawingAreaAgeDepthButtonActions; 2274: String drawingAreaSpliceToAgeTranslations; 2275: XtActionsRec drawingAreaSpliceToAgeButtonActions; 2276: String drawingAreaTieToTimeSeriesCorrTranslations; 2277: XtActionsRec drawingAreaTieToTimeSeriesCorrButtonActions; 2278: extern void EventProcDrawingAreaDepthOffset(); 2279: extern void EventProcDrawingAreaEdit(); 2280: extern void EventProcDrawingAreaView(); 2281: extern void EventProcDrawingAreaTieCorrelation(); 2282: extern void EventProcDrawingAreaSpliceCorrelation(); 2283: extern void EventProcDrawingAreaAgeDepth(); 2284: extern void EventProcDrawingAreaSpliceToAge(); 2285: extern void EventProcDrawingAreaTieToTimeSeriesCorr(); 2286: 2287: /*SUPPRESS 594*/ 2288: Widget *setme = (Widget*)client; 2289: if(*setme == messageBoxWorking) 2290: { 2291: XtUnmanageChild(XmMessageBoxGetChild(messageBoxWorking,XmDIALOG_OK_BUTTON)); 2292: XtUnmanageChild(XmMessageBoxGetChild(messageBoxWorking,XmDIALOG_HELP_BUTTON)); 2293: } 2294: else if(*setme == drawingAreaDepthOffset) 2295: { 2296: drawingAreaDepthOffsetButtonActions.string = "EventProcDrawingAreaDepthOffset"; 2297: drawingAreaDepthOffsetButtonActions.proc = EventProcDrawingAreaDepthOffset; 2298: XtAppAddActions(app, &drawingAreaDepthOffsetButtonActions, 1); 2299: 2300: drawingAreaDepthOffsetTranslations = 2301: "<Btn1Down>: EventProcDrawingAreaDepthOffset(but_1_down) ManagerGadgetArm()\n\ 2302: <Btn1Up>: EventProcDrawingAreaDepthOffset(but_1_up) ManagerGadgetActivate()\n\ 2303: <Btn1Motion>: EventProcDrawingAreaDepthOffset(but_1_move) ManagerGadgetButtonMotion()"; 2304: 2305: XtVaSetValues(*setme, XmNtranslations, XtParseTranslationTable(drawingAreaDepthOffsetTranslations),NULL); 2306: } 2307: else if(*setme == drawingAreaAgeDepth) 2308: { 2309: drawingAreaAgeDepthButtonActions.string = "EventProcDrawingAreaAgeDepth"; 2310: drawingAreaAgeDepthButtonActions.proc = EventProcDrawingAreaAgeDepth; 2311: XtAppAddActions(app, &drawingAreaAgeDepthButtonActions, 1); 2312: 2313: drawingAreaAgeDepthTranslations = 2314: "<Btn1Down>: EventProcDrawingAreaAgeDepth(but_1_down) ManagerGadgetArm()\n\ 2315: <Btn1Up>: EventProcDrawingAreaAgeDepth(but_1_up) ManagerGadgetActivate()\n\ 2316: <Btn1Motion>: EventProcDrawingAreaAgeDepth(but_1_move) ManagerGadgetButtonMotion()\n\ 2317: <Btn2Down>: EventProcDrawingAreaAgeDepth(but_2_down) ManagerGadgetArm()\n\ 2318: <Btn2Up>: EventProcDrawingAreaAgeDepth(but_2_up) ManagerGadgetActivate()\n\ 2319: <Btn2Motion>: EventProcDrawingAreaAgeDepth(but_2_move) ManagerGadgetButtonMotion()\n\ 2320: <Btn3Down>: EventProcDrawingAreaAgeDepth(but_3_down) ManagerGadgetArm()\n\ 2321: <Btn3Up>: EventProcDrawingAreaAgeDepth(but_3_up) ManagerGadgetActivate()\n\ 2322: <Btn3Motion>: EventProcDrawingAreaAgeDepth(but_3_move) ManagerGadgetButtonMotion()"; 2323: 2324: XtVaSetValues(*setme, XmNtranslations, XtParseTranslationTable(drawingAreaAgeDepthTranslations),NULL); 2325: } 2326: else if(*setme == drawingAreaSpliceToAge) 2327: { 2328: drawingAreaSpliceToAgeButtonActions.string = "EventProcDrawingAreaSpliceToAge"; 2329: drawingAreaSpliceToAgeButtonActions.proc = EventProcDrawingAreaSpliceToAge; 2330: XtAppAddActions(app, &drawingAreaSpliceToAgeButtonActions, 1); 2331: 2332: drawingAreaSpliceToAgeTranslations = 2333: "<Btn1Down>: EventProcDrawingAreaSpliceToAge(but_1_down) ManagerGadgetArm()\n\ 2334: <Btn1Up>: EventProcDrawingAreaSpliceToAge(but_1_up) ManagerGadgetActivate()\n\ 2335: <Btn1Motion>: EventProcDrawingAreaSpliceToAge(but_1_move) ManagerGadgetButtonMotion()\n\ 2336: <Btn2Down>: EventProcDrawingAreaSpliceToAge(but_2_down) ManagerGadgetArm()\n\ 2337: <Btn2Up>: EventProcDrawingAreaSpliceToAge(but_2_up) ManagerGadgetActivate()\n\ 2338: <Btn2Motion>: EventProcDrawingAreaSpliceToAge(but_2_move) ManagerGadgetButtonMotion()\n\ 2339: <Btn3Down>: EventProcDrawingAreaSpliceToAge(but_3_down) ManagerGadgetArm()\n\ 2340: <Btn3Up>: EventProcDrawingAreaSpliceToAge(but_3_up) ManagerGadgetActivate()\n\ 2341: <Btn3Motion>: EventProcDrawingAreaSpliceToAge(but_3_move) ManagerGadgetButtonMotion()\n\ 2342: <KeyDown>Return: EventProcDrawingAreaSpliceToAge(return_down) ManagerGadgetSelect()\n\ 2343: <KeyDown>osfUp: EventProcDrawingAreaSpliceToAge(arrow_up) ManagerGadgetSelect()\n\ 2344: <KeyDown>osfDown: EventProcDrawingAreaSpliceToAge(arrow_down) ManagerGadgetSelect()"; 2345: 2346: XtVaSetValues(*setme, XmNtranslations, XtParseTranslationTable(drawingAreaSpliceToAgeTranslations),NULL); 2347: } 2348: else if(*setme == drawingAreaEdit) 2349: { 2350: drawingAreaEditButtonActions.string = "EventProcDrawingAreaEdit"; 2351: drawingAreaEditButtonActions.proc = EventProcDrawingAreaEdit; 2352: XtAppAddActions(app, &drawingAreaEditButtonActions, 1); 2353: 2354: drawingAreaEditTranslations = 2355: "<Btn1Down>: EventProcDrawingAreaEdit(but_1_down) ManagerGadgetArm()\n\ 2356: <Btn1Up>: EventProcDrawingAreaEdit(but_1_up) ManagerGadgetActivate()\n\ 2357: <Btn1Motion>: EventProcDrawingAreaEdit(but_1_move ManagerGadgetButtonMotion()\n\ 2358: <Btn2Down>: EventProcDrawingAreaEdit(but_2_down) ManagerGadgetArm()\n\ 2359: <Btn2Up>: EventProcDrawingAreaEdit(but_2_up) ManagerGadgetActivate()\n\ 2360: <Btn2Motion>: EventProcDrawingAreaEdit(but_2_move) ManagerGadgetButtonMotion()\n\ 2361: <Btn3Down>: EventProcDrawingAreaEdit(but_3_down) ManagerGadgetArm()\n\ 2362: <Btn3Up>: EventProcDrawingAreaEdit(but_3_up) ManagerGadgetActivate()\n\ 2363: <Btn3Motion>: EventProcDrawingAreaEdit(but_3_move) ManagerGadgetButtonMotion()\n\ 2364: <KeyDown>Return: EventProcDrawingAreaEdit(return_down) ManagerGadgetSelect()\n\ 2365: <KeyDown>osfUp: EventProcDrawingAreaEdit(arrow_up) ManagerGadgetSelect()\n\ 2366: <KeyDown>osfDown: EventProcDrawingAreaEdit(arrow_down) ManagerGadgetSelect()"; 2367: XtVaSetValues(drawingAreaEdit, XmNtranslations, XtParseTranslationTable(drawingAreaEditTranslations),NULL); 2368: } 2369: else if(*setme == drawingAreaView) 2370: { 2371: drawingAreaViewButtonActions.string = "EventProcDrawingAreaView"; 2372: drawingAreaViewButtonActions.proc = EventProcDrawingAreaView; 2373: XtAppAddActions(app, &drawingAreaViewButtonActions, 1); 2374: 2375: drawingAreaViewTranslations = 2376: "<Btn1Down>: EventProcDrawingAreaView(but_1_down) ManagerGadgetArm()\n\ 2377: <Btn1Up>: EventProcDrawingAreaView(but_1_up) ManagerGadgetActivate()\n\ 2378: <Btn1Motion>: EventProcDrawingAreaView(but_1_move) ManagerGadgetButtonMotion()\n\ 2379: <Btn2Down>: EventProcDrawingAreaView(but_2_down) ManagerGadgetArm()\n\ 2380: <Btn2Up>: EventProcDrawingAreaView(but_2_up) ManagerGadgetActivate()\n\ 2381: <Btn2Motion>: EventProcDrawingAreaView(but_2_move) ManagerGadgetButtonMotion()\n\ 2382: <Btn3Down>: EventProcDrawingAreaView(but_3_down) ManagerGadgetArm()\n\ 2383: <Btn3Up>: EventProcDrawingAreaView(but_3_up) ManagerGadgetActivate()\n\ 2384: <Btn3Motion>: EventProcDrawingAreaView(but_3_move) ManagerGadgetButtonMotion()\n\ 2385: <KeyDown>Return: EventProcDrawingAreaView(return_down) ManagerGadgetSelect()\n\ 2386: <KeyDown>osfUp: EventProcDrawingAreaView(arrow_up) ManagerGadgetSelect()\n\ 2387: <KeyDown>osfDown: EventProcDrawingAreaView(arrow_down) ManagerGadgetSelect()"; 2388: XtVaSetValues(drawingAreaView, XmNtranslations, XtParseTranslationTable(drawingAreaViewTranslations),NULL); 2389: } 2390: else if(*setme == drawingAreaCompCorrelation) 2391: { 2392: drawingAreaSpliceCorrelationButtonActions.string = "EventProcDrawingAreaSpliceCorrelation"; 2393: drawingAreaSpliceCorrelationButtonActions.proc = EventProcDrawingAreaSpliceCorrelation; 2394: XtAppAddActions(app, &drawingAreaSpliceCorrelationButtonActions, 1); 2395: 2396: drawingAreaSpliceCorrelationTranslations = 2397: "<Btn1Down>: EventProcDrawingAreaSpliceCorrelation(but_1_down) ManagerGadgetArm()\n\ 2398: <Btn1Up>: EventProcDrawingAreaSpliceCorrelation(but_1_up) ManagerGadgetActivate()\n\ 2399: <Btn1Motion>: EventProcDrawingAreaSpliceCorrelation(but_1_move) ManagerGadgetButtonMotion()"; 2400: XtVaSetValues(drawingAreaCompCorrelation, XmNtranslations, XtParseTranslationTable(drawingAreaSpliceCorrelationTranslations),NULL); 2401: } 2402: else if(*setme == drawingAreaTieCorrelation) 2403: { 2404: drawingAreaTieCorrelationButtonActions.string = "EventProcDrawingAreaTieCorrelation"; 2405: drawingAreaTieCorrelationButtonActions.proc = EventProcDrawingAreaTieCorrelation; 2406: XtAppAddActions(app, &drawingAreaTieCorrelationButtonActions, 1); 2407: 2408: drawingAreaTieCorrelationTranslations = 2409: "<Btn1Down>: EventProcDrawingAreaTieCorrelation(but_1_down) ManagerGadgetArm()\n\ 2410: <Btn1Up>: EventProcDrawingAreaTieCorrelation(but_1_up) ManagerGadgetActivate()\n\ 2411: <Btn1Motion>: EventProcDrawingAreaTieCorrelation(but_1_move) ManagerGadgetButtonMotion()"; 2412: 2413: XtVaSetValues(drawingAreaTieCorrelation, XmNtranslations, XtParseTranslationTable(drawingAreaTieCorrelationTranslations),NULL); 2414: } 2415: else if(*setme == drawingAreaTieToTimeSeriesCorr) 2416: { 2417: drawingAreaTieToTimeSeriesCorrButtonActions.string = "EventProcDrawingAreaTieToTimeSeriesCorr"; 2418: drawingAreaTieToTimeSeriesCorrButtonActions.proc = EventProcDrawingAreaTieToTimeSeriesCorr; 2419: XtAppAddActions(app, &drawingAreaTieToTimeSeriesCorrButtonActions, 1); 2420: 2421: drawingAreaTieToTimeSeriesCorrTranslations = 2422: "<Btn1Down>: EventProcDrawingAreaTieToTimeSeriesCorr(but_1_down) ManagerGadgetArm()\n\ 2423: <Btn1Up>: EventProcDrawingAreaTieToTimeSeriesCorr(but_1_up) ManagerGadgetActivate()\n\ 2424: <Btn1Motion>: EventProcDrawingAreaTieToTimeSeriesCorr(but_1_move) ManagerGadgetButtonMotion()"; 2425: 2426: XtVaSetValues(drawingAreaTieToTimeSeriesCorr, XmNtranslations, XtParseTranslationTable(drawingAreaTieToTimeSeriesCorrTranslations),NULL); 2427: } 2428: } 2429: 2430: /* ARGSUSED */ 2431: void 2432: SpMessageBoxInfoCB(w, client, call) 2433: Widget w; 2434: XtPointer client; 2435: XtPointer call; 2436: { 2437: void exit(); 2438: 2439: /*SUPPRESS 594*/ 2440: XtUnmanageChild(messageBoxInfo); 2441: if(message.fatal) 2442: { 2443: 2444: SpCleanUp(EXIT); 2445: exit(0); 2446: } 2447: message.error=False; 2448: free(message.label); 2449: message.label=NULL; 2450: } 2451: 2452: /* ARGSUSED */ 2453: void 2454: SpOutputOKCB(w, client, call) 2455: Widget w; 2456: XtPointer client; 2457: XtPointer call; 2458: { 2459: int readable, len; 2460: char *testdir; 2461: XmString xmstring; 2462: XtWorkProc SpOutputData; 2463: 2464: /*SUPPRESS 594*/ 2465: 2466: /* check that is a directory 2467: */ 2468: testdir = XmTextGetString(textFieldSaveDataDirectory); 2469: readable = VerifyFileReadable(testdir, SAVE, SAVEDATA); 2470: if(readable == NO) { 2471: (void)sprintf(buffer,"%s is not a directory.",testdir); 2472: free(testdir); 2473: XmTextSetString(textFieldAffineFileName,""); 2474: SpManageWarningBox(buffer); 2475: return; 2476: } 2477: else { 2478: 2479: free(outdata_dirname); 2480: if((outdata_dirname=(char*)calloc((int)strlen(testdir)+5,CHAR_SIZE))==NULL) 2481: SpBadMemAlloc("OpenSplicerTable"); 2482: (void)sprintf(outdata_dirname, "%s", testdir); 2483: 2484: len = (int)strlen(outdata_dirname); 2485: if(strcmp(&outdata_dirname[len-1], "/") != 0) { 2486: (void)strcat(outdata_dirname, "/"); 2487: } 2488: 2489: XtUnmanageChild(formOutput); 2490: 2491: /* start working procedure for reading splicer table*/ 2492: work_id=XtAppAddWorkProc(app,SpOutputData,messageBoxWorking); 2493: /* display working box */ 2494: xmstring=XmStringCreateLocalized("Output : writing output data."); 2495: XtVaSetValues(messageBoxWorking,XmNmessageString,xmstring, NULL); 2496: XmStringFree(xmstring); 2497: XtManageChild(messageBoxWorking); 2498: XtPopup(XtParent(messageBoxWorking),XtGrabNone); 2499: } 2500: } 2501: 2502: /* ARGSUSED */ 2503: void 2504: SpViewReportCB(w, client, call) 2505: Widget w; 2506: XtPointer client; 2507: XtPointer call; 2508: { 2509: 2510: /*SUPPRESS 594*/ 2511: 2512: XmString xmstring; 2513: char *string; 2514: 2515: XtVaGetValues(pushButtonViewReport, XmNlabelString, &xmstring, NULL); 2516: if(!XmStringGetLtoR(xmstring,XmFONTLIST_DEFAULT_TAG,&string)) 2517: { 2518: message.error=True; 2519: message.fatal=False; 2520: message.caller=NONE; 2521: message.type=XmDIALOG_WARNING; 2522: message.default_button=XmDIALOG_OK_BUTTON; 2523: if((message.label=(char*)calloc(200,CHAR_SIZE))==NULL) 2524: SpBadMemAlloc("SpViewReportCB 1"); 2525: else 2526: (void)sprintf(message.label,"Unable to convert report label to char"); 2527: SpManageMessage(message); 2528: } 2529: /* XmStringFree(xmstring); 2530: */ 2531: if((int)strcmp(string, "View Report") == 0){ 2532: 2533: /* XtManageChild(formTextReport); */ 2534: if(!XtIsManaged(XtParent(formTextReport))) { 2535: XtManageChild(formTextReport); 2536: } 2537: XtPopup(XtParent(formTextReport), XtGrabNone); 2538: 2539: xmstring=XmCvtCTToXmString("Hide Report"); 2540: XtVaSetValues(pushButtonViewReport,XmNlabelString,xmstring,NULL); 2541: XmStringFree(xmstring); 2542: } 2543: else if((int)strcmp(string, "Hide Report") == 0) { 2544: 2545: /* XtUnmanageChild(formTextReport); */ 2546: XtPopdown(XtParent(formTextReport)); 2547: xmstring=XmCvtCTToXmString("View Report"); 2548: XtVaSetValues(pushButtonViewReport,XmNlabelString,xmstring,NULL); 2549: XmStringFree(xmstring); 2550: } 2551: XtFree(string); 2552: } 2553: 2554: 2555: /* ARGSUSED */ 2556: void 2557: EventProcDrawingAreaEdit(w, event, args, num_args) 2558: Widget w; 2559: XButtonEvent *event; 2560: String *args; 2561: int *num_args; 2562: { 2563: int x, y, i, j, k, holenum, corenum, arraynum, sm, err1, err2, 2564: starting_hole, report_tie1, report_tie2, found_strat, save_tie1, save_tie2; 2565: char string[200], idstring[200], varstring[20], coreselectstring[5]; 2566: float depth, chlow, chhigh, diff, *var_val, avedep, avedep1, avedep2; 2567: double checkdep; 2568: Dimension win_height, win_width; 2569: String str; 2570: XmString xmstring; 2571: void DrawDrawingAreaEdit(), TieCorrelate(), GetSelectCore(), TieShift(); 2572: 2573: x = event->x; 2574: y = event->y; 2575: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 2576: (void)sprintf(string, ""); 2577: 2578: if(have_data == DONT) { 2579: last_tie = NONE; 2580: have_tie1 = DONT; 2581: have_tie2 = DONT; 2582: have_tie = DONT; 2583: } 2584: else if(y < 0 || y > (int)win_height || x < OFF || x > (int)win_width){ 2585: (void)sprintf(string, ""); 2586: xmstring = XmStringCreateSimple(string); 2587: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 2588: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 2589: XmStringFree(xmstring); 2590: } 2591: else if(have_data == DO) { 2592: 2593: /* calculate the cursor location in depth(m) 2594: note that top_off_edit is the pixel offset from top of drawingAreaEdit 2595: and top_meter_edit is the value of the top of the depth axis 2596: */ 2597: depth = (((y - top_off_edit) * depperpix) + top_meter_edit); 2598: 2599: /* get the cores scale value. it will be the array num of 2600: the first hole to search. in other words; where to 'skip to' 2601: */ 2602: XmScaleGetValue(scaleCores, &starting_hole); 2603: if(starting_hole >= data[dset]->numholes || starting_hole < 0) { 2604: return; 2605: } 2606: 2607: if(have_tie1 == DONT && have_tie2 == DONT) { 2608: last_tie = NONE; 2609: } 2610: else if(have_tie1 == DONT && last_tie == TIE1) { 2611: if(have_tie2 == DO){ 2612: last_tie = TIE2; 2613: } 2614: else { 2615: last_tie = NONE; 2616: } 2617: } 2618: else if(have_tie2 == DONT && last_tie == TIE2) { 2619: if(have_tie1 == DO){ 2620: last_tie = TIE1; 2621: } 2622: else { 2623: last_tie = NONE; 2624: } 2625: } 2626: 2627: report_tie1 = NO; 2628: report_tie2 = NO; 2629: 2630: /* smoothed and if so plot type 2631: */ 2632: if(smooth.plot == NONE || smooth.plot == UNSMOOTHED){ 2633: sm = NO; 2634: } 2635: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 2636: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 2637: sm = YES; 2638: } 2639: else { 2640: sm = NO; 2641: } 2642: 2643: /* event is any button up, down or move 2644: */ 2645: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || 2646: (int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0 || 2647: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) { 2648: 2649: /* find the nearest sample to cursor pixel location 2650: */ 2651: /* if are compositing, only look for hole and core if is button down event or button one move. 2652: a button 2 or 3 move would mean have allready picked a point in a core 2653: and are now moving up or down the same core 2654: */ 2655: if( (((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_2_down") == 0 || 2656: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0) && are_compositing == YES) || 2657: (((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || 2658: (int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0 || 2659: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) && are_compositing == NO)) { 2660: 2661: /* find which hole 2662: */ 2663: holenum = -1; 2664: corenum = -1; 2665: for(i=starting_hole; i<data[dset]->numholes; ++i){ 2666: if(x >= OFF + SPACE + (i - starting_hole) * (varaxislen + SPACE) && 2667: x <= OFF + SPACE + (i - starting_hole) * (varaxislen + SPACE) + varaxislen) { 2668: holenum = i; 2669: break; 2670: } 2671: } 2672: 2673: /* find which core 2674: */ 2675: if(holenum != -1) { 2676: for(j=0; j < data[dset]->holes[holenum]->numcores; ++j){ 2677: if(data[dset]->holes[holenum]->core[j]->value[0]->quality == BAD_CORE_NUM){ 2678: } 2679: else { 2680: for(k=0; data[dset]->holes[holenum]->core[j]->value[k]->quality != GOOD; ++k){ 2681: if(k >= data[dset]->holes[holenum]->core[j]->numvalues){ 2682: return; 2683: } 2684: } 2685: chlow=data[dset]->holes[holenum]->core[j]->value[k]->sb_depth + 2686: data[dset]->holes[holenum]->core[j]->cum_dep_offset; 2687: for(k=data[dset]->holes[holenum]->core[j]->numvalues -1; 2688: data[dset]->holes[holenum]->core[j]->value[k]->quality != GOOD; --k){ 2689: if(k <= 0){ 2690: return; 2691: } 2692: } 2693: chhigh= data[dset]->holes[holenum]->core[j]->value[k]->sb_depth + 2694: data[dset]->holes[holenum]->core[j]->cum_dep_offset; 2695: if(depth >= chlow && depth <= chhigh){ 2696: if(smooth.plot == SMOOTHED && data[dset]->holes[holenum]->core[j]->smooth_status != SMOK) { 2697: return; 2698: } 2699: else if(data[dset]->holes[holenum]->core[j]->smooth_status != SMOK) { 2700: sm = NO; 2701: } 2702: corenum=j; 2703: break; 2704: } 2705: } 2706: } 2707: } 2708: } 2709: 2710: else if(last_tie == TIE1) { 2711: holenum = tie1holenum; 2712: corenum = tie1corenum; 2713: } 2714: 2715: else if(last_tie == TIE2) { 2716: holenum = tie2holenum; 2717: corenum = tie2corenum; 2718: } 2719: 2720: else { 2721: return; 2722: } 2723: 2724: /* find nearest good sample 2725: */ 2726: arraynum = -1; 2727: if(corenum != -1) { 2728: diff = 99999.0; 2729: for(k=0; k<data[dset]->holes[holenum]->core[corenum]->numvalues; ++k){ 2730: checkdep = depth - (data[dset]->holes[holenum]->core[corenum]->value[k]->sb_depth + 2731: data[dset]->holes[holenum]->core[corenum]->cum_dep_offset); 2732: if(data[dset]->holes[holenum]->core[corenum]->value[k]->quality != GOOD) { 2733: } 2734: else if(fabs(checkdep) < diff){ 2735: diff = fabs(checkdep); 2736: arraynum = k; 2737: } 2738: } 2739: } 2740: 2741: /* did not find a core sample. if have strat data, is cursor over one of the datums? 2742: */ 2743: if((holenum == -1 && corenum == -1 && arraynum == -1) && have_strat == DO) { 2744: found_strat = NO; 2745: for(i=0; i<strat_file_cnt; ++i){ 2746: if(found_strat == YES) { 2747: break; 2748: } 2749: for(j=0; j<strat[i]->data_cnt; ++j){ 2750: if(strat[i]->data[j].x_pix_loc_edit < 0 || strat[i]->data[j].y_pix_loc_edit < 0) { 2751: 2752: } 2753: else if(abs(strat[i]->data[j].x_pix_loc_edit + 5 - x) < CLOSE && 2754: abs(strat[i]->data[j].y_pix_loc_edit - 5 - y) < CLOSE) { 2755: found_strat = YES; 2756: if(fabs(strat[i]->data[j].top_age - strat[i]->data[j].bot_age) < ROUNDCHECK) { 2757: (void)sprintf(string,"hole %c %s %6.3f Ma %6.2f to %6.2f mbsf %6.2f to %6.2f mcd", 2758: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].top_age, 2759: strat[i]->data[j].top.sb_depth, strat[i]->data[j].bot.sb_depth, 2760: strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset, 2761: strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset); 2762: } 2763: else { 2764: (void)sprintf(string,"hole %c %s %6.3f to %6.3f Ma %6.2f to %6.2f mbsf %6.2f to %6.2f mcd", 2765: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].top_age, strat[i]->data[j].bot_age, 2766: strat[i]->data[j].top.sb_depth, strat[i]->data[j].bot.sb_depth, 2767: strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset, 2768: strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset); 2769: } 2770: xmstring = XmStringCreateSimple(string); 2771: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 2772: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 2773: XmStringFree(xmstring); 2774: return; 2775: } 2776: } 2777: } 2778: } 2779: else { 2780: found_strat = NO; 2781: } 2782: 2783: if(holenum == -1 || corenum == -1 || arraynum == -1) { 2784: report_tie1 = NO; 2785: report_tie2 = NO; 2786: last_tie = NONE; 2787: (void)sprintf(string, ""); 2788: xmstring = XmStringCreateSimple(string); 2789: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 2790: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 2791: XmStringFree(xmstring); 2792: } 2793: 2794: /* found a core sample 2795: */ 2796: else if(holenum != -1 && corenum != -1 && arraynum != -1 && found_strat == NO){ 2797: 2798: var_val = data[dset]->holes[holenum]->core[corenum]->value[arraynum]->data; 2799: if(have_affine == DO){ 2800: depth = data[dset]->holes[holenum]->core[corenum]->value[arraynum]->sb_depth + 2801: data[dset]->holes[holenum]->core[corenum]->cum_dep_offset; 2802: (void)sprintf(string,"%d %c %d %c %s %.1f %.2f(mbsf) %.2f(mcd) %.2f(m, offset) %.2f", 2803: data[dset]->site, 2804: data[dset]->holes[holenum]->name, 2805: data[dset]->holes[holenum]->core[corenum]->num, 2806: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->type, 2807: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->section, 2808: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->top_int, 2809: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->sb_depth, 2810: depth, 2811: data[dset]->holes[holenum]->core[corenum]->cum_dep_offset, 2812: *var_val); 2813: } 2814: else if(have_affine == DONT) { 2815: (void)sprintf(string,"%d %c %d %c %s %.1f %.2f(mbsf) %.2f", 2816: data[dset]->site, 2817: data[dset]->holes[holenum]->name, 2818: data[dset]->holes[holenum]->core[corenum]->num, 2819: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->type, 2820: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->section, 2821: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->top_int, 2822: data[dset]->holes[holenum]->core[corenum]->value[arraynum]->sb_depth, 2823: *var_val); 2824: } 2825: if(sm == YES && data[dset]->holes[holenum]->core[corenum]->value[arraynum]->smooth_ok == SMOK) { 2826: (void)sprintf(varstring, " %.2f", data[dset]->holes[holenum]->core[corenum]->value[arraynum]->sm_data); 2827: strncat(string, varstring, (int)strlen(varstring)); 2828: } 2829: 2830: xmstring = XmStringCreateSimple(string); 2831: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 2832: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 2833: XmStringFree(xmstring); 2834: 2835: if(((int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0) && 2836: scale_val != data[dset]->numholes - 1 && are_compositing == YES) { 2837: have_tie1 = DO; 2838: tie1holenum = holenum; 2839: tie1corenum = corenum; 2840: tie1arraynum = arraynum; 2841: last_tie = TIE1; 2842: report_tie1 = YES; 2843: report_tie2 = NO; 2844: if((have_tie2 == DO && tie1holenum == tie2holenum && tie1corenum == tie2corenum) || have_tie2 == DONT) { 2845: have_tie2 = DONT; 2846: have_tie = DONT; 2847: have_shift = DONT; 2848: (void)sprintf(string, ""); 2849: xmstring = XmStringCreateSimple(string); 2850: XtVaSetValues(labelTie2ID, XmNlabelString, xmstring, NULL); 2851: XtVaSetValues(labelTie2var, XmNlabelString, xmstring, NULL); 2852: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 2853: XmStringFree(xmstring); 2854: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 2855: have_corr = DONT; 2856: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 2857: XClearWindow(XtDisplay(drawingAreaTieCorrelation), 2858: XtWindow(drawingAreaTieCorrelation)); 2859: } 2860: XtSetSensitive(pushButtonTieCorrelation, False); 2861: XtSetSensitive(pushButtonTieShift, False); 2862: } 2863: } 2864: else if(((int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) && 2865: scale_val != data[dset]->numholes - 1 && are_compositing == YES) { 2866: have_tie2 = DO; 2867: tie2holenum = holenum; 2868: tie2corenum = corenum; 2869: tie2arraynum = arraynum; 2870: last_tie = TIE2; 2871: report_tie2 = YES; 2872: report_tie1 = NO; 2873: if((have_tie1 == DO && tie1holenum == tie2holenum && tie1corenum == tie2corenum) || have_tie1 == DONT) { 2874: have_tie1 = DONT; 2875: have_tie = DONT; 2876: have_shift = DONT; 2877: (void)sprintf(string, ""); 2878: xmstring = XmStringCreateSimple(string); 2879: XtVaSetValues(labelTie1ID, XmNlabelString, xmstring, NULL); 2880: XtVaSetValues(labelTie1var, XmNlabelString, xmstring, NULL); 2881: XtVaSetValues(labelTie1sbd, XmNlabelString, xmstring, NULL); 2882: XmStringFree(xmstring); 2883: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 2884: have_corr = DONT; 2885: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 2886: XClearWindow(XtDisplay(drawingAreaTieCorrelation), 2887: XtWindow(drawingAreaTieCorrelation)); 2888: } 2889: XtSetSensitive(pushButtonTieCorrelation, False); 2890: XtSetSensitive(pushButtonTieShift, False); 2891: } 2892: } 2893: else { 2894: last_tie = NONE; 2895: report_tie2 = NO; 2896: report_tie1 = NO; 2897: } 2898: } 2899: 2900: 2901: /*also use button down for splice core grab so set the text hole and 2902: core to grab fields 2903: */ 2904: if(holenum != -1 && corenum != -1 && (are_splicing == CONSTRAINED || are_splicing == UNCONSTRAINED)) { 2905: (void)sprintf(coreselectstring, "%c", data[dset]->holes[holenum]->name); 2906: XtVaSetValues(textCompSelectHole, XmNvalue, coreselectstring, NULL); 2907: (void)sprintf(coreselectstring, "%d %c", data[dset]->holes[holenum]->core[corenum]->num, 2908: data[dset]->holes[holenum]->core[corenum]->value[0]->type); 2909: XtVaSetValues(textCompSelectCore, XmNvalue, coreselectstring, NULL); 2910: } 2911: else if(are_splicing == CONSTRAINED || are_splicing == UNCONSTRAINED) { 2912: (void)sprintf(coreselectstring, ""); 2913: XtVaSetValues(textCompSelectHole, XmNvalue, coreselectstring, NULL); 2914: XtVaSetValues(textCompSelectCore, XmNvalue, coreselectstring, NULL); 2915: } 2916: } 2917: 2918: else if((int)strcmp(args[0], "but_1_up") == 0 || (int)strcmp(args[0], "but_2_up") == 0 || (int)strcmp(args[0], "but_3_up") == 0) { 2919: (void)sprintf(string,""); 2920: xmstring = XmStringCreateSimple(string); 2921: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 2922: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 2923: XmStringFree(xmstring); 2924: report_tie1 = NO; 2925: report_tie2 = NO; 2926: } 2927: 2928: /* event was an arrow key up. 2929: deincrement the array number of core last picked 2930: */ 2931: if((int)strcmp(args[0], "arrow_up") == 0 && last_tie != NONE && are_compositing == YES && 2932: scale_val != data[dset]->numholes - 1){ 2933: 2934: if(last_tie == TIE1){ 2935: if(tie1arraynum - 1 >= 0){ 2936: --tie1arraynum; 2937: report_tie1 = YES; 2938: report_tie2 = NO; 2939: } 2940: else { 2941: return; 2942: } 2943: } 2944: else if(last_tie == TIE2){ 2945: if(tie2arraynum - 1 >= 0){ 2946: --tie2arraynum; 2947: report_tie2 = YES; 2948: report_tie1 = NO; 2949: } 2950: else { 2951: return; 2952: } 2953: } 2954: } 2955: 2956: /* event was an arrow key down. 2957: increment the array number of core last picked 2958: */ 2959: else if((int)strcmp(args[0], "arrow_down") == 0 && last_tie != NONE && are_compositing == YES && 2960: scale_val != data[dset]->numholes - 1){ 2961: 2962: if(last_tie == TIE1){ 2963: if(tie1arraynum + 1 < data[dset]->holes[tie1holenum]->core[tie1corenum]->numvalues){ 2964: ++tie1arraynum; 2965: report_tie1 = YES; 2966: report_tie2 = NO; 2967: } 2968: else { 2969: return; 2970: } 2971: } 2972: else if(last_tie == TIE2){ 2973: if(tie2arraynum + 1 < data[dset]->holes[tie2holenum]->core[tie2corenum]->numvalues){ 2974: ++tie2arraynum; 2975: report_tie2 = YES; 2976: report_tie1 = NO; 2977: } 2978: else { 2979: return; 2980: } 2981: } 2982: } 2983: 2984: /* event was a return key press. Depth shift. 2985: */ 2986: if((int)strcmp(args[0], "return_down") == 0) { 2987: if(are_compositing == YES && have_tie1 == DO && have_tie2 == DO && have_corr == DO) { 2988: TieShift((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 2989: } 2990: } 2991: 2992: if(report_tie1 == YES) { 2993: var_val = data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->data; 2994: depth = data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth + 2995: data[dset]->holes[tie1holenum]->core[tie1corenum]->cum_dep_offset; 2996: (void)sprintf(idstring,"%d %c %d %c %s %.1f %.2f", 2997: data[dset]->site, 2998: data[dset]->holes[tie1holenum]->name, 2999: data[dset]->holes[tie1holenum]->core[tie1corenum]->num, 3000: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->type, 3001: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->section, 3002: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->top_int, 3003: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth); 3004: xmstring = XmStringCreateSimple(idstring); 3005: XtVaSetValues(labelTie1ID, XmNlabelString, xmstring, NULL); 3006: XmStringFree(xmstring); 3007: (void)sprintf(string, "%.2f", *var_val); 3008: xmstring = XmStringCreateSimple(string); 3009: XtVaSetValues(labelTie1var, XmNlabelString, xmstring, NULL); 3010: XmStringFree(xmstring); 3011: (void)sprintf(string, "%.2f", depth); 3012: xmstring = XmStringCreateSimple(string); 3013: XtVaSetValues(labelTie1sbd, XmNlabelString, xmstring, NULL); 3014: XmStringFree(xmstring); 3015: } 3016: 3017: if(report_tie2 == YES) { 3018: var_val = data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->data; 3019: depth = data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth + 3020: data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset; 3021: (void)sprintf(idstring,"%d %c %d %c %s %.1f %.2f", 3022: data[dset]->site, 3023: data[dset]->holes[tie2holenum]->name, 3024: data[dset]->holes[tie2holenum]->core[tie2corenum]->num, 3025: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->type, 3026: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->section, 3027: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->top_int, 3028: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth); 3029: xmstring = XmStringCreateSimple(idstring); 3030: XtVaSetValues(labelTie2ID, XmNlabelString, xmstring, NULL); 3031: XmStringFree(xmstring); 3032: (void)sprintf(string, "%.2f", *var_val); 3033: xmstring = XmStringCreateSimple(string); 3034: XtVaSetValues(labelTie2var, XmNlabelString, xmstring, NULL); 3035: XmStringFree(xmstring); 3036: (void)sprintf(string, "%.2f", depth); 3037: xmstring = XmStringCreateSimple(string); 3038: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 3039: XmStringFree(xmstring); 3040: } 3041: 3042: if((have_tie1 == YES && have_tie2 == NO) || (have_tie1 == NO && have_tie2 == YES)) { 3043: have_corr = DONT; 3044: have_shift = DONT; 3045: have_tie = DONT; 3046: if(are_compositing == YES && (report_tie1 == YES || report_tie2 == YES)) { 3047: if(XtIsManaged(XtParent(drawingAreaEdit))) { 3048: /* 3049: this code intended for clip option that currently 3050: is not in use. save it for when this option is ready 3051: save_tie1 = have_tie1; 3052: save_tie2 = have_tie2; 3053: have_tie1 = DONT; 3054: have_tie2 = DONT; 3055: reason_for_redraw = DRAW_CLEARTIE; 3056: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 3057: have_tie1 = save_tie1; 3058: have_tie2 = save_tie2; 3059: */ 3060: reason_for_redraw = DRAW_TIES; 3061: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 3062: } 3063: } 3064: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 3065: XClearWindow(XtDisplay(drawingAreaTieCorrelation), 3066: XtWindow(drawingAreaTieCorrelation)); 3067: } 3068: XtSetSensitive(pushButtonTieCorrelation, False); 3069: XtSetSensitive(textFieldTieAdjustDepth, False); 3070: 3071: /* set the window length and lead,lag to the defaults 3072: */ 3073: str = XmTextGetString(textFieldTieWinLen); 3074: (void)sprintf(string, "%.2f", WINLEN); 3075: if((int)strcmp(str, string) != 0) { 3076: XtVaSetValues(textFieldTieWinLen, XmNvalue, string, NULL); 3077: } 3078: XtFree(str); 3079: str = XmTextGetString(textFieldTieLeadLag); 3080: (void)sprintf(string, "%.2f", LEADLAG); 3081: if((int)strcmp(str, string) != 0) { 3082: XtVaSetValues(textFieldTieLeadLag, XmNvalue, string, NULL); 3083: } 3084: XtFree(str); 3085: str = XmTextGetString(textFieldTieDepthStep); 3086: (void)sprintf(string, ""); 3087: if((int)strcmp(str, string) != 0) { 3088: XtVaSetValues(textFieldTieDepthStep, XmNvalue, string, NULL); 3089: } 3090: XtFree(str); 3091: } 3092: 3093: else if(have_tie1 == DO && have_tie2 == DO && are_compositing == YES && (report_tie1 == YES || report_tie2 == YES)) { 3094: 3095: have_tie = DO; 3096: have_shift = DO; 3097: 3098: /* calculate the average depth step for current 3099: 'tied' cores. and set the text fields with 3100: ave depth step, default window length 3101: and lead,lag 3102: */ 3103: err1 = FindAveDepth(tie1holenum, tie1corenum, &avedep1); 3104: err2 = FindAveDepth(tie2holenum, tie2corenum, &avedep2); 3105: if(err1 > 1 || err2 > 1) { 3106: return; 3107: } 3108: avedep = (avedep1 + avedep2)/2.0; 3109: 3110: /* set the text field with ave depth 3111: */ 3112: str = XmTextGetString(textFieldTieDepthStep); 3113: (void)sprintf(string, "%.2f", avedep); 3114: if((int)strcmp(str, string) != 0) { 3115: XtVaSetValues(textFieldTieDepthStep, XmNvalue, string, NULL); 3116: } 3117: XtFree(str); 3118: 3119: /* make clear and correlate buttons sensitive 3120: */ 3121: XtSetSensitive(pushButtonTieClear, True); 3122: XtSetSensitive(pushButtonTieCorrelation, True); 3123: XtSetSensitive(pushButtonTieShiftUndo, False); 3124: XtSetSensitive(toggleButtonTieUndoLast, False); 3125: XtSetSensitive(toggleButtonTieUndoAll, False); 3126: 3127: 3128: /* clear the tie, depth step and adjust depth text 3129: and set the window length and leadlag back to default 3130: 3131: (void)sprintf(string, ""); 3132: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 3133: */ 3134: 3135: /* set the toggles back to defaults 3136: */ 3137: XmToggleButtonSetState(toggleButtonTieShiftBestCorr, True, NULL); 3138: XmToggleButtonSetState(toggleButtonTieShiftTie, False, NULL); 3139: XmToggleButtonSetState(toggleButtonTieShiftGiven, False, NULL); 3140: XmToggleButtonSetState(toggleButtonTieShiftAll, True, NULL); 3141: XmToggleButtonSetState(toggleButtonTieShiftCore, False, NULL); 3142: 3143: TieCorrelate((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 3144: } 3145: } 3146: 3147: else { 3148: } 3149: 3150: (void)sprintf(string, ""); 3151: (void)sprintf(idstring, ""); 3152: (void)sprintf(varstring, ""); 3153: (void)sprintf(coreselectstring, ""); 3154: } 3155: 3156: /* ARGSUSED */ 3157: void 3158: EventProcDrawingAreaView(w, event, args, num_args) 3159: Widget w; 3160: XButtonEvent *event; 3161: String *args; 3162: int *num_args; 3163: { 3164: int x, y, i, j, k, n, corenum, arraynum, sm, err1, err2, 3165: hole, core, num, report_tie1, report_tie2, err, found_strat, spl_last_core_exist; 3166: char string[200], varstring[20], tie1idstring[200], tie2idstring[200]; 3167: float cursor_depth, depth, chlow, chhigh, diff, var, raw_val, sm_val, *pval1, 3168: avedep, avedep1, avedep2; 3169: double checkdep; 3170: String str; 3171: XmString xmstring; 3172: Dimension win_height, win_width; 3173: int FindValueInCoreToSplice(); 3174: void SpliceCorrelate(), SpliceClearTie(), SpliceToTie(), AppendSplice(); 3175: 3176: x = event->x; 3177: y = event->y; 3178: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 3179: (void)sprintf(string, ""); 3180: 3181: if(have_splice == DONT) { 3182: last_sp_tie = NONE; 3183: have_sp_tie1 = DONT; 3184: have_sp_tie2 = DONT; 3185: } 3186: else if(y < 0 || y > (int)win_height || x < OFF || x > (int)win_width){ 3187: (void)sprintf(string, ""); 3188: xmstring = XmStringCreateSimple(string); 3189: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 3190: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 3191: XmStringFree(xmstring); 3192: } 3193: else if(have_splice == DO) { 3194: 3195: /* calculate the cursor location in depth(m) 3196: note that top_off_view is the pixel offset from top of drawingAreaEdit 3197: and top_meter_view is the value of the top of the depth axis 3198: */ 3199: cursor_depth = (((y - top_off_view) * depperpixsp) + top_meter_view); 3200: 3201: if(have_sp_tie1 == DONT && have_sp_tie2 == DONT) { 3202: last_sp_tie = NONE; 3203: } 3204: else if(have_sp_tie1 == DONT && last_sp_tie == TIE1) { 3205: if(have_sp_tie2 == DO){ 3206: last_sp_tie = TIE2; 3207: } 3208: else { 3209: last_sp_tie = NONE; 3210: } 3211: } 3212: else if(have_sp_tie2 == DONT && last_sp_tie == TIE2) { 3213: if(have_sp_tie1 == DO){ 3214: last_sp_tie = TIE1; 3215: } 3216: else { 3217: last_sp_tie = NONE; 3218: } 3219: } 3220: 3221: report_tie1 = NO; 3222: report_tie2 = NO; 3223: 3224: /* smoothed? 3225: */ 3226: if(smooth.method == NONE || smooth.plot == UNSMOOTHED){ 3227: sm = NO; 3228: } 3229: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 3230: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 3231: sm = YES; 3232: } 3233: else { 3234: sm = NO; 3235: } 3236: 3237: /* event is any button down or move 3238: */ 3239: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || 3240: (int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0 || 3241: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) { 3242: 3243: 3244: /* are in the area of window where splice is drawn 3245: */ 3246: if(x >= OFF + SPACE && x < OFF + SPACE + varaxislen){ 3247: 3248: /* find the nearest sample to cursor pixel location 3249: */ 3250: if(((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_2_down") == 0 || 3251: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || (int)strcmp(args[0], "but_3_move") == 0) || 3252: ((int)strcmp(args[0], "but_2_move") == 0 && are_splicing == NO) || 3253: ((int)strcmp(args[0], "but_2_move") == 0 && are_splicing > NO && have_core_to_splice == DONT) || 3254: ((int)strcmp(args[0], "but_2_move") == 0 && (are_splicing == CONSTRAINED && splice_overlap == NO)) ) { 3255: 3256: corenum = -1; 3257: 3258: /* find which core. note that all samples should 3259: be good because spcomp.var is composed with CleanUpSpliceCore 3260: */ 3261: for(j=0; j < spcomp.numcores; ++j){ 3262: chlow = spcomp.sb_depth[j][0]; 3263: chhigh = spcomp.sb_depth[j][spcomp.numpercore[j] - 1]; 3264: if(cursor_depth >= chlow && cursor_depth <= chhigh){ 3265: if(smooth.plot == SMOOTHED && 3266: data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 3267: return; 3268: } 3269: else if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 3270: sm = NO; 3271: } 3272: corenum = j; 3273: break; 3274: } 3275: } 3276: } 3277: else if((int)strcmp(args[0], "but_2_move") == 0 && last_sp_tie == TIE1) { 3278: corenum = spcompcorenum; 3279: } 3280: else { 3281: return; 3282: } 3283: 3284: /* find nearest sample. 3285: */ 3286: arraynum = -1; 3287: if(corenum != -1) { 3288: diff = 99999.0; 3289: for(k=0; k<spcomp.numpercore[corenum]; ++k){ 3290: checkdep = cursor_depth - spcomp.sb_depth[corenum][k]; 3291: if(fabs(checkdep) < diff){ 3292: diff = fabs(checkdep); 3293: arraynum = k; 3294: } 3295: } 3296: } 3297: 3298: if(corenum == -1 || arraynum == -1) { 3299: (void)sprintf(string, ""); 3300: if((int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0) { 3301: have_sp_tie1 = DONT; 3302: if(are_splicing == CONSTRAINED) { 3303: have_sp_tie2 = DONT; 3304: } 3305: } 3306: } 3307: else if(corenum != -1 && arraynum != -1) { 3308: hole = spcomp.hole[corenum]; 3309: core = spcomp.core[corenum]; 3310: num = spcomp.MapToOrig[corenum][arraynum]; 3311: depth = spcomp.sb_depth[corenum][arraynum]; 3312: var = spcomp.var[corenum][arraynum]; 3313: (void)sprintf(string,"%d %c %d %c %s %.1f %.2f(mbsf) %.2f(mcd) %.2f", 3314: data[dset]->site, 3315: data[dset]->holes[hole]->name, 3316: data[dset]->holes[hole]->core[core]->num, 3317: data[dset]->holes[hole]->core[core]->value[num]->type, 3318: data[dset]->holes[hole]->core[core]->value[num]->section, 3319: data[dset]->holes[hole]->core[core]->value[num]->top_int, 3320: data[dset]->holes[hole]->core[core]->value[num]->sb_depth, 3321: depth, 3322: var); 3323: if(sm == YES && data[dset]->holes[hole]->core[core]->value[num]->smooth_ok == SMOK) { 3324: (void)sprintf(varstring, " %.2f", data[dset]->holes[hole]->core[core]->value[num]->sm_data); 3325: strncat(string, varstring, (int)strlen(varstring)); 3326: } 3327: if(((int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0) && have_core_to_splice == DO) { 3328: if(are_splicing == CONSTRAINED && splice_overlap == NO) { 3329: have_sp_tie1 = DONT; 3330: have_sp_tie2 = DONT; 3331: } 3332: else { 3333: 3334: 3335: /* for current data set does the last core of splice exist 3336: */ 3337: if(spcomp.numcores > 0) { 3338: 3339: hole = spcomp.hole[spcomp.numcores-1]; 3340: core = spcomp.core[spcomp.numcores-1]; 3341: if(data[dset]->holes[hole]->name == splicertable.data[splicertable.data_cnt -1].hole && 3342: data[dset]->holes[hole]->core[core]->num == splicertable.data[splicertable.data_cnt -1].core) { 3343: spl_last_core_exist = YES; 3344: } 3345: else { 3346: spl_last_core_exist = NO; 3347: } 3348: } 3349: else { 3350: spl_last_core_exist = NO; 3351: } 3352: 3353: 3354: if(are_splicing == CONSTRAINED && spl_last_core_exist == YES) { 3355: depth = spcomp.sb_depth[corenum][arraynum]; 3356: n = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues; 3357: 3358: 3359: for(k=0; data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->quality != GOOD; ++k){ 3360: if(k >= n){ 3361: return; 3362: } 3363: } 3364: chlow=data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->sb_depth + 3365: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 3366: for(k=n-1; data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->quality != GOOD; --k){ 3367: if(k <= 0){ 3368: return; 3369: } 3370: } 3371: chhigh= data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->sb_depth + 3372: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 3373: 3374: if(depth < chlow || depth > chhigh){ 3375: } 3376: else { 3377: 3378: /* note that if find real value at 'depth' then splicearraynum comes back 3379: with indicy of real point. but if interpolated a point then splicearraynum 3380: is the indicy of next real point. 3381: */ 3382: err = FindValueInCoreToSplice(dset, sm, depth, spliceholenum, splicecorenum, 3383: &splicearraynum, &splice_how, &raw_val, &sm_val); 3384: if(err != 0) { 3385: SpliceClearTie(NULL, NULL, NULL); 3386: if(XtIsManaged(XtParent(drawingAreaView))) { 3387: reason_for_redraw = DRAW_CLEARTIE; 3388: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 3389: } 3390: report_tie1 = NO; 3391: report_tie2 = NO; 3392: (void)sprintf(buffer,"could not find or interpolate a sample in core to splice."); 3393: SpManageWarningBox(buffer); 3394: return; 3395: } 3396: else if(err == 0) { 3397: have_sp_tie1 = DO; 3398: spcompcorenum = corenum; 3399: spcomparraynum = arraynum; 3400: last_sp_tie = TIE1; 3401: report_tie1 = YES; 3402: have_sp_tie2 = YES; 3403: report_tie2 = YES; 3404: interpsplice_val = raw_val; 3405: interpsplice_sm_val = sm_val; 3406: interpsplice_spl_depth = depth; 3407: } 3408: } 3409: } 3410: else if(are_splicing == UNCONSTRAINED && spl_last_core_exist == YES){ 3411: have_sp_tie1 = DO; 3412: spcompcorenum = corenum; 3413: spcomparraynum = arraynum; 3414: last_sp_tie = TIE1; 3415: report_tie1 = YES; 3416: splice_how = REAL; 3417: } 3418: } 3419: } 3420: } 3421: } 3422: 3423: /* have a core to splice and are in area where it is drawn 3424: */ 3425: else if((x > OFF + SPACE + varaxislen && x < OFF + SPACE + 2 * varaxislen) && have_core_to_splice == DO) { 3426: 3427: num = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues; 3428: 3429: if(((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_2_down") == 0 || 3430: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || (int)strcmp(args[0], "but_2_move") == 0) || 3431: ((int)strcmp(args[0], "but_3_move") == 0 && are_splicing == NO) || 3432: ((int)strcmp(args[0], "but_3_move") == 0 && are_splicing == CONSTRAINED)) { 3433: 3434: corenum = -1; 3435: for(k=0; data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->quality != GOOD; ++k){ 3436: if(k >= num){ 3437: return; 3438: } 3439: } 3440: for(j=num - 1; data[dset]->holes[spliceholenum]->core[splicecorenum]->value[j]->quality != GOOD; --j){ 3441: if(j <= 0){ 3442: return; 3443: } 3444: } 3445: if((cursor_depth >= data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->sb_depth + 3446: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset) && 3447: (cursor_depth <= data[dset]->holes[spliceholenum]->core[splicecorenum]->value[j]->sb_depth + 3448: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset)) { 3449: 3450: corenum = 1; 3451: } 3452: else { 3453: } 3454: } 3455: else if(are_splicing == UNCONSTRAINED && (int)strcmp(args[0], "but_3_move") == 0 && last_sp_tie == TIE2) { 3456: corenum = 1; 3457: } 3458: else { 3459: return; 3460: } 3461: 3462: if(smooth.plot == SMOOTHED && data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status < SMOK) { 3463: sm = NO; 3464: } 3465: 3466: /* find nearest sample 3467: */ 3468: arraynum = -1; 3469: if(corenum != -1) { 3470: diff = 99999.0; 3471: for(k=0; k<num; ++k){ 3472: if(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->quality != GOOD){ 3473: } 3474: else { 3475: checkdep = cursor_depth - (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->sb_depth + 3476: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset); 3477: if(fabs(checkdep) < diff){ 3478: diff = fabs(checkdep); 3479: arraynum = k; 3480: } 3481: } 3482: } 3483: } 3484: 3485: if(corenum == -1 || arraynum == -1) { 3486: (void)sprintf(string, ""); 3487: xmstring = XmStringCreateSimple(string); 3488: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 3489: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 3490: XmStringFree(xmstring); 3491: if(((int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) && are_splicing == UNCONSTRAINED) { 3492: have_sp_tie2 = DONT; 3493: } 3494: } 3495: else { 3496: hole = spliceholenum; 3497: core = splicecorenum; 3498: num = arraynum; 3499: depth = (data[dset]->holes[hole]->core[core]->value[num]->sb_depth + 3500: data[dset]->holes[hole]->core[core]->cum_dep_offset); 3501: pval1 = data[dset]->holes[hole]->core[core]->value[num]->data; 3502: var = *pval1; 3503: (void)sprintf(string,"%d %c %d %c %s %.1f %.2f(mbsf) %.2f(mcd) %.2f", 3504: data[dset]->site, 3505: data[dset]->holes[hole]->name, 3506: data[dset]->holes[hole]->core[core]->num, 3507: data[dset]->holes[hole]->core[core]->value[num]->type, 3508: data[dset]->holes[hole]->core[core]->value[num]->section, 3509: data[dset]->holes[hole]->core[core]->value[num]->top_int, 3510: data[dset]->holes[hole]->core[core]->value[num]->sb_depth, 3511: depth, 3512: var); 3513: if(sm == YES) { 3514: (void)sprintf(varstring, " %.2f", data[dset]->holes[hole]->core[core]->value[num]->sm_data); 3515: strncat(string, varstring, (int)strlen(varstring)); 3516: } 3517: if(((int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) && are_splicing == UNCONSTRAINED) { 3518: have_sp_tie2 = DO; 3519: splicearraynum = arraynum; 3520: last_sp_tie = TIE2; 3521: report_tie2 = YES; 3522: splice_how = REAL; 3523: } 3524: } 3525: 3526: } 3527: 3528: /* have stratigraphy and are in the area where it is plotted 3529: */ 3530: else if(x > OFF + SPACE + 2 * varaxislen && x < (int)win_width && 3531: y > 0 && y < (int)win_height && have_strat == DO) { 3532: found_strat = NO; 3533: for(i=0; i<strat_file_cnt; ++i){ 3534: if(found_strat == YES) { 3535: break; 3536: } 3537: for(j=0; j<strat[i]->data_cnt; ++j) { 3538: if(strat[i]->data[j].x_pix_loc_view < 0 || strat[i]->data[j].y_pix_loc_view < 0) { 3539: } 3540: else if(abs(strat[i]->data[j].x_pix_loc_view + 5 - x) < CLOSE && 3541: abs(strat[i]->data[j].y_pix_loc_view - 5 - y) < CLOSE) { 3542: found_strat = YES; 3543: if(fabs(strat[i]->data[j].top_age - strat[i]->data[j].bot_age) < ROUNDCHECK) { 3544: (void)sprintf(string,"hole %c %s %6.3f Ma %6.2f to %6.2f mcd", 3545: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].top_age, 3546: strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset, 3547: strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset); 3548: } 3549: else { 3550: (void)sprintf(string,"hole %c %s %6.3f to %6.3f Ma %6.2f to %6.2f mcd", 3551: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].top_age, strat[i]->data[j].bot_age, 3552: strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset, 3553: strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset); 3554: } 3555: break; 3556: } 3557: } 3558: } 3559: } 3560: 3561: else if(have_core_to_splice == DONT) { 3562: last_sp_tie = NONE; 3563: have_sp_tie1 = DONT; 3564: have_sp_tie2 = DONT; 3565: (void)sprintf(string, ""); 3566: } 3567: 3568: else { 3569: (void)sprintf(string, ""); 3570: } 3571: } 3572: 3573: /* the event is an up or down arrow 3574: */ 3575: else if((int)strcmp(args[0], "arrow_up") == 0 || (int)strcmp(args[0], "arrow_down") == 0) { 3576: 3577: if(last_sp_tie == TIE1 && (int)strcmp(args[0], "arrow_up") == 0) { 3578: if(spcomparraynum - 1 >= 0){ 3579: n = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues; 3580: depth = spcomp.sb_depth[spcompcorenum][spcomparraynum-1]; 3581: if(are_splicing == CONSTRAINED && 3582: (depth < data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->sb_depth + 3583: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset || 3584: depth > data[dset]->holes[spliceholenum]->core[splicecorenum]->value[n-1]->sb_depth + 3585: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset)) { 3586: return; 3587: } 3588: else { 3589: --spcomparraynum; 3590: report_tie1 = YES; 3591: } 3592: } 3593: else { 3594: return; 3595: } 3596: } 3597: else if(last_sp_tie == TIE2 && (int)strcmp(args[0], "arrow_up") == 0 && are_splicing == UNCONSTRAINED) { 3598: if(splicearraynum - 1 >= 0){ 3599: --splicearraynum; 3600: report_tie2 = YES; 3601: } 3602: else { 3603: return; 3604: } 3605: } 3606: else if(last_sp_tie == TIE1 && (int)strcmp(args[0], "arrow_down") == 0) { 3607: if(spcomparraynum + 1 < spcomp.numpercore[spcompcorenum]){ 3608: n = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues; 3609: depth = spcomp.sb_depth[spcompcorenum][spcomparraynum+1]; 3610: if(are_splicing == CONSTRAINED && 3611: (depth < data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->sb_depth + 3612: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset || 3613: depth > data[dset]->holes[spliceholenum]->core[splicecorenum]->value[n-1]->sb_depth + 3614: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset)) { 3615: return; 3616: } 3617: else { 3618: ++spcomparraynum; 3619: report_tie1 = YES; 3620: } 3621: } 3622: else { 3623: return; 3624: } 3625: } 3626: else if(last_sp_tie == TIE2 && (int)strcmp(args[0], "arrow_down") == 0 && are_splicing == UNCONSTRAINED) { 3627: if(splicearraynum + 1 < data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues){ 3628: ++splicearraynum; 3629: report_tie2 = YES; 3630: } 3631: else { 3632: return; 3633: } 3634: } 3635: 3636: if(are_splicing == CONSTRAINED) { 3637: n = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues; 3638: depth = spcomp.sb_depth[spcompcorenum][spcomparraynum]; 3639: if(depth < data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->sb_depth + 3640: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset || 3641: depth > data[dset]->holes[spliceholenum]->core[splicecorenum]->value[n-1]->sb_depth + 3642: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset) { 3643: return; 3644: } 3645: else { 3646: 3647: /* note that if find real value at 'depth' then splicearraynum comes back 3648: with indicy of real point. but if interpolated a point then splicearraynum 3649: is the indicy of next real point. 3650: */ 3651: err = FindValueInCoreToSplice(dset, sm, depth, spliceholenum, splicecorenum, 3652: &splicearraynum, &splice_how, &raw_val, &sm_val); 3653: } 3654: if(err != 0) { 3655: have_sp_tie1 = DONT; 3656: have_sp_tie2 = DONT; 3657: have_splice_tie = DONT; 3658: last_sp_tie = NONE; 3659: report_tie1 = NO; 3660: report_tie2 = NO; 3661: (void)sprintf(buffer,"could not find or interpolate a sample in core to splice."); 3662: SpManageWarningBox(buffer); 3663: return; 3664: } 3665: else if(err == 0) { 3666: have_sp_tie2 = YES; 3667: report_tie2 = YES; 3668: interpsplice_val = raw_val; 3669: interpsplice_sm_val = sm_val; 3670: interpsplice_spl_depth = depth; 3671: } 3672: } 3673: else if(are_splicing == UNCONSTRAINED) { 3674: splice_how = REAL; 3675: } 3676: 3677: (void)sprintf(string, ""); 3678: } 3679: 3680: else if((int)strcmp(args[0], "return_down") == 0 && are_splicing > NO && have_core_to_splice == DO) { 3681: if(splice_overlap == YES && have_sp_tie1 == DO && have_sp_tie2 == DO && have_spcorr == DO) { 3682: SpliceToTie((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 3683: } 3684: else if(splice_overlap == NO) { 3685: AppendSplice((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 3686: } 3687: else if(splice_overlap == OVERLAPAPPEND) { 3688: } 3689: } 3690: 3691: if((int)strcmp(args[0], "but_1_up") == 0 || (int)strcmp(args[0], "but_2_up") == 0 || (int)strcmp(args[0], "but_3_up") == 0) { 3692: (void)sprintf(string,""); 3693: } 3694: xmstring = XmStringCreateSimple(string); 3695: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 3696: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 3697: XmStringFree(xmstring); 3698: 3699: 3700: if((int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0 || 3701: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0 || 3702: (int)strcmp(args[0], "arrow_up") == 0 || (int)strcmp(args[0], "arrow_down") == 0 && 3703: (report_tie1 == YES || report_tie2 == YES) ) { 3704: if(report_tie1 == YES) { 3705: hole = spcomp.hole[spcompcorenum]; 3706: core = spcomp.core[spcompcorenum]; 3707: num = spcomp.MapToOrig[spcompcorenum][spcomparraynum]; 3708: depth = spcomp.sb_depth[spcompcorenum][spcomparraynum]; 3709: var = spcomp.var[spcompcorenum][spcomparraynum]; 3710: (void)sprintf(tie1idstring,"%d %c %d %c %s %.1f %.2f", 3711: data[dset]->site, 3712: data[dset]->holes[hole]->name, 3713: data[dset]->holes[hole]->core[core]->num, 3714: data[dset]->holes[hole]->core[core]->value[num]->type, 3715: data[dset]->holes[hole]->core[core]->value[num]->section, 3716: data[dset]->holes[hole]->core[core]->value[num]->top_int, 3717: data[dset]->holes[hole]->core[core]->value[num]->sb_depth); 3718: xmstring = XmStringCreateSimple(tie1idstring); 3719: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 3720: XmStringFree(xmstring); 3721: (void)sprintf(string, "%.2f", var); 3722: xmstring = XmStringCreateSimple(string); 3723: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 3724: XmStringFree(xmstring); 3725: (void)sprintf(string, "%.2f", depth); 3726: xmstring = XmStringCreateSimple(string); 3727: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 3728: XmStringFree(xmstring); 3729: } 3730: if(report_tie2 == YES) { 3731: hole = spliceholenum; 3732: core = splicecorenum; 3733: num = splicearraynum; 3734: if(are_splicing == CONSTRAINED && splice_how == INTERPOLATED){ 3735: (void)sprintf(tie2idstring,"%d %c %d %c interpolated", 3736: data[dset]->site, 3737: data[dset]->holes[hole]->name, 3738: data[dset]->holes[hole]->core[core]->num, 3739: data[dset]->holes[hole]->core[core]->value[num]->type); 3740: depth = interpsplice_spl_depth; 3741: var = interpsplice_val; 3742: } 3743: else if(are_splicing == UNCONSTRAINED || splice_how == REAL) { 3744: depth = (data[dset]->holes[hole]->core[core]->value[num]->sb_depth + 3745: data[dset]->holes[hole]->core[core]->cum_dep_offset); 3746: pval1 = data[dset]->holes[hole]->core[core]->value[num]->data; 3747: var = *pval1; 3748: (void)sprintf(tie2idstring,"%d %c %d %c %s %.1f %.2f", 3749: data[dset]->site, 3750: data[dset]->holes[hole]->name, 3751: data[dset]->holes[hole]->core[core]->num, 3752: data[dset]->holes[hole]->core[core]->value[num]->type, 3753: data[dset]->holes[hole]->core[core]->value[num]->section, 3754: data[dset]->holes[hole]->core[core]->value[num]->top_int, 3755: data[dset]->holes[hole]->core[core]->value[num]->sb_depth); 3756: } 3757: xmstring = XmStringCreateSimple(tie2idstring); 3758: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 3759: XmStringFree(xmstring); 3760: (void)sprintf(string, "%.2f", var); 3761: xmstring = XmStringCreateSimple(string); 3762: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 3763: XmStringFree(xmstring); 3764: (void)sprintf(string, "%.2f", depth); 3765: xmstring = XmStringCreateSimple(string); 3766: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 3767: XmStringFree(xmstring); 3768: } 3769: if(XtIsManaged(XtParent(drawingAreaView))) { 3770: reason_for_redraw = DRAW_TIES; 3771: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 3772: } 3773: } 3774: 3775: if(have_sp_tie1 == DO && have_sp_tie2 == DO && (report_tie1 == YES || report_tie2 == YES)) { 3776: 3777: have_splice_tie = DO; 3778: 3779: /* calculate the average depth step for current 3780: 'tied' cores. and set the text fields with 3781: ave depth step, default window length 3782: and lead,lag 3783: */ 3784: err1 = FindAveDepth(spcomp.hole[spcompcorenum], spcomp.core[spcompcorenum], &avedep1); 3785: err2 = FindAveDepth(spliceholenum, splicecorenum, &avedep2); 3786: if(err1 > 1 || err2 > 1) { 3787: return; 3788: } 3789: avedep = (avedep1 + avedep2)/2.0; 3790: 3791: 3792: /* set the text field with ave depth 3793: */ 3794: str = XmTextGetString(textCompDepthStep); 3795: (void)sprintf(string, "%.2f", avedep); 3796: if((int)strcmp(str, string) != 0) { 3797: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 3798: } 3799: XtFree(str); 3800: 3801: /* calculate the difference in value at the tie (tie1 - tie2) and write it to text 3802: */ 3803: if(are_splicing == CONSTRAINED) { 3804: diff = spcomp.var[spcompcorenum][spcomparraynum] - interpsplice_val; 3805: (void)sprintf(string, "%.2f", diff); 3806: } 3807: else if(are_splicing == UNCONSTRAINED) { 3808: hole = spcomp.hole[spcompcorenum]; 3809: core = spcomp.core[spcompcorenum]; 3810: num = spcomp.MapToOrig[spcompcorenum][spcomparraynum]; 3811: if(sm == NO) { 3812: pval1 = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->data; 3813: diff = spcomp.var[spcompcorenum][spcomparraynum] - *pval1; 3814: } 3815: else if(sm == YES) { 3816: diff = data[dset]->holes[hole]->core[core]->value[num]->sm_data - 3817: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sm_data; 3818: } 3819: else { 3820: diff = -99.9; 3821: } 3822: (void)sprintf(string, "%.2f", diff); 3823: } 3824: else { 3825: (void)sprintf(string, ""); 3826: } 3827: xmstring = XmStringCreateSimple(string); 3828: XtVaSetValues(labelSpliceDifferenceInValue, XmNlabelString, xmstring, NULL); 3829: XmStringFree(xmstring); 3830: 3831: /* make the clear tie and correlate buttons sensitive 3832: and the grab core insensitive. should not be able 3833: to grab another core until clear tie or splice 3834: */ 3835: XtSetSensitive(pushButtonSpliceClearTie, True); 3836: XtSetSensitive(pushButtonSpliceCorrelate, True); 3837: XtSetSensitive(pushButtonGetSelectCore, False); 3838: XtSetSensitive(pushButtonAppendSplice, False); 3839: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 3840: XtSetSensitive(pushButtonSuggestTies, False); 3841: 3842: SpliceCorrelate((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 3843: } 3844: } 3845: 3846: (void)sprintf(string, ""); 3847: (void)sprintf(varstring, ""); 3848: (void)sprintf(tie1idstring, ""); 3849: (void)sprintf(tie2idstring, ""); 3850: } 3851: 3852: 3853: /* ARGSUSED */ 3854: void 3855: EventProcDrawingAreaTieCorrelation(w, event, args, num_args) 3856: Widget w; 3857: XButtonEvent *event; 3858: String *args; 3859: int *num_args; 3860: { 3861: int x, i, kk, diff, xaxispixlen, idum, err; 3862: char string[200]; 3863: float fdum; 3864: double check, fract, ip; 3865: XmString xmstring; 3866: Dimension win_width; 3867: 3868: 3869: x = event->x; 3870: 3871: if(have_corr == DONT){ 3872: (void)sprintf(string, ""); 3873: } 3874: else if(have_corr == DO){ 3875: 3876: XtVaGetValues(w, XmNwidth, &win_width, NULL); 3877: 3878: /*calc. the length of the y axis and the half length 3879: of the x axis. adjust the length of x axis if its 3880: total length is not divisable by ten 3881: */ 3882: xaxispixlen = ((int)win_width - (2 * SPACE))/2; 3883: 3884: /* 3885: */ 3886: if((err = XAxisDepthCorrSetup(lead_lag, depstep, &xaxispixlen, &fdum, &idum, &lagperpix, &fdum)) != 0) { 3887: return; 3888: } 3889: 3890: check = corr.depleadlag[0][dset]/lagperpix + SPACE + xaxispixlen; 3891: diff= fabs(x-check); 3892: kk = 0; 3893: for(i=1; i<corr.num_lead_lag[dset]; ++i){ 3894: check = corr.depleadlag[dset][i]/lagperpix + SPACE + xaxispixlen; 3895: if(fabs(x-check) < diff){ 3896: diff = fabs(x-check); 3897: kk=i; 3898: } 3899: } 3900: (void)sprintf(string, "lead/lag relative to tie = %.2fm coef = %4.2f n = %3d depth adjust = %4.2fm", 3901: corr.depleadlag[dset][kk], corr.coef[dset][kk], corr.n[kk], corr.depoffset[kk]); 3902: } 3903: else { 3904: (void)sprintf(string, ""); 3905: } 3906: 3907: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0) { 3908: xmstring = XmStringCreateSimple(string); 3909: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 3910: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 3911: XmStringFree(xmstring); 3912: } 3913: else if((int)strcmp(args[0], "but_1_up") == 0) { 3914: (void)sprintf(string, ""); 3915: xmstring = XmStringCreateSimple(string); 3916: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 3917: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 3918: XmStringFree(xmstring); 3919: } 3920: 3921: (void)sprintf(string, ""); 3922: } 3923: 3924: /* ARGSUSED */ 3925: void 3926: EventProcDrawingAreaSpliceCorrelation(w, event, args, num_args) 3927: Widget w; 3928: XButtonEvent *event; 3929: String *args; 3930: int *num_args; 3931: { 3932: int x, i, kk, diff, xaxispixlen, idum, err; 3933: char string[200]; 3934: float fdum; 3935: double check, fract, ip; 3936: XmString xmstring; 3937: Dimension win_width; 3938: int XAxisDepthCorrSetup(); 3939: 3940: x = event->x; 3941: 3942: if(have_spcorr == DONT){ 3943: (void)sprintf(string, ""); 3944: } 3945: else if(have_spcorr == DO){ 3946: 3947: XtVaGetValues(w, XmNwidth, &win_width, NULL); 3948: 3949: /*calc. the length of the y axis and the half length 3950: of the x axis. adjust the length of x axis if its 3951: total length is not divisable by ten 3952: */ 3953: xaxispixlen = ((int)win_width - (2 * SPACE))/2; 3954: 3955: /* 3956: */ 3957: if((err = XAxisDepthCorrSetup(lead_lag, depstep, &xaxispixlen, &fdum, &idum, &lagperpix, &fdum)) != 0) { 3958: return; 3959: } 3960: 3961: check = corr.depleadlag[dset][0]/lagperpix + SPACE + xaxispixlen; 3962: diff= fabs(x-check); 3963: kk = 0; 3964: for(i=1; i<corr.num_lead_lag[dset]; ++i){ 3965: check = corr.depleadlag[dset][i]/lagperpix + SPACE + xaxispixlen; 3966: if(fabs(x-check) < diff){ 3967: diff = fabs(x-check); 3968: kk=i; 3969: } 3970: } 3971: if(are_splicing == CONSTRAINED) { 3972: (void)sprintf(string, "lead/leg = %.2fm coef=%4.2f n=%3d lead/lag(m)=%4.2f", 3973: corr.depleadlag[dset][kk], corr.coef[dset][kk], corr.n[kk], corr.depoffset[kk]); 3974: } 3975: else if(are_splicing == UNCONSTRAINED) { 3976: (void)sprintf(string, "lead/lag rel. to tie = %.2fm coef = %4.2f n = %3d depth adjust = %4.2fm", 3977: corr.depleadlag[dset][kk], corr.coef[dset][kk], corr.n[kk], corr.depoffset[kk]); 3978: } 3979: } 3980: else { 3981: (void)sprintf(string, ""); 3982: } 3983: 3984: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0) { 3985: xmstring = XmStringCreateSimple(string); 3986: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 3987: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 3988: XmStringFree(xmstring); 3989: } 3990: else if((int)strcmp(args[0], "but_1_up") == 0) { 3991: (void)sprintf(string, ""); 3992: xmstring = XmStringCreateSimple(string); 3993: XtVaSetValues(labelCursorLocation, XmNlabelString, xmstring, NULL); 3994: XtVaSetValues(labelSpliceCursorLocation, XmNlabelString, xmstring, NULL); 3995: XmStringFree(xmstring); 3996: } 3997: 3998: (void)sprintf(string, ""); 3999: } 4000: 4001: /* ARGSUSED */ 4002: void 4003: EventProcDrawingAreaDepthOffset(w, event, args, num_args) 4004: Widget w; 4005: XButtonEvent *event; 4006: String *args; 4007: int *num_args; 4008: { 4009: 4010: int i, j, x, y, xpix, ypix; 4011: char string[200]; 4012: float sect, sect_dep, topdep; 4013: double check, fract, ip; 4014: XmString xmstring; 4015: 4016: x = event->x; 4017: y = event->y; 4018: 4019: if(have_data == DONT) { 4020: if((int)strcmp(args[0], "but_1_down") == 0) { 4021: (void)sprintf(string, "no data"); 4022: xmstring = XmStringCreateSimple(string); 4023: XtVaSetValues(labelDepthOffsetCursorLocation, XmNlabelString, xmstring, NULL); 4024: XmStringFree(xmstring); 4025: } 4026: else if((int)strcmp(args[0], "but_1_up") == 0) { 4027: (void)sprintf(string, ""); 4028: xmstring = XmStringCreateSimple(string); 4029: XtVaSetValues(labelDepthOffsetCursorLocation, XmNlabelString, xmstring, NULL); 4030: XmStringFree(xmstring); 4031: } 4032: } 4033: else if(have_data == DO) { 4034: 4035: /*find the nearest core 4036: */ 4037: (void)sprintf(string,""); 4038: for(i=0; i<data[dset]->numholes; ++i){ 4039: for(j=0; j<data[dset]->holes[i]->numcores; ++j){ 4040: if(data[dset]->holes[i]->core[j]->did_offset == YES){ 4041: if(strcmp(data[dset]->holes[i]->core[j]->value[0]->section, "CC") != 0) { 4042: sect = atof(data[dset]->holes[i]->core[j]->value[0]->section); 4043: } 4044: else { 4045: sect = 1; 4046: } 4047: sect_dep = (data[dset]->holes[i]->core[j]->value[0]->bot_int - data[dset]->holes[i]->core[j]->value[0]->top_int)/2.0 + 4048: data[dset]->holes[i]->core[j]->value[0]->top_int; 4049: fract = modf(sect_dep/1.0, &ip); 4050: if(fract <= 0.41) { 4051: sect_dep = ip; 4052: } 4053: else if(fract >= 0.59) { 4054: sect_dep = ip + 1.0; 4055: } 4056: else { 4057: sect_dep = ip + 1.0; 4058: } 4059: topdep = data[dset]->holes[i]->core[j]->value[0]->sb_depth - sect_dep/100.0 - ((sect - 1.0) * 1.5); 4060: ypix = topdep/offsetdepperpix + OFF; 4061: xpix = data[dset]->holes[i]->core[j]->cum_dep_offset/depthoffsetperpix + OFF; 4062: if(abs(ypix - y) < CLOSE && abs(xpix - x) < CLOSE){ 4063: (void)sprintf(string,"%d %c %d %c %.2f(mbsf) depth offset %.2f(m)", 4064: data[dset]->site, 4065: data[dset]->holes[i]->name, 4066: data[dset]->holes[i]->core[j]->num, 4067: data[dset]->holes[i]->core[j]->value[0]->type, 4068: topdep, 4069: data[dset]->holes[i]->core[j]->cum_dep_offset); 4070: break; 4071: } 4072: } 4073: } 4074: } 4075: 4076: if((int)strcmp(args[0], "but_1_down") == 0) { 4077: xmstring = XmStringCreateSimple(string); 4078: XtVaSetValues(labelDepthOffsetCursorLocation, XmNlabelString, xmstring, NULL); 4079: XmStringFree(xmstring); 4080: } 4081: else if((int)strcmp(args[0], "but_1_up") == 0) { 4082: (void)sprintf(string, ""); 4083: xmstring = XmStringCreateSimple(string); 4084: XtVaSetValues(labelDepthOffsetCursorLocation, XmNlabelString, xmstring, NULL); 4085: XmStringFree(xmstring); 4086: } 4087: else if((int)strcmp(args[0], "but_1_move") == 0) { 4088: xmstring = XmStringCreateSimple(string); 4089: XtVaSetValues(labelDepthOffsetCursorLocation, XmNlabelString, xmstring, NULL); 4090: XmStringFree(xmstring); 4091: } 4092: } 4093: 4094: (void)sprintf(string, ""); 4095: } 4096: 4097: /* ARGSUSED */ 4098: void 4099: EventProcDrawingAreaAgeDepth(w, event, args, num_args) 4100: Widget w; 4101: XButtonEvent *event; 4102: String *args; 4103: int *num_args; 4104: { 4105: 4106: int i, j, k, x, y, pos; 4107: char string[200]; 4108: float aveage, avedep, age_drag_change, depth_drag_change; 4109: XmString xmstring; 4110: void DrawDrawingAreaAgeDepth(), PlotSpliceVsAge(); 4111: 4112: x = event->x; 4113: y = event->y; 4114: 4115: if(have_strat == DONT) { 4116: if((int)strcmp(args[0], "but_1_down") == 0) { 4117: (void)sprintf(string, "no data"); 4118: 4119: } 4120: else { 4121: (void)sprintf(string, ""); 4122: } 4123: xmstring = XmStringCreateSimple(string); 4124: XtVaSetValues(labelAgeDepthCursorLocation, XmNlabelString, xmstring, NULL); 4125: XmStringFree(xmstring); 4126: return; 4127: } 4128: 4129: else if(have_strat == DO) { 4130: if(are_dragging == YES && (int)strcmp(args[0], "but_3_down") == 0) { 4131: last_x_agedepth = x; 4132: last_y_agedepth = y; 4133: } 4134: else if(are_dragging == YES && (int)strcmp(args[0], "but_3_move") == 0) { 4135: age_drag_change = (x - last_x_agedepth) * ageperpix; 4136: depth_drag_change = (y - last_y_agedepth) * depperpixagemodel; 4137: top_age_agedepth = top_age_agedepth - age_drag_change; 4138: top_meter_agedepth = top_meter_agedepth - depth_drag_change; 4139: last_x_agedepth = x; 4140: last_y_agedepth = y; 4141: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 4142: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 4143: } 4144: return; 4145: } 4146: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || 4147: (int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0 || (int)strcmp(args[0], "but_2_up") == 0) { 4148: for(i=0; i<strat_file_cnt; ++i){ 4149: for(j=0; j<strat[i]->data_cnt; ++j){ 4150: if(strat[i]->data[j].x_pix_loc_agedepth < 0 || strat[i]->data[j].y_pix_loc_agedepth < 0) { 4151: } 4152: else if(abs(strat[i]->data[j].x_pix_loc_agedepth + 5 - x) < CLOSE && 4153: abs(strat[i]->data[j].y_pix_loc_agedepth - 5 - y) < CLOSE) { 4154: if(fabs(strat[i]->data[j].top_age - strat[i]->data[j].bot_age) < ROUNDCHECK) { 4155: if(agemodelling_depth_type == MBSF) { 4156: (void)sprintf(string,"hole %c %s (%s) %6.3f Ma %6.2f to %6.2f mbsf", 4157: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].code, 4158: strat[i]->data[j].top_age, 4159: strat[i]->data[j].top.sb_depth, strat[i]->data[j].bot.sb_depth); 4160: avedep = strat[i]->data[j].avembsf; 4161: } 4162: else if(agemodelling_depth_type == MCD) { 4163: (void)sprintf(string,"hole %c %s (%s) %6.3f Ma %6.2f to %6.2f mcd", 4164: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].code, 4165: strat[i]->data[j].top_age, 4166: strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset, 4167: strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset); 4168: avedep = strat[i]->data[j].avemcd; 4169: } 4170: aveage = strat[i]->data[j].top_age; 4171: } 4172: else { 4173: if(agemodelling_depth_type == MBSF) { 4174: (void)sprintf(string,"hole %c %s (%s) %6.3f to %6.3f Ma %6.2f to %6.2f mbsf", 4175: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].code, 4176: strat[i]->data[j].top_age, strat[i]->data[j].bot_age, 4177: strat[i]->data[j].top.sb_depth, strat[i]->data[j].bot.sb_depth); 4178: avedep = strat[i]->data[j].avembsf; 4179: } 4180: else if(agemodelling_depth_type == MCD) { 4181: (void)sprintf(string,"hole %c %s (%s) %6.3f to %6.3f Ma %6.2f to %6.2f mcd", 4182: strat[i]->data[j].top.hole, strat[i]->data[j].name, strat[i]->data[j].code, 4183: strat[i]->data[j].top_age, strat[i]->data[j].bot_age, 4184: strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset, 4185: strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset); 4186: avedep = strat[i]->data[j].avemcd; 4187: } 4188: aveage = (strat[i]->data[j].top_age + strat[i]->data[j].bot_age)/2.0; 4189: } 4190: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || 4191: (int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0) { 4192: xmstring = XmStringCreateSimple(string); 4193: } 4194: else { 4195: xmstring = XmStringCreateSimple(""); 4196: } 4197: XtVaSetValues(labelAgeDepthCursorLocation, XmNlabelString, xmstring, NULL); 4198: XmStringFree(xmstring); 4199: 4200: if((int)strcmp(args[0], "but_2_up") == 0 && are_agemodelling == YES) { 4201: 4202: /* check that have not reached array limit 4203: */ 4204: if(agemodel_cnt + 1 > MAXAGE) { 4205: (void)sprintf(buffer, "You have exceeded the limit on the number of values in age model."); 4206: SpManageWarningBox(buffer); 4207: return; 4208: } 4209: 4210: /* check that this datum not already in list 4211: */ 4212: if(agemodel_cnt > 0) { 4213: for(k=0; k<agemodel_cnt; ++k) { 4214: if((int)strcmp(strat[i]->data[j].code, agemodel[k].code) == 0) { 4215: if((int)strcmp(strat[i]->data[j].name, agemodel[k].name) == 0) { 4216: (void)sprintf(buffer, "The age datum you have picked is allready in the list."); 4217: SpManageWarningBox(buffer); 4218: return; 4219: } 4220: } 4221: } 4222: } 4223: 4224: /* put this datum in age model struct in order by both age and depth 4225: there must not be conflicts with age and depth 4226: */ 4227: if(agemodel_cnt >= 1) { 4228: pos = -1; 4229: for(k=0; k<agemodel_cnt; ++k) { 4230: if(agemodelling_depth_type == MBSF) { 4231: if(k == 0 && aveage < agemodel[k].aveage && avedep < agemodel[k].avembsf) { 4232: pos = k; 4233: } 4234: else if(k == agemodel_cnt-1 && 4235: aveage > agemodel[k].aveage && avedep > agemodel[k].avembsf) { 4236: pos = k + 1; 4237: } 4238: else if(k < agemodel_cnt-1 && 4239: aveage > agemodel[k].aveage && avedep > agemodel[k].avembsf && 4240: aveage < agemodel[k+1].aveage && avedep < agemodel[k+1].avembsf) { 4241: pos = k + 1; 4242: } 4243: } 4244: else if(agemodelling_depth_type == MCD) { 4245: if(k == 0 && aveage < agemodel[k].aveage && avedep < agemodel[k].avemcd) { 4246: pos = k; 4247: } 4248: else if(k == agemodel_cnt-1 && 4249: aveage > agemodel[k].aveage && avedep > agemodel[k].avemcd) { 4250: pos = k + 1; 4251: } 4252: else if(k < agemodel_cnt-1 && 4253: aveage > agemodel[k].aveage && avedep > agemodel[k].avemcd && 4254: aveage < agemodel[k+1].aveage && avedep < agemodel[k+1].avemcd) { 4255: pos = k + 1; 4256: } 4257: } 4258: } 4259: if(pos == -1) { 4260: (void)sprintf(buffer, "This age datum conflicts with existing age model."); 4261: SpManageWarningBox(buffer); 4262: return; 4263: } 4264: else { 4265: ++agemodel_cnt; 4266: if(pos == agemodel_cnt-1) { 4267: strat[i]->data[j].agemodel_maptostratfile = i; 4268: strat[i]->data[j].agemodel_maptodatum = j; 4269: agemodel[agemodel_cnt-1] = strat[i]->data[j]; 4270: } 4271: else { 4272: for(k=agemodel_cnt-1; k>pos; --k) { 4273: agemodel[k] = agemodel[k-1]; 4274: } 4275: strat[i]->data[j].agemodel_maptostratfile = i; 4276: strat[i]->data[j].agemodel_maptodatum = j; 4277: agemodel[pos] = strat[i]->data[j]; 4278: } 4279: } 4280: } 4281: else if(agemodel_cnt == 0) { 4282: agemodel_cnt = 1; 4283: strat[i]->data[j].agemodel_maptostratfile = i; 4284: strat[i]->data[j].agemodel_maptodatum = j; 4285: agemodel[0] = strat[i]->data[j]; 4286: } 4287: 4288: /* add this datum to the list 4289: */ 4290: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", strat[i]->data[j].avembsf, strat[i]->data[j].avemcd, 4291: strat[i]->data[j].aveage, strat[i]->data[j].name, strat[i]->data[j].code); 4292: 4293: xmstring = XmStringCreateSimple(string); 4294: XmListAddItemUnselected(listConstructAgeModel, xmstring, pos + 1); 4295: XmStringFree(xmstring); 4296: 4297: did_agemodel = YES; 4298: saved_agemodel = NO; 4299: 4300: if(agemodel_cnt > 1) { 4301: XtSetSensitive(pushButtonSaveAgeMode, True); 4302: XtSetSensitive(pushButtonRemoveSelectDatum, True); 4303: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, True); 4304: if(have_splice == DO) { 4305: XtSetSensitive(pushButtonPlotSpliceVsAge, True); 4306: XtSetSensitive(pushButtonSaveSpliceToAge, True); 4307: if(have_time_series == DONT) { 4308: XtSetSensitive(pushButtonOpenAgeSignal, True); 4309: XtSetSensitive(pushButtonOpenTimeSeries, True); 4310: } 4311: else if(have_time_series == DO) { 4312: XtSetSensitive(pushButtonOpenAgeSignal, False); 4313: XtSetSensitive(pushButtonOpenTimeSeries, False); 4314: } 4315: have_splicetoage = DO; 4316: } 4317: else { 4318: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 4319: XtSetSensitive(pushButtonSaveSpliceToAge, False); 4320: XtSetSensitive(pushButtonOpenAgeSignal, False); 4321: XtSetSensitive(pushButtonOpenTimeSeries, False); 4322: have_splicetoage = DONT; 4323: } 4324: } 4325: else { 4326: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 4327: XtSetSensitive(pushButtonSaveAgeMode, False); 4328: XtSetSensitive(pushButtonSaveSpliceToAge, False); 4329: XtSetSensitive(pushButtonOpenAgeSignal, False); 4330: XtSetSensitive(pushButtonOpenTimeSeries, False); 4331: have_splicetoage = DONT; 4332: } 4333: if(agemodel_cnt > 0) { 4334: XtSetSensitive(pushButtonRemoveSelectDatum, True); 4335: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, True); 4336: } 4337: else { 4338: XtSetSensitive(pushButtonRemoveSelectDatum, False); 4339: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, False); 4340: } 4341: 4342: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 4343: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 4344: } 4345: if(have_splicetoage == DO) { 4346: PlotSpliceVsAge(NO); 4347: } 4348: } 4349: return; 4350: } 4351: } 4352: } 4353: 4354: if((int)strcmp(args[0], "but_2_up") != 0) { 4355: agemodel_handpick_age = x; 4356: agemodel_handpick_depth = y; 4357: agemodel_handpick_age = ((agemodel_handpick_age - top_off_agedepth_age) * ageperpix) + top_age_agedepth; 4358: agemodel_handpick_depth = ((agemodel_handpick_depth - top_off_agedepth_depth) * depperpixagemodel) + top_meter_agedepth; 4359: if(agemodelling_depth_type == MBSF) { 4360: (void)sprintf(string, "%8.2f(mbsf) %8.3f(Ma)", agemodel_handpick_depth, agemodel_handpick_age); 4361: } 4362: else if(agemodelling_depth_type == MCD) { 4363: (void)sprintf(string, "%8.2f(mcd) %8.3f(Ma)", agemodel_handpick_depth, agemodel_handpick_age); 4364: } 4365: xmstring = XmStringCreateSimple(string); 4366: } 4367: else { 4368: xmstring = XmStringCreateSimple(""); 4369: } 4370: XtVaSetValues(labelAgeDepthCursorLocation, XmNlabelString, xmstring, NULL); 4371: XmStringFree(xmstring); 4372: } 4373: 4374: else if((int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) { 4375: agemodel_handpick_age = x - OFF; 4376: agemodel_handpick_depth = y; 4377: agemodel_handpick_age = agemodel_handpick_age * ageperpix; 4378: agemodel_handpick_depth = ((agemodel_handpick_depth - top_off_agedepth_depth) * depperpixagemodel) + top_meter_agedepth; 4379: if(agemodelling_depth_type == MBSF) { 4380: (void)sprintf(string, "%8.2f(mbsf) %8.3f(Ma)", agemodel_handpick_depth, agemodel_handpick_age); 4381: } 4382: else if(agemodelling_depth_type == MCD) { 4383: (void)sprintf(string, "%8.2f(mcd) %8.3f(Ma)", agemodel_handpick_depth, agemodel_handpick_age); 4384: } 4385: xmstring = XmStringCreateSimple(string); 4386: XtVaSetValues(labelAgeDepthCursorLocation, XmNlabelString, xmstring, NULL); 4387: XmStringFree(xmstring); 4388: } 4389: 4390: else if((int)strcmp(args[0], "but_3_up") == 0) { 4391: xmstring = XmStringCreateSimple(""); 4392: XtVaSetValues(labelAgeDepthCursorLocation, XmNlabelString, xmstring, NULL); 4393: XmStringFree(xmstring); 4394: if(are_agemodelling == YES) { 4395: (void)sprintf(string, "%8.3f", agemodel_handpick_age); 4396: XtVaSetValues(textFieldAgeDepthHandPickAge, XmNvalue, string, NULL); 4397: (void)sprintf(string, "%8.2f", agemodel_handpick_depth); 4398: XtVaSetValues(textFieldAgeDepthHandPickDepth, XmNvalue, string, NULL); 4399: 4400: /* put it in the agemodel checking order and conflicts 4401: */ 4402: } 4403: } 4404: 4405: else if((int)strcmp(args[0], "but_1_up") == 0) { 4406: xmstring = XmStringCreateSimple(""); 4407: XtVaSetValues(labelAgeDepthCursorLocation, XmNlabelString, xmstring, NULL); 4408: XmStringFree(xmstring); 4409: } 4410: } 4411: 4412: (void)sprintf(string, ""); 4413: } 4414: 4415: /* ARGSUSED */ 4416: void 4417: EventProcDrawingAreaSpliceToAge(w, event, args, num_args) 4418: Widget w; 4419: XButtonEvent *event; 4420: String *args; 4421: int *num_args; 4422: { 4423: 4424: int i, j, k, x, y, adj, sm, found, corenum, arraynum, hole, core, num, report_tie1, report_tie2; 4425: char string[200], varstring[20]; 4426: float age, diff, checkage, var; 4427: XmString xmstring; 4428: void DrawDrawingAreaSpliceToAge(), SpliceToAgeRecorrelate(), SpliceToAgeAddTiedDatum(); 4429: 4430: x = event->x; 4431: y = event->y; 4432: 4433: if(agemodel_cnt > 0 && have_splice == DO) { 4434: 4435: /* assign an xoff adjustment for the case when have or don't have time series 4436: it will be drawn in the spcace where sed rate was drawn 4437: */ 4438: if(have_time_series == DONT) { 4439: adj = 0; 4440: } 4441: else if(have_time_series == DO) { 4442: adj = varaxislen + SPACE; 4443: } 4444: else { 4445: adj = 0; 4446: } 4447: 4448: if(have_splicetoage_tie == DONT && have_timeseries_tie == DONT) { 4449: last_splicetoage_tie = NONE; 4450: } 4451: else if(have_splicetoage_tie == DONT && last_splicetoage_tie == TIE1) { 4452: if(have_timeseries_tie == DO){ 4453: last_splicetoage_tie = TIE2; 4454: } 4455: else { 4456: last_splicetoage_tie = NONE; 4457: } 4458: } 4459: else if(have_timeseries_tie == DONT && last_splicetoage_tie == TIE2) { 4460: if(have_splicetoage_tie == DO){ 4461: last_splicetoage_tie = TIE1; 4462: } 4463: else { 4464: last_splicetoage_tie = NONE; 4465: } 4466: } 4467: report_tie1 = NO; 4468: report_tie2 = NO; 4469: 4470: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0 || 4471: (int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0 || 4472: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) { 4473: 4474: age = ((y - top_off_splicetoage) * spliceageperpix) + top_age_splicetoage; 4475: 4476: /* are in the area of window were datums are drawn 4477: */ 4478: if(x > OFF+SPACE+varaxislen && x < OFF+SPACE+varaxislen+SPACE) { 4479: 4480: found = NO; 4481: for(j=0; j<agemodel_cnt; ++j){ 4482: if(agemodel[j].x_pix_loc_splicetoage < 0 || agemodel[j].y_pix_loc_splicetoage < 0) { 4483: } 4484: else if(abs(agemodel[j].x_pix_loc_splicetoage + 5 - x) < CLOSE && 4485: abs(agemodel[j].y_pix_loc_splicetoage - 5 - y) < CLOSE) { 4486: 4487: if(have_time_series == DONT) { 4488: (void)sprintf(string,"%7.2f(mbsf)%7.2f(mcd)%7.4f(Ma) %s(%s)", 4489: agemodel[j].avembsf, agemodel[j].avemcd, agemodel[j].aveage, 4490: agemodel[j].name, agemodel[j].code); 4491: } 4492: else if(have_time_series == DO && agemodel[j].type != TIME && agemodel[j].type != HANDPICK) { 4493: i = agemodel[j].agemodel_maptostratfile; 4494: k = agemodel[j].agemodel_maptodatum; 4495: if(i >= 0 && k >= 0) { 4496: (void)sprintf(string,"%7.2f(mbsf)%7.2f(mcd)%7.4f(Ma) %7.4f(Ma tuned) %s(%s)", 4497: agemodel[j].avembsf, agemodel[j].avemcd, strat[i]->data[k].aveage, agemodel[j].aveage, 4498: agemodel[j].name, agemodel[j].code); 4499: } 4500: else { 4501: (void)sprintf(string,"%7.2f(mbsf)%7.2f(mcd) Can't assign(Ma) %7.4f(Ma tuned) %s(%s)", 4502: agemodel[j].avembsf, agemodel[j].avemcd, agemodel[j].aveage, 4503: agemodel[j].name, agemodel[j].code); 4504: } 4505: } 4506: else if(have_time_series == DO) { 4507: (void)sprintf(string,"%7.2f(mbsf)%7.2f(mcd)%7.4f(Ma) %s(%s)", 4508: agemodel[j].avembsf, agemodel[j].avemcd, agemodel[j].aveage, 4509: agemodel[j].name, agemodel[j].code); 4510: } 4511: found = YES; 4512: break; 4513: } 4514: else { 4515: } 4516: } 4517: if(found == NO) { 4518: (void)sprintf(string, "%8.3f", age); 4519: XmListDeselectAllItems(listConstructAgeModel); 4520: } 4521: else if(found == YES) { 4522: XmListSelectPos(listConstructAgeModel, j+1, (int)NULL); 4523: } 4524: xmstring = XmStringCreateSimple(string); 4525: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4526: XmStringFree(xmstring); 4527: } 4528: 4529: /* are in the area of window where sed rate is drawn 4530: */ 4531: else if(x > OFF + SPACE + varaxislen + SPACE + adj && x < OFF + SPACE + 2 * varaxislen + SPACE + adj) { 4532: 4533: found = -1; 4534: if(agemodel_cnt > 1) { 4535: for(i=0; i<agemodel_cnt-1; ++i) { 4536: if(age >= agemodel[i].aveage && age < agemodel[i+1].aveage) { 4537: found = i; 4538: } 4539: } 4540: } 4541: else { 4542: found = 0; 4543: } 4544: if(found != -1) { 4545: (void)sprintf(string,"%.4f (Ma) %.3f (mcd/Ma)", age, agemodel[found].sedrate); 4546: } 4547: else { 4548: (void)sprintf(string, "%8.3f", age); 4549: } 4550: xmstring = XmStringCreateSimple(string); 4551: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4552: XmStringFree(xmstring); 4553: } 4554: 4555: /* are in area of window where splice is drawn 4556: */ 4557: else if(x > OFF + SPACE && x < OFF + SPACE + varaxislen) { 4558: 4559: corenum = -1; 4560: 4561: /* find which core. note that all samples should 4562: be good because spcomp.var is composed with CleanUpSpliceCore 4563: */ 4564: for(j=0; j < spcomp.numcores; ++j){ 4565: if(age >= spcomp.age[j][0] && age <= spcomp.age[j][spcomp.numpercore[j] - 1]){ 4566: if(smooth.plot == SMOOTHED && 4567: data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 4568: return; 4569: } 4570: else if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 4571: sm = NO; 4572: } 4573: corenum = j; 4574: break; 4575: } 4576: } 4577: 4578: /* find nearest sample. 4579: */ 4580: arraynum = -1; 4581: if(corenum != -1) { 4582: diff = 99999.0; 4583: for(j=0; j<spcomp.numpercore[corenum]; ++j){ 4584: checkage = age - spcomp.age[corenum][j]; 4585: if(fabs(checkage) < diff){ 4586: diff = fabs(checkage); 4587: arraynum = j; 4588: } 4589: } 4590: } 4591: else { 4592: xmstring = XmStringCreateSimple(""); 4593: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4594: XmStringFree(xmstring); 4595: return; 4596: } 4597: 4598: if(corenum != -1 && arraynum != -1) { 4599: hole = spcomp.hole[corenum]; 4600: core = spcomp.core[corenum]; 4601: num = spcomp.MapToOrig[corenum][arraynum]; 4602: var = spcomp.var[corenum][arraynum]; 4603: (void)sprintf(string,"%d %c %d %c %s %.1f %.2f(mbsf) %.2f(mcd) %.4f(Ma) %.2f", 4604: data[dset]->site, 4605: data[dset]->holes[hole]->name, 4606: data[dset]->holes[hole]->core[core]->num, 4607: data[dset]->holes[hole]->core[core]->value[num]->type, 4608: data[dset]->holes[hole]->core[core]->value[num]->section, 4609: data[dset]->holes[hole]->core[core]->value[num]->top_int, 4610: data[dset]->holes[hole]->core[core]->value[num]->sb_depth, 4611: data[dset]->holes[hole]->core[core]->value[num]->sb_depth + data[dset]->holes[hole]->core[core]->cum_dep_offset, 4612: spcomp.age[corenum][arraynum], 4613: var); 4614: if(sm == YES && data[dset]->holes[hole]->core[core]->value[num]->smooth_ok == SMOK) { 4615: (void)sprintf(varstring, " %.2f", data[dset]->holes[hole]->core[core]->value[num]->sm_data); 4616: strncat(string, varstring, (int)strlen(varstring)); 4617: } 4618: xmstring = XmStringCreateSimple(string); 4619: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4620: XmStringFree(xmstring); 4621: 4622: if((int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0) { 4623: splicetoagecorenum = corenum; 4624: splicetoagearraynum = arraynum; 4625: have_splicetoage_tie = DO; 4626: last_splicetoage_tie = TIE1; 4627: (void)sprintf(string,"%d %c %d %c %s %.1f", 4628: data[dset]->site, 4629: data[dset]->holes[hole]->name, 4630: data[dset]->holes[hole]->core[core]->num, 4631: data[dset]->holes[hole]->core[core]->value[num]->type, 4632: data[dset]->holes[hole]->core[core]->value[num]->section, 4633: data[dset]->holes[hole]->core[core]->value[num]->top_int); 4634: xmstring = XmStringCreateSimple(string); 4635: XtVaSetValues(labelSpliceToAgeTieID, XmNlabelString, xmstring, NULL); 4636: XmStringFree(xmstring); 4637: (void)sprintf(string,"%.2f", data[dset]->holes[hole]->core[core]->value[num]->sb_depth); 4638: xmstring = XmStringCreateSimple(string); 4639: XtVaSetValues(labelSpliceToAgeTiembsf, XmNlabelString, xmstring, NULL); 4640: XmStringFree(xmstring); 4641: (void)sprintf(string,"%.3f", var); 4642: xmstring = XmStringCreateSimple(string); 4643: XtVaSetValues(labelSpliceToAgeTieVar, XmNlabelString, xmstring, NULL); 4644: XmStringFree(xmstring); 4645: (void)sprintf(string,"%.2f", data[dset]->holes[hole]->core[core]->value[num]->sb_depth + 4646: data[dset]->holes[hole]->core[core]->cum_dep_offset); 4647: xmstring = XmStringCreateSimple(string); 4648: XtVaSetValues(labelSpliceToAgeTieSplicemcd, XmNlabelString, xmstring, NULL); 4649: XmStringFree(xmstring); 4650: (void)sprintf(string,"%.3f", spcomp.age[corenum][arraynum]); 4651: xmstring = XmStringCreateSimple(string); 4652: XtVaSetValues(labelSpliceToAgeTieSpliceAge, XmNlabelString, xmstring, NULL); 4653: XmStringFree(xmstring); 4654: } 4655: } 4656: else { 4657: xmstring = XmStringCreateSimple(""); 4658: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4659: XmStringFree(xmstring); 4660: } 4661: } 4662: 4663: /* have time series and are in the area of window where it is drawn 4664: */ 4665: else if(have_time_series == DO && (x > OFF + SPACE + varaxislen + SPACE && x < OFF + SPACE + 2 * varaxislen + SPACE)) { 4666: if(age >= timeseries.age[0] && age <= timeseries.age[timeseries.n-1]) { 4667: diff = 99999.0; 4668: for(j=0; j<timeseries.n; ++j){ 4669: checkage = age - timeseries.age[j]; 4670: if(fabs(checkage) < diff){ 4671: diff = fabs(checkage); 4672: arraynum = j; 4673: } 4674: } 4675: (void)sprintf(string," %.4f(Ma) %.3f", timeseries.age[arraynum], timeseries.val[arraynum]); 4676: xmstring = XmStringCreateSimple(string); 4677: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4678: XmStringFree(xmstring); 4679: 4680: if((int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) { 4681: timeseriesarraynum = arraynum; 4682: have_timeseries_tie = DO; 4683: last_splicetoage_tie = TIE2; 4684: (void)sprintf(string," %.3f", timeseries.age[arraynum]); 4685: xmstring = XmStringCreateSimple(string); 4686: XtVaSetValues(labelSpliceToAgeTimeSeriesAge, XmNlabelString, xmstring, NULL); 4687: XmStringFree(xmstring); 4688: } 4689: } 4690: else { 4691: 4692: } 4693: } 4694: 4695: else { 4696: age = ((y - top_off_splicetoage) * spliceageperpix) + top_age_splicetoage; 4697: (void)sprintf(string, "%8.3f", age); 4698: xmstring = XmStringCreateSimple(string); 4699: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4700: XmStringFree(xmstring); 4701: } 4702: } 4703: else if((int)strcmp(args[0], "but_1_up") == 0 || (int)strcmp(args[0], "but_2_up") == 0 || (int)strcmp(args[0], "but_3_up") == 0) { 4704: xmstring = XmStringCreateSimple(""); 4705: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4706: XmStringFree(xmstring); 4707: } 4708: 4709: if(((int)strcmp(args[0], "but_2_down") == 0 || (int)strcmp(args[0], "but_2_move") == 0 || 4710: (int)strcmp(args[0], "but_3_down") == 0 || (int)strcmp(args[0], "but_3_move") == 0) && 4711: (have_splicetoage_tie == DO || have_timeseries_tie == DO) && 4712: (have_splicetoage == DO && have_time_series == DO)){ 4713: if((have_splicetoage_tie == DO && have_timeseries_tie == DONT) || 4714: (have_splicetoage_tie == DONT && have_timeseries_tie == DO)) { 4715: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 4716: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 4717: } 4718: } 4719: else if(have_splicetoage_tie == DO && have_timeseries_tie == DO && 4720: have_splicetoage == DO && have_time_series == DO) { 4721: XtSetSensitive(pushButtonSpliceToAgeAddTiedDatum, True); 4722: XtSetSensitive(pushButtonSpliceToAgeRecorrelate, True); 4723: XtSetSensitive(pushButtonSpliceToAgeClearTie, True); 4724: SpliceToAgeRecorrelate((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 4725: } 4726: } 4727: 4728: /* the event is an up or down arrow 4729: */ 4730: if((int)strcmp(args[0], "arrow_up") == 0 || (int)strcmp(args[0], "arrow_down") == 0) { 4731: 4732: if(last_splicetoage_tie == TIE1 && (int)strcmp(args[0], "arrow_up") == 0) { 4733: if(splicetoagearraynum - 1 >= 0){ 4734: --splicetoagearraynum; 4735: report_tie1 = YES; 4736: } 4737: else if(splicetoagecorenum > 0) { 4738: --splicetoagecorenum; 4739: splicetoagearraynum = spcomp.numpercore[splicetoagecorenum] - 1; 4740: report_tie1 = YES; 4741: } 4742: else { 4743: return; 4744: } 4745: } 4746: else if(last_splicetoage_tie == TIE2 && (int)strcmp(args[0], "arrow_up") == 0) { 4747: if(timeseriesarraynum - 1 >= 0){ 4748: --timeseriesarraynum; 4749: report_tie2 = YES; 4750: } 4751: else { 4752: return; 4753: } 4754: } 4755: else if(last_splicetoage_tie == TIE1 && (int)strcmp(args[0], "arrow_down") == 0) { 4756: if(splicetoagearraynum + 1 < spcomp.numpercore[splicetoagecorenum]){ 4757: ++splicetoagearraynum; 4758: report_tie1 = YES; 4759: } 4760: else if(splicetoagecorenum < spcomp.numcores - 1) { 4761: ++splicetoagecorenum; 4762: splicetoagearraynum = 0; 4763: report_tie1 = YES; 4764: } 4765: else { 4766: return; 4767: } 4768: } 4769: else if(last_splicetoage_tie == TIE2 && (int)strcmp(args[0], "arrow_down") == 0) { 4770: if(timeseriesarraynum + 1 < timeseries.n){ 4771: ++timeseriesarraynum; 4772: report_tie2 = YES; 4773: } 4774: else { 4775: return; 4776: } 4777: } 4778: 4779: if(report_tie1 == YES) { 4780: hole = spcomp.hole[splicetoagecorenum]; 4781: core = spcomp.core[splicetoagecorenum]; 4782: num = spcomp.MapToOrig[splicetoagecorenum][splicetoagearraynum]; 4783: var = spcomp.var[splicetoagecorenum][splicetoagearraynum]; 4784: (void)sprintf(string,"%d %c %d %c %s %.1f %.2f(mbsf) %.2f(mcd) %.4f(Ma) %.2f", 4785: data[dset]->site, 4786: data[dset]->holes[hole]->name, 4787: data[dset]->holes[hole]->core[core]->num, 4788: data[dset]->holes[hole]->core[core]->value[num]->type, 4789: data[dset]->holes[hole]->core[core]->value[num]->section, 4790: data[dset]->holes[hole]->core[core]->value[num]->top_int, 4791: data[dset]->holes[hole]->core[core]->value[num]->sb_depth, 4792: data[dset]->holes[hole]->core[core]->value[num]->sb_depth + data[dset]->holes[hole]->core[core]->cum_dep_offset, 4793: spcomp.age[splicetoagecorenum][splicetoagearraynum], 4794: var); 4795: if(sm == YES && data[dset]->holes[hole]->core[core]->value[num]->smooth_ok == SMOK) { 4796: (void)sprintf(varstring, " %.2f", data[dset]->holes[hole]->core[core]->value[num]->sm_data); 4797: strncat(string, varstring, (int)strlen(varstring)); 4798: } 4799: xmstring = XmStringCreateSimple(string); 4800: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4801: XmStringFree(xmstring); 4802: have_splicetoage_tie = DO; 4803: last_splicetoage_tie = TIE1; 4804: (void)sprintf(string,"%d %c %d %c %s %.1f", 4805: data[dset]->site, 4806: data[dset]->holes[hole]->name, 4807: data[dset]->holes[hole]->core[core]->num, 4808: data[dset]->holes[hole]->core[core]->value[num]->type, 4809: data[dset]->holes[hole]->core[core]->value[num]->section, 4810: data[dset]->holes[hole]->core[core]->value[num]->top_int); 4811: xmstring = XmStringCreateSimple(string); 4812: XtVaSetValues(labelSpliceToAgeTieID, XmNlabelString, xmstring, NULL); 4813: XmStringFree(xmstring); 4814: (void)sprintf(string,"%.2f", data[dset]->holes[hole]->core[core]->value[num]->sb_depth); 4815: xmstring = XmStringCreateSimple(string); 4816: XtVaSetValues(labelSpliceToAgeTiembsf, XmNlabelString, xmstring, NULL); 4817: XmStringFree(xmstring); 4818: (void)sprintf(string,"%.3f", var); 4819: xmstring = XmStringCreateSimple(string); 4820: XtVaSetValues(labelSpliceToAgeTieVar, XmNlabelString, xmstring, NULL); 4821: XmStringFree(xmstring); 4822: (void)sprintf(string,"%.2f", data[dset]->holes[hole]->core[core]->value[num]->sb_depth + 4823: data[dset]->holes[hole]->core[core]->cum_dep_offset); 4824: xmstring = XmStringCreateSimple(string); 4825: XtVaSetValues(labelSpliceToAgeTieSplicemcd, XmNlabelString, xmstring, NULL); 4826: XmStringFree(xmstring); 4827: (void)sprintf(string,"%.3f", spcomp.age[splicetoagecorenum][splicetoagearraynum]); 4828: xmstring = XmStringCreateSimple(string); 4829: XtVaSetValues(labelSpliceToAgeTieSpliceAge, XmNlabelString, xmstring, NULL); 4830: XmStringFree(xmstring); 4831: } 4832: else if(report_tie2 == YES) { 4833: (void)sprintf(string," %.4f(Ma) %.3f", timeseries.age[timeseriesarraynum], timeseries.val[timeseriesarraynum]); 4834: xmstring = XmStringCreateSimple(string); 4835: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 4836: XmStringFree(xmstring); 4837: 4838: have_timeseries_tie = DO; 4839: last_splicetoage_tie = TIE2; 4840: (void)sprintf(string," %.3f", timeseries.age[timeseriesarraynum]); 4841: xmstring = XmStringCreateSimple(string); 4842: XtVaSetValues(labelSpliceToAgeTimeSeriesAge, XmNlabelString, xmstring, NULL); 4843: XmStringFree(xmstring); 4844: } 4845: 4846: if((have_splicetoage_tie == DO && have_timeseries_tie == DONT) || 4847: (have_splicetoage_tie == DONT && have_timeseries_tie == DO)) { 4848: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 4849: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 4850: } 4851: } 4852: else if(have_splicetoage_tie == DO && have_timeseries_tie == DO && 4853: have_splicetoage == DO && have_time_series == DO) { 4854: XtSetSensitive(pushButtonSpliceToAgeAddTiedDatum, True); 4855: XtSetSensitive(pushButtonSpliceToAgeRecorrelate, True); 4856: XtSetSensitive(pushButtonSpliceToAgeClearTie, True); 4857: SpliceToAgeRecorrelate((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 4858: } 4859: 4860: } 4861: 4862: if((int)strcmp(args[0], "return_down") == 0) { 4863: if(have_splicetoage_tie == DO && have_timeseries_tie == DO) { 4864: SpliceToAgeAddTiedDatum((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 4865: } 4866: } 4867: } 4868: 4869: else { 4870: } 4871: 4872: (void)sprintf(string, ""); 4873: } 4874: 4875: /* ARGSUSED */ 4876: void 4877: DrawDrawingAreaEdit(w, client, call) 4878: Widget w; 4879: XtPointer client; 4880: XtPointer call; 4881: { 4882: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 4883: 4884: int i, ii, j, jj, kk, n, tic, sm, foundtop, foundbot, depcull, pixpermeter, axispixlen, 4885: sx, sy, sdx, sdy, xoff, left, dum, err, ticpixlen, annot, label, scalemax, 4886: draw_ties, who, starting_hole; 4887: short int x, y; 4888: unsigned short int width, height; 4889: char s[50]; 4890: float unitinc, *pdat, dep, dat[MAXPERCORE], sbd[MAXPERCORE], 4891: botoffset, topoffset, maxmeter; 4892: double check, fract, ip; 4893: Dimension win_height, win_width; 4894: void AxisDep(); 4895: 4896: if(reason_for_redraw == NONE) { 4897: return; 4898: } 4899: 4900: /* get the height and width of the drawing area and 4901: the slider scale value which is the starting value of the y axis 4902: */ 4903: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 4904: XmScaleGetValue(drawingAreaEditScale, &scale_val); 4905: XmScaleGetValue(scaleCores, &starting_hole); 4906: 4907: /* find the maximum length of the depth axis 4908: */ 4909: if(have_data == DO){ 4910: check = maxdep/deptic; 4911: fract = modf(check, &ip); 4912: if(fract == 0.0){ 4913: maxmeter = maxdep; 4914: } 4915: else { 4916: maxmeter = (ip * deptic) + deptic; 4917: } 4918: for(i=0; i<data[dset]->numholes; ++i){ 4919: if(data[dset]->holes[i]->core[data[dset]->holes[i]->numcores-1]->cum_dep_offset + 4920: data[dset]->holes[i]->core[data[dset]->holes[i]->numcores-1]->value[data[dset]->holes[i]->core[data[dset]->holes[i]->numcores-1]->numvalues-1]->sb_depth > maxmeter){ 4921: maxdep = data[dset]->holes[i]->core[data[dset]->holes[i]->numcores-1]->value[data[dset]->holes[i]->core[data[dset]->holes[i]->numcores-1]->numvalues-1]->sb_depth + 4922: data[dset]->holes[i]->core[data[dset]->holes[i]->numcores-1]->cum_dep_offset; 4923: } 4924: } 4925: if(maxdep > maxmeter){ 4926: while(maxdep > maxmeter){ 4927: maxmeter = maxmeter + deptic; 4928: } 4929: } 4930: scalemax = maxmeter; 4931: XtVaSetValues(drawingAreaEditScale, XmNmaximum, scalemax, NULL); 4932: XtVaSetValues(drawingAreaViewScale, XmNmaximum, scalemax, NULL); 4933: } 4934: else { 4935: maxmeter = MAXDEP; 4936: check = maxmeter/deptic; 4937: fract = modf(check, &ip); 4938: if(fract == 0.0){ 4939: } 4940: else { 4941: maxmeter = (ip * deptic) + deptic; 4942: } 4943: scalemax = maxmeter; 4944: XtVaSetValues(drawingAreaEditScale, XmNmaximum, scalemax, NULL); 4945: XtVaSetValues(drawingAreaViewScale, XmNmaximum, scalemax, NULL); 4946: } 4947: 4948: tic = deptic; /*tic increment in meters*/ 4949: top_meter_edit = scale_val; /*value at top off depth axis in meters*/ 4950: if(top_meter_edit == 0.0){ 4951: top_off_edit = OFF; /*if 0.0 then give an offset from top of window*/ 4952: } 4953: else { 4954: top_off_edit = 0; 4955: } 4956: 4957: 4958: check = top_meter_edit/deptic; 4959: fract = modf(check, &ip); /* is the top value divisable by tic or is there a remainder*/ 4960: 4961: if(fract == 0.0) { /*if no remainder than y axis starts at a tic*/ 4962: unitinc = top_meter_edit; 4963: } 4964: else { /*there is a remainder so axis does not start at a tic*/ 4965: unitinc = tic * ip + tic; /*so the first tic is the next one down*/ 4966: } 4967: 4968: axispixlen = (int)win_height - top_off_edit; /*pixel length of depth axis*/ 4969: 4970: /* calculate how many pixels in a meter; truncate the result so mult. 4971: meters are equal to a pixel value that is a whole number 4972: */ 4973: check = axispixlen/depmeterdisplayed; 4974: fract = modf(check, &ip); 4975: pixpermeter = ip; 4976: 4977: ticpixlen = pixpermeter * tic; 4978: check = pixpermeter; 4979: depperpix = 1.0/check; 4980: 4981: if(unitinc == top_meter_edit){ /*if axis does not start at a tic calculate the distance*/ 4982: left = 0; /*in pixels from top of axis to first tic*/ 4983: } 4984: else { 4985: left = (unitinc - top_meter_edit) * pixpermeter; 4986: } 4987: 4988: if(clip == YES) { 4989: 4990: /* this drawing function has been called because... 4991: */ 4992: /* event was either resize or expose; let the window manager handle it 4993: */ 4994: if(acs != NULL) { 4995: if(acs->reason == XmCR_EXPOSE || acs->reason == XmCR_RESIZE) { 4996: } 4997: } 4998: 4999: /* the reason was clear window 5000: */ 5001: else if(reason_for_redraw == DRAW_CLEAR) { 5002: 5003: XClearWindow(XtDisplay(w), XtWindow(w)); 5004: } 5005: 5006: /* the reason is such that only a portion of the window must be redrawn 5007: */ 5008: else if(reason_for_redraw == DRAW_TIES || reason_for_redraw == DRAW_DEPTHSHIFT || 5009: reason_for_redraw == DRAW_DEPTHSHIFTUNDO) { 5010: 5011: /* clear the clip region 5012: */ 5013: who = EDIT; 5014: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, bgPixel); 5015: 5016: FindClipRegion(who, (int)win_width, (int)win_height, starting_hole); 5017: XFillRectangle(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, clip_x, clip_y, clip_width, clip_height); 5018: MakeClipMask(XtDisplay(w), gc_drawingAreaEdit, clip_x, clip_y, clip_width, clip_height); 5019: } 5020: 5021: else if(reason_for_redraw == DRAW_CLEARTIE) { 5022: 5023: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, bgPixel); 5024: XFillRectangle(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, clip_x, clip_y, clip_width, clip_height); 5025: MakeClipMask(XtDisplay(w), gc_drawingAreaEdit, clip_x, clip_y, clip_width, clip_height); 5026: } 5027: 5028: /* the reason is such that entire window must be redrawn 5029: */ 5030: else if(reason_for_redraw == DRAW_EVERYTHING || reason_for_redraw == DISPLAY_CHANGE) { 5031: 5032: /*set the clip region to entire window and clear the drawing area 5033: */ 5034: clip_x = 0; 5035: clip_y = 0; 5036: clip_width = (int)win_width; 5037: clip_height = (int)win_height; 5038: MakeClipMask(XtDisplay(w), gc_drawingAreaEdit, clip_x, clip_y, clip_width, clip_height); 5039: XClearWindow(XtDisplay(w), XtWindow(w)); 5040: } 5041: 5042: /* no match for reason?; draw everything 5043: */ 5044: else { 5045: 5046: /*set the clip region to entire window and clear the drawing area 5047: */ 5048: clip_x = 0; 5049: clip_y = 0; 5050: clip_width = (int)win_width; 5051: clip_height = (int)win_height; 5052: MakeClipMask(XtDisplay(w), gc_drawingAreaEdit, clip_x, clip_y, clip_width, clip_height); 5053: XClearWindow(XtDisplay(w), XtWindow(w)); 5054: } 5055: } 5056: 5057: else { 5058: 5059: XClearWindow(XtDisplay(w), XtWindow(w)); 5060: } 5061: 5062: /* set color for axis and labels and draw depth axis 5063: */ 5064: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[LABEL_COLOR]); 5065: 5066: annot = 1; 5067: label = NO; 5068: AxisDep(w, XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5069: maxmeter, top_off_edit, left, ticpixlen, deptic, unitinc, depperpix, annot, label); 5070: 5071: /* if there is data stored plot it 5072: */ 5073: if(have_data == DO) { 5074: minvar = data[dset]->min; 5075: maxvar = data[dset]->max; 5076: varperpix = (maxvar - minvar)/varaxislen; 5077: 5078: /* if there is room label the holes 5079: */ 5080: if(unitinc == 0.0 && top_off_edit == OFF) { 5081: (void)sprintf(s, "leg %d site %d", data[dset]->leg, data[dset]->site); 5082: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5083: OFF+20, OFF-35, s, (int)strlen(s)); 5084: } 5085: 5086: /* get the cores scale value. it will be the array num of 5087: the first hole to plot. in other words; where to 'skip to' 5088: */ 5089: if(starting_hole >= data[dset]->numholes) { 5090: return; 5091: } 5092: 5093: for(ii=starting_hole; ii<data[dset]->numholes; ++ii) { 5094: 5095: xoff=OFF+ SPACE + (ii - starting_hole) * (varaxislen+SPACE); 5096: if(unitinc == 0.0 && top_off_edit == OFF) { 5097: (void)sprintf(s, "hole %c", data[dset]->holes[ii]->name); 5098: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5099: xoff, OFF-10, s, (int)strlen(s)); 5100: } 5101: } 5102: 5103: /*note that CleanUpCore returns one core that has been 5104: culled of bad values and has had the cum_depth_offset 5105: added to original sbd(if have it) 5106: */ 5107: 5108: for(ii=starting_hole; ii<data[dset]->numholes; ++ii) { 5109: 5110: xoff=OFF+ SPACE + (ii - starting_hole) * (varaxislen+SPACE); 5111: 5112: for(jj=0; jj<data[dset]->holes[ii]->numcores; ++jj) { 5113: 5114: /* if are plotting both the unsmoothed and smoothed 5115: plot the smoothed 5116: */ 5117: if(data[dset]->holes[ii]->core[jj]->value[0]->quality == BAD_CORE_NUM){ 5118: } 5119: else{ 5120: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5121: smooth.plot == SMOOTHEDBOTH && 5122: data[dset]->holes[ii]->core[jj]->smooth_status == SMOK){ 5123: sm = YES; 5124: dum = -1; 5125: err = CleanUpCore(dset, ii, jj, &n, sbd, dat, sm, &dum); 5126: if(n < 2 || err > 0) { 5127: } 5128: else { 5129: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[SMOOTH_COLOR]); 5130: sx = (dat[0] - minvar)/varperpix + xoff; 5131: sy = (sbd[0] - top_meter_edit)/depperpix + top_off_edit; 5132: for(kk=1; kk<n; ++kk) { 5133: sdx = (dat[kk] - minvar)/varperpix+xoff; 5134: sdy = (sbd[kk] - top_meter_edit)/depperpix+top_off_edit; 5135: if(sy > (int)win_height) { 5136: break; 5137: } 5138: else if(sy <= 0 && sdy <= 0) { 5139: } 5140: else { 5141: if(sy < 0 && sdy > 0) { 5142: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 5143: sy = 0; 5144: } 5145: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5146: sx, sy, sdx, sdy); 5147: } 5148: sx = sdx; 5149: sy = sdy; 5150: } 5151: } 5152: } 5153: } 5154: 5155: /* plot the smoothed or unsmoothed depending on choice. 5156: */ 5157: if(smooth.method == NONE || smooth.plot == UNSMOOTHED){ 5158: sm = NO; 5159: } 5160: else if(smooth.plot == SMOOTHEDBOTH){ 5161: sm = NO; 5162: } 5163: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5164: smooth.plot == SMOOTHED){ 5165: sm = YES; 5166: } 5167: else { 5168: sm = NO; 5169: } 5170: 5171: if(data[dset]->holes[ii]->core[jj]->value[0]->quality == BAD_CORE_NUM){ 5172: } 5173: else if(sm == YES && data[dset]->holes[ii]->core[jj]->smooth_status != SMOK) { 5174: } 5175: else { 5176: dum = -1; 5177: err = CleanUpCore(dset, ii, jj, &n, sbd, dat, sm, &dum); 5178: 5179: if(n < 2 || err > 0) { 5180: } 5181: else { 5182: if(data[dset]->holes[ii]->core[jj]->did_offset == YES) { 5183: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[MCD_COLOR]); 5184: } 5185: else if(sm == NO) { 5186: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[MBSF_COLOR]); 5187: } 5188: else if(sm == YES) { 5189: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[SMOOTH_COLOR]); 5190: } 5191: sx = (dat[0] - minvar)/varperpix + xoff; 5192: sy = (sbd[0] - top_meter_edit)/depperpix + top_off_edit; 5193: for(kk=1; kk<n; ++kk) { 5194: sdx = (dat[kk] - minvar)/varperpix+xoff; 5195: sdy = (sbd[kk] - top_meter_edit)/depperpix+top_off_edit; 5196: if(sy > (int)win_height) { 5197: break; 5198: } 5199: else if(sy <= 0 && sdy <= 0) { 5200: } 5201: else { 5202: if(sy < 0 && sdy > 0) { 5203: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 5204: sy = 0; 5205: } 5206: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5207: sx, sy, sdx, sdy); 5208: } 5209: sx = sdx; 5210: sy = sdy; 5211: } 5212: sx = xoff - 15; 5213: sy = sy - 5; 5214: if(sy > (int)win_height) { 5215: } 5216: else if(sy <= 0) { 5217: } 5218: else { 5219: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[LABEL_COLOR]); 5220: (void)sprintf(s, "%d", data[dset]->holes[ii]->core[jj]->num); 5221: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5222: sx, sy, s, (int)strlen(s)); 5223: } 5224: } 5225: } 5226: } 5227: } 5228: 5229: /* check to see that the cores with ties are in view 5230: */ 5231: if(have_tie1 == DO && have_tie2 == DO && tie1holenum >= starting_hole && tie2holenum >= starting_hole) { 5232: draw_ties = YES; 5233: } 5234: else if(have_tie1 == DO && have_tie2 == DO && (tie1holenum < starting_hole || tie2holenum < starting_hole)) { 5235: draw_ties = NO; 5236: } 5237: if((have_tie1 == DO || have_tie2 == DO) && starting_hole == data[dset]->numholes -1) { 5238: draw_ties = NO; 5239: } 5240: else if(have_tie1 == DO && tie1holenum >= starting_hole) { 5241: draw_ties = YES; 5242: } 5243: else if(have_tie1 == DO && tie1holenum < starting_hole) { 5244: draw_ties = NO; 5245: } 5246: else if(have_tie2 == DO && tie2holenum >= starting_hole) { 5247: draw_ties = YES; 5248: } 5249: else if(have_tie2 == DO && tie2holenum < starting_hole) { 5250: draw_ties = NO; 5251: } 5252: else { 5253: draw_ties = NO; 5254: } 5255: 5256: /* tie points 5257: */ 5258: if(have_tie1 == DO && draw_ties == YES){ 5259: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5260: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 5261: data[dset]->holes[tie1holenum]->core[tie1corenum]->smooth_status == SMOK){ 5262: sx=(data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sm_data-minvar)/varperpix+ 5263: OFF + SPACE + (tie1holenum - starting_hole) * (varaxislen + SPACE); 5264: } 5265: else { 5266: pdat = data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->data; 5267: sx=(*pdat - minvar)/varperpix+ 5268: OFF + SPACE + (tie1holenum - starting_hole) * (varaxislen + SPACE); 5269: } 5270: dep = data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth + 5271: data[dset]->holes[tie1holenum]->core[tie1corenum]->cum_dep_offset; 5272: sy=(dep - top_meter_edit)/depperpix + top_off_edit; 5273: if(smooth.method == SMOOTHED && data[dset]->holes[tie1holenum]->core[tie1corenum]->smooth_status != SMOK){ 5274: } 5275: else { 5276: XSetForeground(XtDisplay(drawingAreaEdit), gc_drawingAreaEdit, 5277: fgPixel[TIEPTFIXED_COLOR]); 5278: XFillArc(XtDisplay(drawingAreaEdit), XtWindow(drawingAreaEdit), 5279: gc_drawingAreaEdit, 5280: sx-(POINTSIZE/2), sy-(POINTSIZE/2), 5281: POINTSIZE, POINTSIZE, 0, 360*64); 5282: } 5283: } 5284: 5285: if(have_tie2 == DO && draw_ties == YES){ 5286: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5287: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 5288: data[dset]->holes[tie2holenum]->core[tie2corenum]->smooth_status == SMOK){ 5289: sdx=(data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sm_data-minvar)/varperpix+ 5290: OFF + SPACE + (tie2holenum - starting_hole) * (varaxislen + SPACE); 5291: } 5292: else { 5293: pdat = data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->data; 5294: sdx=(*pdat - minvar)/varperpix+ 5295: OFF + SPACE + (tie2holenum - starting_hole) * (varaxislen + SPACE); 5296: } 5297: dep = data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth + 5298: data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset; 5299: sdy=(dep - top_meter_edit)/depperpix + top_off_edit; 5300: if(smooth.method == SMOOTHED && data[dset]->holes[tie2holenum]->core[tie2corenum]->smooth_status != SMOK){ 5301: } 5302: else { 5303: XSetForeground(XtDisplay(drawingAreaEdit), gc_drawingAreaEdit, 5304: fgPixel[TIEPTSHIFT_COLOR]); 5305: XFillArc(XtDisplay(drawingAreaEdit), XtWindow(drawingAreaEdit), 5306: gc_drawingAreaEdit, 5307: sdx-(POINTSIZE/2), sdy-(POINTSIZE/2), 5308: POINTSIZE, POINTSIZE, 0, 360*64); 5309: } 5310: } 5311: 5312: /* if have both tie points draw the tie line 5313: */ 5314: if(have_tie1 == DO && have_tie2 == DO && draw_ties == YES){ 5315: 5316: if(smooth.method == SMOOTHED && 5317: (data[dset]->holes[tie1holenum]->core[tie1corenum]->smooth_status != SMOK || 5318: data[dset]->holes[tie2holenum]->core[tie2corenum]->smooth_status != SMOK)) { 5319: } 5320: else { 5321: /*set color for tie 5322: */ 5323: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[TIELINE_COLOR]); 5324: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, sx, sy, sdx, sdy); 5325: } 5326: } 5327: 5328: /*if have correlated draw the core 2 overtop core 1 5329: */ 5330: if(have_shift == DO && draw_ties == YES){ 5331: 5332: if(smooth.method == NONE){ 5333: sm = NO; 5334: } 5335: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5336: smooth.plot == UNSMOOTHED){ 5337: sm = NO; 5338: } 5339: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5340: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 5341: data[dset]->holes[tie2holenum]->core[tie2corenum]->smooth_status == SMOK){ 5342: sm = YES; 5343: } 5344: else { 5345: sm = NO; 5346: } 5347: 5348: dum = -1; 5349: err = CleanUpCore(dset, tie2holenum, tie2corenum, &n, sbd, dat, sm, &dum); 5350: 5351: if(n < 2 || err > 0) { 5352: } 5353: else { 5354: xoff=OFF + SPACE + (tie1holenum - starting_hole) * (varaxislen + SPACE); 5355: sx = (dat[0] - minvar)/varperpix + xoff; 5356: sy = (sbd[0] - top_meter_edit + tiedepoffset)/depperpix + top_off_edit; 5357: for(kk=1; kk<n; ++kk) { 5358: sdx = (dat[kk] - minvar)/varperpix+xoff; 5359: sdy = (sbd[kk] - top_meter_edit + tiedepoffset)/depperpix + top_off_edit; 5360: if(sy > (int)win_height) { 5361: break; 5362: } 5363: if(sy <= 0 && sdy <= 0) { 5364: } 5365: else { 5366: if(sbd[kk] >= sbd[tie2arraynum] - winlen && sbd[kk] <= sbd[tie2arraynum] + winlen){ 5367: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[OVERLAYINCORR_COLOR]); 5368: } 5369: else { 5370: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[OVERLAYOUTCORR_COLOR]); 5371: } 5372: if(sy < 0 && sdy > 0) { 5373: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 5374: sy = 0; 5375: } 5376: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5377: sx, sy, sdx, sdy); 5378: } 5379: sx = sdx; 5380: sy = sdy; 5381: } 5382: } 5383: } 5384: } 5385: 5386: /* no data stored 5387: */ 5388: else if(have_data == DONT) { 5389: return; 5390: } 5391: 5392: /* draw the stratigraphy if have any. 5393: use the cum_dep_offset to adjust the depth 5394: */ 5395: if(have_strat == DO && have_data == DO){ 5396: 5397: /* for each file(strat type) find out what type it 5398: is and set the color 5399: */ 5400: for(ii=0; ii<strat_file_cnt; ++ii){ 5401: if(strat[ii]->type == PALEOMAG){ 5402: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[PALEOMAG_COLOR]); 5403: } 5404: else if(strat[ii]->type == DIATOMS){ 5405: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[DIATOM_COLOR]); 5406: } 5407: else if(strat[ii]->type == RADIOLARIA){ 5408: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[RAD_COLOR]); 5409: } 5410: else if(strat[ii]->type == FORAMINIFERA){ 5411: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[FORAM_COLOR]); 5412: } 5413: else if(strat[ii]->type == NANNOFOSSILS){ 5414: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[NANNO_COLOR]); 5415: } 5416: 5417: for(jj=0; jj<strat[ii]->data_cnt; ++jj){ 5418: 5419: /* find the hole current datum is in 5420: */ 5421: 5422: for(i=starting_hole; i<data[dset]->numholes; ++i){ 5423: 5424: foundtop = NO; 5425: foundbot = NO; 5426: depcull = NO; 5427: if(data[dset]->holes[i]->name == strat[ii]->data[jj].top.hole){ 5428: 5429: sx = OFF + SPACE + (i - starting_hole) * (SPACE + varaxislen); 5430: 5431: /* find which cores the top and bottom 5432: datums are in and set the depth offset for each 5433: note that datum may not be in a drawn core so 5434: will then need to use the one above 5435: */ 5436: if(strat[ii]->data[jj].top.core == data[dset]->holes[i]->core[0]->num){ 5437: topoffset = data[dset]->holes[i]->core[0]->cum_dep_offset; 5438: foundtop = YES; 5439: } 5440: else if(data[dset]->holes[i]->numcores >= 2){ 5441: for(j=1; j<data[dset]->holes[i]->numcores; ++j){ 5442: if(data[dset]->holes[i]->core[j]->value[0]->quality == BAD_CORE_NUM){ 5443: depcull = YES; 5444: break; 5445: } 5446: else if(strat[ii]->data[jj].top.core == data[dset]->holes[i]->core[j]->num){ 5447: topoffset = data[dset]->holes[i]->core[j]->cum_dep_offset; 5448: foundtop = YES; 5449: break; 5450: } 5451: else if(strat[ii]->data[jj].top.core < data[dset]->holes[i]->core[j]->num && 5452: strat[ii]->data[jj].top.core > data[dset]->holes[i]->core[j-1]->num) { 5453: topoffset = data[dset]->holes[i]->core[j-1]->cum_dep_offset; 5454: foundtop = YES; 5455: break; 5456: } 5457: } 5458: } 5459: 5460: if(strat[ii]->data[jj].bot.core == data[dset]->holes[i]->core[1]->num){ 5461: botoffset = data[dset]->holes[i]->core[1]->cum_dep_offset; 5462: foundbot = YES; 5463: } 5464: else if(data[dset]->holes[i]->numcores >= 2){ 5465: for(j=1; j<data[dset]->holes[i]->numcores; ++j){ 5466: if(data[dset]->holes[i]->core[j]->value[0]->quality == BAD_CORE_NUM){ 5467: depcull = YES; 5468: break; 5469: } 5470: else if(strat[ii]->data[jj].bot.core == data[dset]->holes[i]->core[j]->num){ 5471: botoffset = data[dset]->holes[i]->core[j]->cum_dep_offset; 5472: foundbot = YES; 5473: break; 5474: } 5475: else if(strat[ii]->data[jj].bot.core < data[dset]->holes[i]->core[j]->num && 5476: strat[ii]->data[jj].bot.core > data[dset]->holes[i]->core[j-1]->num) { 5477: botoffset = data[dset]->holes[i]->core[j-1]->cum_dep_offset; 5478: foundbot = YES; 5479: break; 5480: } 5481: } 5482: } 5483: if(foundbot == YES && foundtop == YES) { 5484: goto Jump_edit; 5485: } 5486: } 5487: } 5488: 5489: Jump_edit: 5490: 5491: /* draw and label 5492: */ 5493: if((foundtop == NO && foundbot == NO && depcull == NO) || 5494: (foundtop == NO && depcull == NO) || 5495: (foundbot == NO && depcull == NO)) { 5496: strat[ii]->data[jj].x_pix_loc_edit = -1; 5497: strat[ii]->data[jj].y_pix_loc_edit = -1; 5498: } 5499: else if(depcull == NO){ 5500: sy = (strat[ii]->data[jj].top.sb_depth - top_meter_edit + topoffset)/depperpix + 5501: top_off_edit; 5502: sdy = (strat[ii]->data[jj].bot.sb_depth - top_meter_edit + botoffset)/depperpix + 5503: top_off_edit; 5504: if(sy > (int)win_height || sdy < 0) { 5505: strat[ii]->data[jj].x_pix_loc_edit = -1; 5506: strat[ii]->data[jj].y_pix_loc_edit = -1; 5507: } 5508: else { 5509: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5510: sx+10-3, sy, sx+10+3, sy); 5511: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5512: sx+10-3, sdy, sx+10+3, sdy); 5513: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5514: sx+10, sy, sx+10, sdy); 5515: (void)sprintf(s, "%s", strat[ii]->data[jj].code); 5516: strat[ii]->data[jj].x_pix_loc_edit = sx - SPACE/2 - 5; 5517: strat[ii]->data[jj].y_pix_loc_edit = sy + (sdy-sy)/2; 5518: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaEdit, 5519: strat[ii]->data[jj].x_pix_loc_edit, strat[ii]->data[jj].y_pix_loc_edit, s, (int)strlen(s)); 5520: } 5521: } 5522: } 5523: } 5524: } 5525: else { 5526: } 5527: 5528: if(clip == YES) { 5529: /*for window managers sake, set the clip region back to entire window 5530: */ 5531: width = (int)win_width; 5532: height = (int)win_height; 5533: MakeClipMask(XtDisplay(w), gc_drawingAreaEdit, 0, 0, width, height); 5534: } 5535: 5536: (void)sprintf(s, ""); 5537: } 5538: 5539: 5540: /* ARGSUSED */ 5541: void 5542: DrawDrawingAreaView(w, client, call) 5543: Widget w; 5544: XtPointer client; 5545: XtPointer call; 5546: { 5547: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 5548: 5549: int i, ii, j, jj, k, kk, tic, n, dum, sm, err, pixpermeter, axispixlen, scalemax, 5550: sx, sy, sdx, sdy, xoff, left, ticpixlen, annot, label, 5551: foundtop, foundbot, depcull, who; 5552: char s[50], string[20]; 5553: unsigned short int width, height; 5554: float unitinc, *pdat, dep, sbd[MAXPERCORE], dat[MAXPERCORE], maxmeter, 5555: botoffset, topoffset; 5556: double check, fract, ip; 5557: Dimension win_height, win_width; 5558: void AxisDep(); 5559: 5560: if(reason_for_redraw == NONE) { 5561: return; 5562: } 5563: 5564: /* get the height and width of the drawing area and the scale value 5565: */ 5566: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 5567: XmScaleGetValue(drawingAreaViewScale, &scale_val); 5568: 5569: /* find the maximum value of the depth axis 5570: */ 5571: if(have_data == DO){ 5572: check = maxdep/deptic; 5573: fract = modf(check, &ip); 5574: if(fract == 0.0){ 5575: maxmeter = maxdep; 5576: } 5577: else { 5578: maxmeter = (ip * deptic) + deptic; 5579: } 5580: if(have_splice == DO && spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1] > maxdep){ 5581: maxdep = spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1]; 5582: } 5583: if(maxdep > maxmeter){ 5584: while(maxdep > maxmeter){ 5585: maxmeter = maxmeter + deptic; 5586: } 5587: } 5588: scalemax = maxmeter; 5589: XtVaSetValues(drawingAreaEditScale, XmNmaximum, scalemax, NULL); 5590: XtVaSetValues(drawingAreaViewScale, XmNmaximum, scalemax, NULL); 5591: } 5592: else { 5593: maxmeter = MAXDEP; 5594: check = maxmeter/deptic; 5595: fract = modf(check, &ip); 5596: if(fract == 0.0){ 5597: } 5598: else { 5599: maxmeter = (ip * deptic) + deptic; 5600: } 5601: scalemax = maxmeter; 5602: XtVaSetValues(drawingAreaEditScale, XmNmaximum, scalemax, NULL); 5603: XtVaSetValues(drawingAreaViewScale, XmNmaximum, scalemax, NULL); 5604: } 5605: 5606: tic = deptic; /*tic increment in meters*/ 5607: top_meter_view = scale_val; /*value at top off depth axis in meters*/ 5608: if(top_meter_view == 0.0){ 5609: top_off_view = OFF; /*if 0.0 then give an offset from top of window*/ 5610: } 5611: else { 5612: top_off_view = 0; 5613: } 5614: 5615: check = top_meter_view/deptic; 5616: fract = modf(check, &ip); /* is the top value divisable by tic or is there a remainder*/ 5617: 5618: if(fract == 0.0) { /*if no remainder than y axis starts at a tic*/ 5619: unitinc = top_meter_view; 5620: } 5621: else { /*there is a remainder so axis does not start at a tic*/ 5622: unitinc = tic * ip + tic; /*so the first tic is the next one down*/ 5623: } 5624: 5625: axispixlen = (int)win_height - top_off_view; /*pixel length of depth axis*/ 5626: 5627: /* calculate how many pixels in a meter; truncate the result so mult. 5628: meters are equal to a pixel value that is a whole number 5629: */ 5630: check = axispixlen/depmeterdisplayed; 5631: fract = modf(check, &ip); 5632: pixpermeter = ip; 5633: 5634: ticpixlen = pixpermeter * tic; 5635: check = pixpermeter; 5636: depperpixsp = 1.0/check; 5637: 5638: if(unitinc == top_meter_view){ /*if axis does not start at a tic calculate the distance*/ 5639: left = 0; /*in pixels from top of axis to first tic*/ 5640: } 5641: else { 5642: left = (unitinc - top_meter_view) * pixpermeter; 5643: } 5644: 5645: if(clip == YES) { 5646: 5647: /* this drawing function has been called because... 5648: */ 5649: /* event was either resize or expose; let the window manager handle it 5650: */ 5651: if(acs != NULL) { 5652: if(acs->reason == XmCR_EXPOSE || acs->reason == XmCR_RESIZE) { 5653: } 5654: } 5655: 5656: /* the reason was clear window 5657: */ 5658: else if(reason_for_redraw == DRAW_CLEAR) { 5659: 5660: XClearWindow(XtDisplay(w), XtWindow(w)); 5661: } 5662: 5663: /* the reason is such that only a portion of the window must be redrawn 5664: */ 5665: else if(reason_for_redraw == DRAW_TIES || reason_for_redraw == DRAW_COREGRABBED || 5666: reason_for_redraw == DRAW_CORECLEARED || reason_for_redraw == DRAW_SPLICED || 5667: reason_for_redraw == DRAW_APPEND || reason_for_redraw == DRAW_UNDONE) { 5668: 5669: /* clear the clip region 5670: */ 5671: who = VIEW; 5672: XSetForeground(XtDisplay(w), gc_drawingAreaView, bgPixel); 5673: 5674: FindClipRegion(who, (int)win_width, (int)win_height, 0); 5675: XFillRectangle(XtDisplay(w), XtWindow(w), gc_drawingAreaView, clip_x, clip_y, clip_width, clip_height); 5676: MakeClipMask(XtDisplay(w), gc_drawingAreaView, clip_x, clip_y, clip_width, clip_height); 5677: } 5678: 5679: else if(reason_for_redraw == DRAW_CLEARTIE) { 5680: 5681: XSetForeground(XtDisplay(w), gc_drawingAreaView, bgPixel); 5682: XFillRectangle(XtDisplay(w), XtWindow(w), gc_drawingAreaView, clip_x, clip_y, clip_width, clip_height); 5683: MakeClipMask(XtDisplay(w), gc_drawingAreaView, clip_x, clip_y, clip_width, clip_height); 5684: } 5685: 5686: /* the reason is such that entire window must be redrawn 5687: */ 5688: else if(reason_for_redraw == DRAW_EVERYTHING || reason_for_redraw == DISPLAY_CHANGE || 5689: reason_for_redraw == DRAW_CLEARTIE) { 5690: 5691: /*set the clip region to entire window and clear the drawing area 5692: */ 5693: clip_x = 0; 5694: clip_y = 0; 5695: clip_width = (int)win_width; 5696: clip_height = (int)win_height; 5697: MakeClipMask(XtDisplay(w), gc_drawingAreaView, clip_x, clip_y, clip_width, clip_height); 5698: XClearWindow(XtDisplay(w), XtWindow(w)); 5699: } 5700: 5701: /* no match for reason?; draw everything 5702: */ 5703: else { 5704: 5705: /*set the clip region to entire window and clear the drawing area 5706: */ 5707: clip_x = 0; 5708: clip_y = 0; 5709: clip_width = (int)win_width; 5710: clip_height = (int)win_height; 5711: MakeClipMask(XtDisplay(w), gc_drawingAreaView, clip_x, clip_y, clip_width, clip_height); 5712: XClearWindow(XtDisplay(w), XtWindow(w)); 5713: } 5714: } 5715: 5716: else { 5717: 5718: XClearWindow(XtDisplay(w), XtWindow(w)); 5719: } 5720: 5721: /* set the axis and label color 5722: */ 5723: XSetForeground(XtDisplay(w), gc_drawingAreaView, 5724: fgPixel[LABEL_COLOR]); 5725: annot = 1; 5726: label = NO; 5727: AxisDep(w, XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5728: maxmeter, top_off_view, left, ticpixlen, deptic, unitinc, depperpixsp, annot, label); 5729: 5730: /* draw the splice composite 5731: note that bad points have allready been removed(except bad smooth) and the 5732: depth offset has allready been added 5733: */ 5734: if(have_splice == DO){ 5735: 5736: minvar = data[dset]->min; 5737: maxvar = data[dset]->max; 5738: varperpix = (maxvar - minvar)/varaxislen; 5739: 5740: if(smooth.method == NONE || smooth.plot == UNSMOOTHED){ 5741: sm = NO; 5742: } 5743: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5744: smooth.plot == SMOOTHED){ 5745: sm = YES; 5746: } 5747: else { 5748: sm = NO; 5749: } 5750: 5751: xoff = OFF + SPACE; 5752: 5753: for(j=0; j<spcomp.numcores; ++j){ 5754: 5755: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5756: smooth.plot == SMOOTHEDBOTH){ 5757: 5758: /* if are drawing both smoothed and unsmoothed 5759: draw the smoothed 5760: */ 5761: if(spcomp.numpercore[j] < 2) { 5762: } 5763: else if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 5764: } 5765: else { 5766: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[SMOOTH_COLOR]); 5767: if(j < 1){ 5768: if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK){ 5769: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 5770: } 5771: else { 5772: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 5773: } 5774: sy = (spcomp.sb_depth[j][0] - top_meter_view)/depperpixsp + top_off_view; 5775: kk = 1; 5776: } 5777: else if(j > 0 && (spcomp.splice_how[j] == REAL || spcomp.splice_how[j] == INTERPOLATED) && 5778: spcomp.map_to_table[j-1] == spcomp.map_to_table[j] - 2){ 5779: if(data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->smooth_ok >= SMOK){ 5780: sx = (data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->sm_data - minvar)/varperpix + xoff; 5781: } 5782: else { 5783: sx = (spcomp.var[j-1][spcomp.numpercore[j-1]-1] - minvar)/varperpix + xoff; 5784: } 5785: sy = (spcomp.sb_depth[j-1][spcomp.numpercore[j-1]-1] - top_meter_view)/depperpixsp + top_off_view; 5786: kk = 0; 5787: } 5788: else if(j > 0){ 5789: if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK){ 5790: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 5791: } 5792: else { 5793: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 5794: } 5795: sy = (spcomp.sb_depth[j][0] - top_meter_view)/depperpixsp + top_off_view; 5796: kk = 1; 5797: } 5798: 5799: for(k=kk; k<spcomp.numpercore[j]; ++k) { 5800: if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->smooth_ok >= SMOK){ 5801: sdx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->sm_data - minvar)/varperpix + xoff; 5802: } 5803: else { 5804: sdx = (spcomp.var[j][k] - minvar)/varperpix + xoff; 5805: } 5806: sdy = (spcomp.sb_depth[j][k] - top_meter_view)/depperpixsp + top_off_view; 5807: if(sy > (int)win_height) { 5808: break; 5809: } 5810: else if(sy <= 0 && sdy <= 0) { 5811: } 5812: else { 5813: if(sy < 0 && sdy > 0) { 5814: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 5815: sy = 0; 5816: } 5817: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5818: sx, sy, sdx, sdy); 5819: } 5820: sx = sdx; 5821: sy = sdy; 5822: } 5823: } 5824: } 5825: 5826: /* depending on plot choice draw the smoothed or unsmoothed 5827: */ 5828: if(smooth.method == NONE || smooth.plot == UNSMOOTHED){ 5829: sm = NO; 5830: } 5831: else if(smooth.plot == SMOOTHEDBOTH){ 5832: sm = NO; 5833: } 5834: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 5835: smooth.plot == SMOOTHED){ 5836: sm = YES; 5837: } 5838: else { 5839: sm = NO; 5840: } 5841: 5842: if(spcomp.numpercore[j] < 2) { 5843: } 5844: else if(sm == YES && data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 5845: } 5846: else { 5847: if(sm == NO) { 5848: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[SPLICE_COLOR]); 5849: } 5850: else if(sm == YES) { 5851: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[SMOOTH_COLOR]); 5852: } 5853: 5854: if(j < 1){ 5855: if(sm == YES && (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK)){ 5856: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 5857: } 5858: else { 5859: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 5860: } 5861: sy = (spcomp.sb_depth[j][0] - top_meter_view)/depperpixsp + top_off_view; 5862: kk = 1; 5863: } 5864: else if(j > 0 && (spcomp.splice_how[j] == REAL || spcomp.splice_how[j] == INTERPOLATED) && 5865: spcomp.map_to_table[j-1] == spcomp.map_to_table[j] - 2){ 5866: if(sm == YES && (data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->smooth_ok >= SMOK)){ 5867: sx = (data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->sm_data - minvar)/varperpix + xoff; 5868: } 5869: else { 5870: sx = (spcomp.var[j-1][spcomp.numpercore[j-1]-1] - minvar)/varperpix + xoff; 5871: } 5872: sy = (spcomp.sb_depth[j-1][spcomp.numpercore[j-1]-1] - top_meter_view)/depperpixsp + top_off_view; 5873: kk = 0; 5874: } 5875: else if(j > 0){ 5876: if(sm == YES && (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK)){ 5877: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 5878: } 5879: else { 5880: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 5881: } 5882: sy = (spcomp.sb_depth[j][0] - top_meter_view)/depperpixsp + top_off_view; 5883: kk = 1; 5884: } 5885: 5886: for(k=kk; k<spcomp.numpercore[j]; ++k) { 5887: if(sm == YES && (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->smooth_ok >= SMOK)){ 5888: sdx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->sm_data - minvar)/varperpix + xoff; 5889: } 5890: else { 5891: sdx = (spcomp.var[j][k] - minvar)/varperpix + xoff; 5892: } 5893: sdy = (spcomp.sb_depth[j][k] - top_meter_view)/depperpixsp + top_off_view; 5894: if(sy > (int)win_height) { 5895: break; 5896: } 5897: else if(sy <= 0 && sdy <= 0) { 5898: } 5899: else { 5900: if(sy < 0 && sdy > 0) { 5901: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 5902: sy = 0; 5903: } 5904: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5905: sx, sy, sdx, sdy); 5906: } 5907: sx = sdx; 5908: sy = sdy; 5909: } 5910: 5911: /* label the core 5912: */ 5913: sx = xoff - 15; 5914: sy = sy - 5; 5915: if(sy > (int)win_height) { 5916: break; 5917: } 5918: else if(sy <= 0) { 5919: } 5920: else { 5921: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[LABEL_COLOR]); 5922: (void)sprintf(s, "%c%d", data[dset]->holes[spcomp.hole[j]]->name, 5923: data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->num); 5924: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5925: sx, sy, s, (int)strlen(s)); 5926: 5927: /* if this is the last core of the splice put an * in margin 5928: to indicate to user that have reached the botton 5929: */ 5930: if(j + 1 == spcomp.numcores) { 5931: sx = 10; 5932: sy = sy + 5; 5933: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[SPLICELOCATION_COLOR]); 5934: (void)sprintf(s, "*"); 5935: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5936: sx, sy, s, (int)strlen(s)); 5937: } 5938: } 5939: } 5940: } 5941: 5942: /* if the cores are tied(not appended) draw a line to indicate 5943: where the splice is 5944: */ 5945: if(spcomp.numcores > 1){ 5946: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[SPLICELOCATION_COLOR]); 5947: for(j=0; j<spcomp.numcores - 1; ++j) { 5948: if(spcomp.map_to_table[j] != spcomp.map_to_table[j+1] - 2){ 5949: } 5950: else { 5951: if(spcomp.splice_how[j+1] == REAL || spcomp.splice_how[j+1] == INTERPOLATED){ 5952: if(sm == NO || (sm == YES && data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK)) { 5953: sx = (spcomp.var[j][spcomp.numpercore[j]-1] - minvar)/varperpix + xoff; 5954: } 5955: else if(sm == YES && data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status == SMOK) { 5956: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][spcomp.numpercore[j]-1]]->sm_data - minvar)/varperpix + xoff; 5957: } 5958: sy = (spcomp.sb_depth[j][spcomp.numpercore[j]-1] - top_meter_view)/depperpixsp + top_off_view; 5959: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5960: sx - 10, sy, sx + 10, sy); 5961: /* 5962: if(sm == NO || (sm == YES && data[dset]->holes[spcomp.hole[j+1]]->core[spcomp.core[j+1]]->smooth_status != SMOK)) { 5963: sx = (spcomp.var[j+1][0] - minvar)/varperpix + xoff; 5964: } 5965: else if(sm == YES && data[dset]->holes[spcomp.hole[j+1]]->core[spcomp.core[j+1]]->smooth_status == SMOK) { 5966: sx = (data[dset]->holes[spcomp.hole[j+1]]->core[spcomp.core[j+1]]->value[spcomp.MapToOrig[j+1][0]]->sm_data - minvar)/varperpix + xoff; 5967: } 5968: sy = (spcomp.sb_depth[j+1][0] - top_meter_view)/depperpixsp + top_off_view; 5969: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5970: sx - 10, sy, sx + 10, sy); 5971: */ 5972: } 5973: else if(spcomp.splice_how[j+1] == INTERPOLATED){ 5974: /* 5975: if(sm == NO || (sm == YES && data[dset]->holes[spcomp.hole[j+1]]->core[spcomp.core[j+1]]->smooth_status != SMOK)) { 5976: sx = (spcomp.interpolated_value[j+1] - minvar)/varperpix + xoff; 5977: } 5978: else if(sm == YES && data[dset]->holes[spcomp.hole[j+1]]->core[spcomp.core[j+1]]->smooth_status == SMOK) { 5979: sx = (spcomp.interpolated_sm_value[j+1] - minvar)/varperpix + xoff; 5980: } 5981: sy = (spcomp.interpolated_spl_depth[j+1] - top_meter_view)/depperpixsp + top_off_view; 5982: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 5983: sx - 10, sy, sx + 10, sy); 5984: */ 5985: } 5986: else if(spcomp.splice_how[j+1] == APPEND) { 5987: } 5988: } 5989: } 5990: } 5991: 5992: /* check to see if there are missing cores and if so mark them 5993: */ 5994: if(spcomp.numcores >= 1){ 5995: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[LABEL_COLOR]); 5996: if(spcomp.map_to_table[0] > 0) { 5997: k = 0; 5998: if(top_off_view == OFF) { 5999: sy = OFF; 6000: } 6001: else { 6002: sy = 20; 6003: } 6004: sdy = (spcomp.sb_depth[0][0] - top_meter_view)/depperpixsp + top_off_view; 6005: if(sy >= sdy -10) { 6006: } 6007: else if(sy < 0 || sy > (int)win_height) { 6008: } 6009: else { 6010: (void)sprintf(s, "missing "); 6011: while(k < spcomp.map_to_table[0]) { 6012: (void)sprintf(string, "%c%d ", splicertable.data[k].hole, 6013: splicertable.data[k].core); 6014: strcat(s, string); 6015: k = k + 2; 6016: } 6017: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6018: OFF * 2, sy, s, (int)strlen(s)); 6019: } 6020: } 6021: for(j=0; j<spcomp.numcores - 1; ++j) { 6022: sy = (spcomp.sb_depth[j][spcomp.numpercore[j]-1] - top_meter_view)/depperpixsp + top_off_view; 6023: k = spcomp.map_to_table[j] + 2; 6024: while(k < spcomp.map_to_table[j+1] && k < splicertable.data_cnt){ 6025: sy = sy + OFF; 6026: if(sy < 0 || sy > (int)win_height) { 6027: } 6028: else { 6029: (void)sprintf(s, "missing %c%d", splicertable.data[k].hole, 6030: splicertable.data[k].core); 6031: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6032: OFF * 2, sy, s, (int)strlen(s)); 6033: } 6034: k = k + 2; 6035: } 6036: } 6037: if(spcomp.map_to_table[spcomp.numcores-1] < splicertable.data_cnt -2) { 6038: k = spcomp.map_to_table[spcomp.numcores-1] + 2; 6039: sy = (spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[j]-1] - top_meter_view)/depperpixsp + top_off_view; 6040: while(k <= splicertable.data_cnt -2) { 6041: sy = sy + OFF; 6042: if(sy < 0 || sy > (int)win_height) { 6043: } 6044: else { 6045: (void)sprintf(s, "missing %c%d", splicertable.data[k].hole, 6046: splicertable.data[k].core); 6047: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6048: OFF * 2, sy, s, (int)strlen(s)); 6049: } 6050: k = k + 2; 6051: } 6052: } 6053: } 6054: 6055: 6056: 6057: if(have_core_to_splice == DO){ 6058: 6059: xoff = OFF + SPACE + varaxislen; 6060: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 6061: smooth.plot == SMOOTHEDBOTH){ 6062: if(data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status == SMOK) { 6063: sm = YES; 6064: dum = -1; 6065: err = CleanUpCore(dset, spliceholenum, splicecorenum, &n, sbd, dat, sm, &dum); 6066: if(n < 2 || err > 0) { 6067: } 6068: else { 6069: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[SMOOTH_COLOR]); 6070: sx = (dat[0] - minvar)/varperpix + xoff; 6071: sy = (sbd[0] - top_meter_view)/depperpixsp + top_off_view; 6072: for(kk=1; kk<n; ++kk) { 6073: sdx = (dat[kk] - minvar)/varperpix+xoff; 6074: sdy = (sbd[kk] - top_meter_view)/depperpixsp + top_off_view; 6075: if(sy > (int)win_height) { 6076: break; 6077: } 6078: if(sy <= 0 && sdy <= 0) { 6079: } 6080: else { 6081: if(sy < 0 && sdy > 0) { 6082: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 6083: sy = 0; 6084: } 6085: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6086: sx, sy, sdx, sdy); 6087: } 6088: sx = sdx; 6089: sy = sdy; 6090: } 6091: } 6092: } 6093: } 6094: 6095: if(smooth.method == NONE || smooth.plot == UNSMOOTHED){ 6096: sm = NO; 6097: } 6098: else if(smooth.plot == SMOOTHEDBOTH){ 6099: sm = NO; 6100: } 6101: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 6102: smooth.plot == SMOOTHED){ 6103: sm = YES; 6104: } 6105: else { 6106: sm = NO; 6107: } 6108: 6109: if(sm == YES && data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status != SMOK) { 6110: } 6111: else if(sm == NO || (sm == YES && data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status == SMOK)) { 6112: dum = -1; 6113: err = CleanUpCore(dset, spliceholenum, splicecorenum, &n, sbd, dat, sm, &dum); 6114: if(n < 2 || err > 0) { 6115: } 6116: else { 6117: 6118: if(data[dset]->holes[spliceholenum]->core[splicecorenum]->did_offset == YES) { 6119: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[MCD_COLOR]); 6120: } 6121: else if(sm == NO) { 6122: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[MBSF_COLOR]); 6123: } 6124: else if(sm == YES) { 6125: XSetForeground(XtDisplay(w), gc_drawingAreaEdit, fgPixel[SMOOTH_COLOR]); 6126: } 6127: 6128: sx = (dat[0] - minvar)/varperpix + xoff; 6129: sy = (sbd[0] - top_meter_view)/depperpixsp + top_off_view; 6130: for(k=1; k<n; ++k) { 6131: sdx = (dat[k] - minvar)/varperpix + xoff; 6132: sdy = (sbd[k] - top_meter_view)/depperpixsp + top_off_view; 6133: if(sy > (int)win_height) { 6134: break; 6135: } 6136: else if(sy <= 0 && sdy <= 0) { 6137: } 6138: else { 6139: if(sy < 0 && sdy > 0) { 6140: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 6141: sy = 0; 6142: } 6143: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6144: sx, sy, sdx, sdy); 6145: } 6146: sx = sdx; 6147: sy = sdy; 6148: } 6149: } 6150: } 6151: 6152: /* label the core to splice 6153: */ 6154: sx = xoff - 15; 6155: sy = sy - 5; 6156: if(sy > (int)win_height) { 6157: } 6158: else if(sy <= 0) { 6159: } 6160: else { 6161: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[LABEL_COLOR]); 6162: (void)sprintf(s, "%c%d", data[dset]->holes[spliceholenum]->name, 6163: data[dset]->holes[spliceholenum]->core[splicecorenum]->num); 6164: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6165: sx, sy, s, (int)strlen(s)); 6166: } 6167: } 6168: 6169: /* tie points 6170: */ 6171: if(have_sp_tie1 == DO){ 6172: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 6173: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 6174: (data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->smooth_status == SMOK) ){ 6175: 6176: if(data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->smooth_ok >= SMOK){ 6177: sx = (data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->sm_data - minvar)/varperpix + OFF + SPACE; 6178: } 6179: else { 6180: sx = (spcomp.var[spcompcorenum][spcomparraynum] - minvar)/varperpix + OFF + SPACE; 6181: } 6182: } 6183: else if(smooth.plot != SMOOTHED) { 6184: sx = (spcomp.var[spcompcorenum][spcomparraynum] - minvar)/varperpix + OFF + SPACE; 6185: } 6186: if((data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->smooth_status != SMOK) && 6187: smooth.plot == SMOOTHED) { 6188: } 6189: else { 6190: dep = spcomp.sb_depth[spcompcorenum][spcomparraynum]; 6191: sy=(dep - top_meter_view)/depperpixsp + top_off_view; 6192: XSetForeground(XtDisplay(drawingAreaView), gc_drawingAreaView, 6193: fgPixel[TIEPTFIXED_COLOR]); 6194: XFillArc(XtDisplay(drawingAreaView), XtWindow(drawingAreaView), 6195: gc_drawingAreaView, 6196: sx-(POINTSIZE/2), sy-(POINTSIZE/2), 6197: POINTSIZE, POINTSIZE, 0, 360*64); 6198: } 6199: } 6200: 6201: if(have_sp_tie2 == DO){ 6202: if(splice_how == REAL) { 6203: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 6204: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 6205: (data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status == SMOK) ){ 6206: sdx=(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sm_data - minvar)/varperpix + 6207: OFF + SPACE + varaxislen; 6208: } 6209: else { 6210: pdat = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->data; 6211: sdx=(*pdat - minvar)/varperpix + OFF + SPACE + varaxislen; 6212: } 6213: dep = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth + 6214: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 6215: } 6216: else if(splice_how == INTERPOLATED) { 6217: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 6218: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 6219: (data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status == SMOK)){ 6220: sdx = (interpsplice_sm_val - minvar)/varperpix + OFF + SPACE + varaxislen; 6221: } 6222: else { 6223: sdx = (interpsplice_val - minvar)/varperpix + OFF + SPACE + varaxislen; 6224: } 6225: dep = interpsplice_spl_depth; 6226: } 6227: if(data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status != SMOK && 6228: smooth.plot == SMOOTHED) { 6229: } 6230: else { 6231: sdy=(dep - top_meter_view)/depperpixsp + top_off_view; 6232: XSetForeground(XtDisplay(drawingAreaView), gc_drawingAreaView, 6233: fgPixel[TIEPTSHIFT_COLOR]); 6234: XFillArc(XtDisplay(drawingAreaView), XtWindow(drawingAreaView), 6235: gc_drawingAreaView, 6236: sdx-(POINTSIZE/2), sdy-(POINTSIZE/2), 6237: POINTSIZE, POINTSIZE, 0, 360*64); 6238: } 6239: } 6240: 6241: if(have_sp_tie1 == DO && have_sp_tie2 == DO){ 6242: 6243: if(smooth.plot == SMOOTHED && 6244: (data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status != SMOK || 6245: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->smooth_status != SMOK) ) { 6246: } 6247: else { 6248: /*set color for tie line and draw it 6249: */ 6250: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[TIELINE_COLOR]); 6251: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, sx, sy, sdx, sdy); 6252: } 6253: } 6254: 6255: if(have_splice_shift == DO){ 6256: 6257: if(smooth.method == NONE){ 6258: sm = NO; 6259: } 6260: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 6261: smooth.plot == UNSMOOTHED){ 6262: sm = NO; 6263: } 6264: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 6265: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 6266: (data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status == SMOK)){ 6267: sm = YES; 6268: } 6269: else { 6270: sm = NO; 6271: } 6272: 6273: dum = -1; 6274: err = CleanUpCore(dset, spliceholenum, splicecorenum, &n, sbd, dat, sm, &dum); 6275: 6276: if(n < 2 || err > 0) { 6277: } 6278: else { 6279: xoff = OFF + SPACE; 6280: sx = (dat[0] - minvar)/varperpix + xoff; 6281: sy = (sbd[0] - top_meter_view + splicedepoffset)/depperpixsp + top_off_view; 6282: for(kk=1; kk<n; ++kk) { 6283: sdx = (dat[kk] - minvar)/varperpix+xoff; 6284: sdy = (sbd[kk] - top_meter_view + splicedepoffset)/depperpixsp + top_off_view; 6285: if(sy > (int)win_height) { 6286: break; 6287: } 6288: if(sy <= 0 && sdy <= 0) { 6289: } 6290: else { 6291: if(sbd[kk] >= sbd[splicearraynum] - winlen && sbd[kk] <= sbd[splicearraynum] + winlen){ 6292: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[OVERLAYINCORR_COLOR]); 6293: } 6294: else { 6295: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[OVERLAYOUTCORR_COLOR]); 6296: } 6297: if(sy < 0 && sdy > 0) { 6298: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 6299: sy = 0; 6300: } 6301: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6302: sx, sy, sdx, sdy); 6303: } 6304: sx = sdx; 6305: sy = sdy; 6306: } 6307: } 6308: } 6309: } 6310: 6311: /* check to see if the splicer table has some values 6312: */ 6313: if(spcomp.numcores == 0) { 6314: if(splicertable.data_cnt > 0) { 6315: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[LABEL_COLOR]); 6316: k = 0; 6317: sy = OFF; 6318: (void)sprintf(s, "missing "); 6319: while(k <= splicertable.data_cnt-2) { 6320: (void)sprintf(string, "%c%d ", splicertable.data[k].hole, 6321: splicertable.data[k].core); 6322: strcat(s, string); 6323: k = k + 2; 6324: } 6325: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6326: OFF * 2, sy, s, (int)strlen(s)); 6327: } 6328: } 6329: 6330: if(have_strat == DO && have_splice == DO){ 6331: 6332: /* for each file(strat type) find out what type it 6333: is and set the color 6334: */ 6335: for(ii=0; ii<strat_file_cnt; ++ii){ 6336: if(strat[ii]->type == PALEOMAG){ 6337: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[PALEOMAG_COLOR]); 6338: } 6339: else if(strat[ii]->type == DIATOMS){ 6340: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[DIATOM_COLOR]); 6341: } 6342: else if(strat[ii]->type == RADIOLARIA){ 6343: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[RAD_COLOR]); 6344: } 6345: else if(strat[ii]->type == FORAMINIFERA){ 6346: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[FORAM_COLOR]); 6347: } 6348: else if(strat[ii]->type == NANNOFOSSILS){ 6349: XSetForeground(XtDisplay(w), gc_drawingAreaView, fgPixel[NANNO_COLOR]); 6350: } 6351: for(jj=0; jj<strat[ii]->data_cnt; ++jj){ 6352: 6353: /* find the hole current datum is in 6354: */ 6355: for(i=0; i<data[dset]->numholes; ++i){ 6356: 6357: foundtop = NO; 6358: foundbot = NO; 6359: depcull = NO; 6360: if(data[dset]->holes[i]->name == strat[ii]->data[jj].top.hole){ 6361: 6362: sx = OFF + SPACE + varaxislen * 2; 6363: 6364: /* find which cores the top and bottom 6365: datums are in and set the depth offset for each 6366: note that datum may not be in a drawn core so 6367: will then need to use the one above 6368: */ 6369: if(strat[ii]->data[jj].top.core == data[dset]->holes[i]->core[0]->num){ 6370: topoffset = data[dset]->holes[i]->core[0]->cum_dep_offset; 6371: foundtop = YES; 6372: } 6373: else if(data[dset]->holes[i]->numcores >= 2){ 6374: for(j=1; j<data[dset]->holes[i]->numcores; ++j){ 6375: if(data[dset]->holes[i]->core[j]->value[0]->quality == BAD_CORE_NUM){ 6376: depcull = YES; 6377: break; 6378: } 6379: else if(strat[ii]->data[jj].top.core == data[dset]->holes[i]->core[j]->num){ 6380: topoffset = data[dset]->holes[i]->core[j]->cum_dep_offset; 6381: foundtop = YES; 6382: break; 6383: } 6384: else if(strat[ii]->data[jj].top.core < data[dset]->holes[i]->core[j]->num && 6385: strat[ii]->data[jj].top.core > data[dset]->holes[i]->core[j-1]->num) { 6386: topoffset = data[dset]->holes[i]->core[j-1]->cum_dep_offset; 6387: foundtop = YES; 6388: break; 6389: } 6390: } 6391: } 6392: 6393: if(strat[ii]->data[jj].bot.core == data[dset]->holes[i]->core[1]->num){ 6394: botoffset = data[dset]->holes[i]->core[1]->cum_dep_offset; 6395: foundbot = YES; 6396: } 6397: else if(data[dset]->holes[i]->numcores >= 2){ 6398: for(j=1; j<data[dset]->holes[i]->numcores; ++j){ 6399: if(data[dset]->holes[i]->core[j]->value[0]->quality == BAD_CORE_NUM){ 6400: depcull = YES; 6401: break; 6402: } 6403: else if(strat[ii]->data[jj].bot.core == data[dset]->holes[i]->core[j]->num){ 6404: botoffset = data[dset]->holes[i]->core[j]->cum_dep_offset; 6405: foundbot = YES; 6406: break; 6407: } 6408: else if(strat[ii]->data[jj].bot.core < data[dset]->holes[i]->core[j]->num && 6409: strat[ii]->data[jj].bot.core > data[dset]->holes[i]->core[j-1]->num) { 6410: botoffset = data[dset]->holes[i]->core[j-1]->cum_dep_offset; 6411: foundbot = YES; 6412: break; 6413: } 6414: } 6415: } 6416: if(foundtop == YES && foundbot == YES) { 6417: goto Jump_view; 6418: } 6419: } 6420: } 6421: 6422: Jump_view: 6423: /* draw and label 6424: */ 6425: if((foundtop == NO && foundbot == NO && depcull == NO) || 6426: (foundtop == NO && depcull == NO) || 6427: (foundbot == NO && depcull == NO)) { 6428: strat[ii]->data[jj].x_pix_loc_view = -1; 6429: strat[ii]->data[jj].y_pix_loc_view = -1; 6430: } 6431: else if(depcull == NO){ 6432: sy = (strat[ii]->data[jj].top.sb_depth - top_meter_view + topoffset)/depperpix + 6433: top_off_view; 6434: sdy = (strat[ii]->data[jj].bot.sb_depth - top_meter_view + botoffset)/depperpix + 6435: top_off_view; 6436: if(sy > (int)win_height || sdy < 0) { 6437: strat[ii]->data[jj].x_pix_loc_view = -1; 6438: strat[ii]->data[jj].y_pix_loc_view = -1; 6439: } 6440: else { 6441: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6442: sx-10-(ii*10)-3, sy, sx-10-(ii*10)+3, sy); 6443: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6444: sx-10-(ii*10)-3, sdy, sx-10-(ii*10)+3, sdy); 6445: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6446: sx-10-(ii*10), sy, sx-10-(ii*10), sdy); 6447: (void)sprintf(s, "%s", strat[ii]->data[jj].code); 6448: strat[ii]->data[jj].x_pix_loc_view = sx+1; 6449: strat[ii]->data[jj].y_pix_loc_view = sy + (sdy-sy)/2; 6450: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaView, 6451: strat[ii]->data[jj].x_pix_loc_view, strat[ii]->data[jj].y_pix_loc_view, s, (int)strlen(s)); 6452: } 6453: } 6454: } 6455: } 6456: } 6457: else { 6458: } 6459: 6460: if(clip == YES) { 6461: /*for window managers sake, set the clip region back to entire window 6462: */ 6463: width = (int)win_width; 6464: height = (int)win_height; 6465: MakeClipMask(XtDisplay(w), gc_drawingAreaEdit, 0, 0, width, height); 6466: } 6467: 6468: (void)sprintf(s, ""); 6469: (void)sprintf(string, ""); 6470: } 6471: 6472: /* ARGSUSED */ 6473: void 6474: DrawingAreaEditScaleDrag(w, client, call) 6475: Widget w; 6476: XtPointer client; 6477: XtPointer call; 6478: { 6479: /*SUPPRESS 594*/ 6480: 6481: void DrawDrawingAreaEdit(), DisplaySliderControl(); 6482: 6483: if(XmToggleButtonGetState(toggleButtonScaleDragYes) == True) { 6484: if(XtIsManaged(XtParent(drawingAreaEdit))) { 6485: XmScaleGetValue(drawingAreaEditScale, &last_scale_val_edit); 6486: reason_for_redraw = DRAW_EVERYTHING; 6487: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 6488: DisplaySliderControl(2); 6489: } 6490: } 6491: } 6492: 6493: /* ARGSUSED */ 6494: void 6495: DrawingAreaEditScaleChange(w, client, call) 6496: Widget w; 6497: XtPointer client; 6498: XtPointer call; 6499: { 6500: /*SUPPRESS 594*/ 6501: 6502: int scale; 6503: void DrawDrawingAreaEdit(), DisplaySliderControl(); 6504: 6505: XmScaleGetValue(drawingAreaEditScale, &scale); 6506: if(XtIsManaged(XtParent(drawingAreaEdit))) { 6507: if(scale != last_scale_val_edit) { 6508: last_scale_val_edit = scale; 6509: reason_for_redraw = DRAW_EVERYTHING; 6510: DrawDrawingAreaEdit(drawingAreaEdit,(XtPointer)NULL, (XtPointer)NULL); 6511: } 6512: DisplaySliderControl(2); 6513: } 6514: } 6515: 6516: /* ARGSUSED */ 6517: void 6518: DrawingAreaViewScaleDrag(w, client, call) 6519: Widget w; 6520: XtPointer client; 6521: XtPointer call; 6522: { 6523: /*SUPPRESS 594*/ 6524: 6525: void DrawDrawingAreaView(), DisplaySliderControl(); 6526: 6527: if(XmToggleButtonGetState(toggleButtonScaleDragYes) == True) { 6528: if(XtIsManaged(XtParent(drawingAreaView))) { 6529: XmScaleGetValue(drawingAreaViewScale, &last_scale_val_view); 6530: reason_for_redraw = DRAW_EVERYTHING; 6531: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 6532: DisplaySliderControl(3); 6533: } 6534: } 6535: } 6536: 6537: /* ARGSUSED */ 6538: void 6539: DrawingAreaViewScaleChange(w, client, call) 6540: Widget w; 6541: XtPointer client; 6542: XtPointer call; 6543: { 6544: /*SUPPRESS 594*/ 6545: 6546: int scale; 6547: void DrawDrawingAreaView(), DisplaySliderControl(); 6548: 6549: XmScaleGetValue(drawingAreaViewScale, &scale); 6550: if(XtIsManaged(XtParent(drawingAreaView))) { 6551: if(scale != last_scale_val_view) { 6552: last_scale_val_view = scale; 6553: reason_for_redraw = DRAW_EVERYTHING; 6554: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 6555: } 6556: DisplaySliderControl(3); 6557: } 6558: } 6559: 6560: /* ARGSUSED */ 6561: void 6562: TieShift(w, client, call) 6563: Widget w; 6564: XtPointer client; 6565: XtPointer call; 6566: { 6567: /*SUPPRESS 594*/ 6568: 6569: int i, j, k, h, c, f, d, found; 6570: char string[200], date[200]; 6571: time_t tp; 6572: String str; 6573: XmString xmstring; 6574: void DrawDrawingAreaDepthOffset(), DrawDrawingAreaEdit(), DrawDrawingAreaAgeDepth(), 6575: FindStratDepthOffset(), MapHoleToAffineTable(), MapCoreToAffineTable(), PlotSpliceVsAge(); 6576: 6577: have_tie = DONT; 6578: have_shift = DONT; 6579: last_tie = NONE; 6580: have_tie1 = DONT; 6581: have_tie2 = DONT; 6582: 6583: /* make the correlate and shift buttons insensitive 6584: and the undo button sensitive 6585: */ 6586: XtSetSensitive(pushButtonTieCorrelation, False); 6587: XtSetSensitive(pushButtonTieShift, False); 6588: XtSetSensitive(pushButtonTieShiftUndo, True); 6589: XtSetSensitive(toggleButtonTieUndoLast, True); 6590: XmToggleButtonSetState(toggleButtonTieUndoLast, True, NULL); 6591: XtSetSensitive(toggleButtonTieUndoAll, True); 6592: XmToggleButtonSetState(toggleButtonTieUndoAll, False, NULL); 6593: XtSetSensitive(pushButtonTieClear, FALSE); 6594: XtSetSensitive(textFieldTieAdjustDepth, False); 6595: XtVaSetValues(textFieldTieAdjustDepth,XmNeditable, False, NULL); 6596: 6597: if(clip == YES) { 6598: if(XtIsManaged(XtParent(drawingAreaEdit))) { 6599: reason_for_redraw = DRAW_CLEARTIE; 6600: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 6601: } 6602: } 6603: 6604: /* check that core being depth adjusted is not a core 6605: allready used in a spliced record 6606: */ 6607: if(have_splice == DO){ 6608: if(data[dset]->holes[tie2holenum]->core[tie2corenum]->value[0]->sb_depth + data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset < 6609: spcomp.sb_depth[spcomp.numcores - 1][spcomp.numpercore[spcomp.numcores - 1] - 1]){ 6610: (void)sprintf(buffer, "hole %c core %d is in the depth range of the splice. you can't depth adjustment it.", 6611: data[dset]->holes[tie2holenum]->name, data[dset]->holes[tie2holenum]->core[tie2corenum]->num); 6612: SpManageWarningBox(buffer); 6613: if(XtIsManaged(XtParent(drawingAreaEdit))) { 6614: reason_for_redraw = DRAW_CLEARTIE; 6615: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 6616: } 6617: return; 6618: } 6619: } 6620: 6621: did_affine = YES; 6622: have_affine = DO; 6623: saved_affine = NO; 6624: XtSetSensitive(pushButtonSaveAffine, True); 6625: 6626: /* write tie to report 6627: */ 6628: if(time(&tp)) { 6629: (void)sprintf(date, "%s", ctime(&tp)); 6630: } 6631: else { 6632: (void)sprintf(date, "no date available\n"); 6633: } 6634: 6635: (void)sprintf(buffer, "\nComposite; hole %c core %d: %s", 6636: data[dset]->holes[tie2holenum]->name, data[dset]->holes[tie2holenum]->core[tie2corenum]->num, date); 6637: SpUpdateReport(buffer); 6638: (void)sprintf(buffer,"%d %d %c %d %c %s %.1f %.1f %.2f tied to %d %d %c %d %c %s %.1f %.1f %.2f\n", 6639: data[dset]->leg, 6640: data[dset]->site, 6641: data[dset]->holes[tie1holenum]->name, 6642: data[dset]->holes[tie1holenum]->core[tie1corenum]->num, 6643: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->type, 6644: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->section, 6645: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->top_int, 6646: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->bot_int, 6647: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth, 6648: data[dset]->leg, 6649: data[dset]->site, 6650: data[dset]->holes[tie2holenum]->name, 6651: data[dset]->holes[tie2holenum]->core[tie2corenum]->num, 6652: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->type, 6653: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->section, 6654: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->top_int, 6655: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->bot_int, 6656: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth); 6657: SpUpdateReport(buffer); 6658: 6659: /* get the relative depth offset 6660: */ 6661: if(XmToggleButtonGetState(toggleButtonTieShiftBestCorr) == True) { 6662: lastdepoffset = corr.depoffset[best_corr_num]; 6663: } 6664: else if(XmToggleButtonGetState(toggleButtonTieShiftTie) == True) { 6665: lastdepoffset = tiedepoffset; 6666: } 6667: else if(XmToggleButtonGetState(toggleButtonTieShiftGiven) == True) { 6668: str = XmTextGetString(textFieldTieAdjustDepth); 6669: lastdepoffset = atof(str); 6670: XtFree(str); 6671: } 6672: 6673: /* if the core has previously been adjust, indicate this 6674: with var lastdidoffsetstate. 6675: */ 6676: if(data[dset]->holes[tie2holenum]->core[tie2corenum]->did_offset == YES) { 6677: lastdidoffsetstate = YES; 6678: } 6679: else if(data[dset]->holes[tie2holenum]->core[tie2corenum]->did_offset == NO) { 6680: lastdidoffsetstate = NO; 6681: data[dset]->holes[tie2holenum]->core[tie2corenum]->did_offset = YES; 6682: } 6683: 6684: /* add the offset to the affine table 6685: */ 6686: lastaffinehole = data[dset]->holes[tie2holenum]->affine_map_to_hole; 6687: lastaffinecore = data[dset]->holes[tie2holenum]->core[tie2corenum]->affine_map_to_core; 6688: affinetable.hole[lastaffinehole].core[lastaffinecore].cum_depth_offset = 6689: data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset + lastdepoffset; 6690: affinetable.hole[lastaffinehole].core[lastaffinecore].did_offset = YES; 6691: 6692: if(XmToggleButtonGetState(toggleButtonTieShiftAll) == True) { 6693: lastshiftwho = ALLCORES; 6694: if(lastaffinecore + 1 < affinetable.hole[lastaffinehole].numcore) { 6695: for(j=lastaffinecore+1; j<affinetable.hole[lastaffinehole].numcore; ++j){ 6696: affinetable.hole[lastaffinehole].core[j].cum_depth_offset = 6697: affinetable.hole[lastaffinehole].core[j].cum_depth_offset + lastdepoffset; 6698: } 6699: } 6700: } 6701: else { 6702: lastshiftwho = ONECORE; 6703: } 6704: 6705: /* remap data to affine table 6706: */ 6707: for(j=0; j<dataset_cnt; ++j) { 6708: MapHoleToAffineTable(&affinetable, j); 6709: MapCoreToAffineTable(&affinetable, j); 6710: } 6711: 6712: /* change the strat data 6713: */ 6714: if(have_strat == DO) { 6715: FindStratDepthOffset(); 6716: } 6717: 6718: /* if have an age model redo age model mcd's and 6719: rewrite the list. 6720: redraw age drawing area's 6721: */ 6722: if(agemodel_cnt > 0) { 6723: XmListDeleteAllItems(listConstructAgeModel); 6724: for(j=0; j<agemodel_cnt; ++j) { 6725: found = -1; 6726: if(agemodel[j].type == HANDPICK || agemodel[j].type == TIME) { 6727: if(have_splice == DONT) { 6728: (void)sprintf(buffer, "Warning: you do not have a splice table.\n"); 6729: (void)strcat(buffer,"Hand picked and tuned age model depths cannot be converted to correct mcd.\n"); 6730: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", agemodel[j].avembsf, agemodel[j].avemcd, 6731: agemodel[j].aveage, agemodel[j].name, agemodel[j].code); 6732: (void)strcat(buffer, string); 6733: found = -2; 6734: SpManageWarningBox(buffer); 6735: } 6736: else { 6737: k=0; 6738: while(k<splicertable.data_cnt-1) { 6739: if(agemodel[j].avembsf >= splicertable.data[k].mbsf && agemodel[j].avembsf <= splicertable.data[k+1].mbsf) { 6740: found = k; 6741: break; 6742: } 6743: k = k+2; 6744: } 6745: } 6746: if(found < 0) { 6747: if(found == -1) { 6748: (void)sprintf(buffer, "Warning: The hand picked or tuned age does not fall within the splice.\n"); 6749: (void)strcat(buffer, "Cannot convert to correct mcd's.\n"); 6750: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", agemodel[j].avembsf, agemodel[j].avemcd, 6751: agemodel[j].aveage, agemodel[j].name, agemodel[j].code); 6752: (void)strcat(buffer, string); 6753: SpManageWarningBox(buffer); 6754: } 6755: } 6756: else { 6757: agemodel[j].avemcd = agemodel[j].avembsf + (splicertable.data[found].mcd - splicertable.data[found].mbsf); 6758: } 6759: } 6760: else { 6761: f = agemodel[j].agemodel_maptostratfile; 6762: d = agemodel[j].agemodel_maptodatum; 6763: if(f >= 0 && d >= 0) { 6764: agemodel[j].avemcd = strat[f]->data[d].avemcd; 6765: } 6766: else { 6767: (void)sprintf(buffer, "Warning: Cannot map age model datum to a strat datum. no way to assign new mcd.\n"); 6768: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", agemodel[j].avembsf, agemodel[j].avemcd, 6769: agemodel[j].aveage, agemodel[j].name, agemodel[j].code); 6770: (void)strcat(buffer, string); 6771: SpManageWarningBox(buffer); 6772: } 6773: } 6774: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", agemodel[j].avembsf, agemodel[j].avemcd, 6775: agemodel[j].aveage, agemodel[j].name, agemodel[j].code); 6776: xmstring = XmStringCreateSimple(string); 6777: XmListAddItemUnselected(listConstructAgeModel, xmstring, 0); 6778: XmStringFree(xmstring); 6779: } 6780: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 6781: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 6782: } 6783: PlotSpliceVsAge(NO); 6784: } 6785: 6786: /* write the mcd for tie 2 6787: */ 6788: (void)sprintf(string, "%.2f", data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth + 6789: data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 6790: xmstring = XmStringCreateSimple(string); 6791: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 6792: XmStringFree(xmstring); 6793: 6794: /* set the toggles back to default settings 6795: */ 6796: XmToggleButtonSetState(toggleButtonTieShiftBestCorr, True, NULL); 6797: XmToggleButtonSetState(toggleButtonTieShiftTie, False, NULL); 6798: XmToggleButtonSetState(toggleButtonTieShiftGiven, False, NULL); 6799: XmToggleButtonSetState(toggleButtonTieShiftAll, True, NULL); 6800: XmToggleButtonSetState(toggleButtonTieShiftCore, False, NULL); 6801: XtSetSensitive(toggleButtonTieShiftBestCorr, False); 6802: XtSetSensitive(toggleButtonTieShiftTie, False); 6803: XtSetSensitive(toggleButtonTieShiftGiven, False); 6804: XtSetSensitive(toggleButtonTieShiftAll, False); 6805: XtSetSensitive(toggleButtonTieShiftCore, False); 6806: 6807: /*write the correlation and depth offset info to the report 6808: */ 6809: if(XmToggleButtonGetState(toggleButtonTieShiftBestCorr) == True) { 6810: if(XmToggleButtonGetState(toggleButtonTieShiftAll) == True) { 6811: (void)sprintf(buffer, "Adjust to best correlation; corr. coef. %.3f, depth offset: relative %.2fm, cumulative %.2fm ALL\n", 6812: corr.coef[dset][best_corr_num], lastdepoffset, data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 6813: } 6814: else { 6815: (void)sprintf(buffer, "Adjust to best correlation; corr. coef. %.3f, depth offset: relative %.2fm, cumulative %.2fm ONLY\n", 6816: corr.coef[dset][best_corr_num], lastdepoffset, data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 6817: } 6818: } 6819: else if(XmToggleButtonGetState(toggleButtonTieShiftTie) == True) { 6820: if(XmToggleButtonGetState(toggleButtonTieShiftAll) == True) { 6821: (void)sprintf(buffer, "Adjust to tie; corr. coef. %.3f, depth offset: relative %.2fm, cumulative %.2fm ALL\n", 6822: corr.coef[dset][corr.num_lead_lag[dset]/2 + 1], lastdepoffset, data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 6823: } 6824: else { 6825: (void)sprintf(buffer, "Adjust to tie; corr. coef. %.3f, depth offset: relative %.2fm, cumulative %.2fm ONLY\n", 6826: corr.coef[dset][corr.num_lead_lag[dset]/2 + 1], lastdepoffset, data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 6827: } 6828: } 6829: else if(XmToggleButtonGetState(toggleButtonTieShiftGiven) == True) { 6830: if(XmToggleButtonGetState(toggleButtonTieShiftAll) == True) { 6831: (void)sprintf(buffer, "Adjust to given; depth offset: relative %.2fm, cumulative %.2fm ALL\n", 6832: lastdepoffset, data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 6833: } 6834: else { 6835: (void)sprintf(buffer, "Adjust to given; depth offset: relative %.2fm, cumulative %.2fm ONLY\n", 6836: lastdepoffset, data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 6837: } 6838: } 6839: SpUpdateReport(buffer); 6840: 6841: /* redraw the composite 6842: */ 6843: if(XtIsManaged(XtParent(drawingAreaEdit))) { 6844: reason_for_redraw = DRAW_DEPTHSHIFT; 6845: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 6846: } 6847: 6848: /* draw the depth offsets 6849: */ 6850: if(draw_offsets == YES){ 6851: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 6852: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 6853: } 6854: } 6855: 6856: (void)sprintf(string, ""); 6857: (void)sprintf(date, ""); 6858: } 6859: 6860: 6861: /* ARGSUSED */ 6862: void 6863: TieHelp(w, client, call) 6864: Widget w; 6865: XtPointer client; 6866: XtPointer call; 6867: { 6868: /*SUPPRESS 594*/ 6869: } 6870: 6871: /* ARGSUSED */ 6872: void 6873: TieShiftUndo(w, client, call) 6874: Widget w; 6875: XtPointer client; 6876: XtPointer call; 6877: { 6878: /*SUPPRESS 594*/ 6879: 6880: int i, j; 6881: char string[50], date[200]; 6882: time_t tp; 6883: XmString xmstring; 6884: void DrawDrawingAreaDepthOffset(), DrawDrawingAreaEdit(), FindStratDepthOffset(), 6885: MapHoleToAffineTable(), MapCoreToAffineTable(); 6886: 6887: have_tie = DONT; 6888: have_shift = DONT; 6889: have_corr = DONT; 6890: 6891: (void)sprintf(string, ""); 6892: xmstring = XmStringCreateSimple(string); 6893: XtVaSetValues(labelTie1ID, XmNlabelString, xmstring, NULL); 6894: XtVaSetValues(labelTie1var, XmNlabelString, xmstring, NULL); 6895: XtVaSetValues(labelTie1sbd, XmNlabelString, xmstring, NULL); 6896: XtVaSetValues(labelTie2ID, XmNlabelString, xmstring, NULL); 6897: XtVaSetValues(labelTie2var, XmNlabelString, xmstring, NULL); 6898: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 6899: XmStringFree(xmstring); 6900: XtVaSetValues(textFieldTieDepthStep, XmNvalue, string, NULL); 6901: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 6902: 6903: /* set all buttons except dismiss and tie insensitive 6904: */ 6905: XtSetSensitive(pushButtonTieClear, FALSE); 6906: XtSetSensitive(pushButtonTieCorrelation, FALSE); 6907: XtSetSensitive(pushButtonTieShift, FALSE); 6908: XtSetSensitive(pushButtonTieShiftUndo, FALSE); 6909: XtSetSensitive(toggleButtonTieUndoLast, False); 6910: XtSetSensitive(toggleButtonTieUndoAll, False); 6911: 6912: /* reset window length and leadlag back to defaults 6913: */ 6914: (void)sprintf(string, "%.2f", WINLEN); 6915: XtVaSetValues(textFieldTieWinLen, XmNvalue, string, NULL); 6916: (void)sprintf(string, "%.2f", LEADLAG); 6917: XtVaSetValues(textFieldTieLeadLag, XmNvalue, string, NULL); 6918: 6919: /* set the toggles back to defaults 6920: */ 6921: XmToggleButtonSetState(toggleButtonTieShiftBestCorr, True, NULL); 6922: XmToggleButtonSetState(toggleButtonTieShiftTie, False, NULL); 6923: XmToggleButtonSetState(toggleButtonTieShiftGiven, False, NULL); 6924: XmToggleButtonSetState(toggleButtonTieShiftAll, True, NULL); 6925: XmToggleButtonSetState(toggleButtonTieShiftCore, False, NULL); 6926: 6927: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 6928: XClearWindow(XtDisplay(drawingAreaTieCorrelation), 6929: XtWindow(drawingAreaTieCorrelation)); 6930: } 6931: 6932: /* make the undo button insensitive 6933: */ 6934: XtSetSensitive(pushButtonTieShiftUndo, False); 6935: XtSetSensitive(toggleButtonTieUndoLast, False); 6936: XtSetSensitive(toggleButtonTieUndoAll, False); 6937: 6938: /* check that the array indicies for affine table are reasonable 6939: */ 6940: if(lastaffinehole < 0 || lastaffinehole >= affinetable.numhole) { 6941: (void)sprintf(buffer, "Warning; could not undo last depth adjust."); 6942: SpManageWarningBox(buffer); 6943: lastdidoffsetstate = NO; 6944: lastshiftwho = NONE; 6945: lastdepoffset = 0.0; 6946: lastaffinehole = -1; 6947: lastaffinecore = -1; 6948: return; 6949: } 6950: if(lastaffinecore < 0 || lastaffinecore >= affinetable.hole[lastaffinehole].numcore) { 6951: (void)sprintf(buffer, "Warning; could not undo last depth adjust."); 6952: SpManageWarningBox(buffer); 6953: lastdidoffsetstate = NO; 6954: lastshiftwho = NONE; 6955: lastdepoffset = 0.0; 6956: lastaffinehole = -1; 6957: lastaffinecore = -1; 6958: return; 6959: } 6960: 6961: /* Undo last Depth Adjust in affine table 6962: */ 6963: if(XmToggleButtonGetState(toggleButtonTieUndoLast) == True) { 6964: affinetable.hole[lastaffinehole].core[lastaffinecore].cum_depth_offset = 6965: affinetable.hole[lastaffinehole].core[lastaffinecore].cum_depth_offset - lastdepoffset; 6966: if(lastdidoffsetstate == NO) { 6967: affinetable.hole[lastaffinehole].core[lastaffinecore].did_offset = NO; 6968: } 6969: } 6970: else if(XmToggleButtonGetState(toggleButtonTieUndoAll) == True) { 6971: if(lastaffinecore == 0) { 6972: affinetable.hole[lastaffinehole].core[lastaffinecore].cum_depth_offset = 0.0; 6973: } 6974: else { 6975: affinetable.hole[lastaffinehole].core[lastaffinecore].cum_depth_offset = 6976: affinetable.hole[lastaffinehole].core[lastaffinecore-1].cum_depth_offset; 6977: } 6978: affinetable.hole[lastaffinehole].core[lastaffinecore].did_offset = NO; 6979: } 6980: 6981: if(lastshiftwho == ALLCORES) { 6982: for(j=lastaffinecore+1; j<affinetable.hole[lastaffinehole].numcore; ++j){ 6983: if(XmToggleButtonGetState(toggleButtonTieUndoLast) == True) { 6984: affinetable.hole[lastaffinehole].core[j].cum_depth_offset = 6985: affinetable.hole[lastaffinehole].core[j].cum_depth_offset - lastdepoffset; 6986: } 6987: else if(XmToggleButtonGetState(toggleButtonTieUndoAll) == True) { 6988: affinetable.hole[lastaffinehole].core[j].cum_depth_offset = 6989: affinetable.hole[lastaffinehole].core[lastaffinecore].cum_depth_offset; 6990: affinetable.hole[lastaffinehole].core[lastaffinecore].did_offset = NO; 6991: } 6992: } 6993: } 6994: 6995: /*remap the data sets to affine table 6996: */ 6997: for(i=0; i<dataset_cnt; ++i) { 6998: MapHoleToAffineTable(&affinetable, i); 6999: MapCoreToAffineTable(&affinetable, i); 7000: } 7001: 7002: if(have_strat == DO) { 7003: FindStratDepthOffset(); 7004: } 7005: 7006: if(XtIsManaged(XtParent(drawingAreaEdit))) { 7007: reason_for_redraw = DRAW_DEPTHSHIFTUNDO; 7008: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 7009: } 7010: 7011: /* report to report 7012: */ 7013: /* write tie to report 7014: */ 7015: if(time(&tp)) { 7016: (void)sprintf(date, "%s", ctime(&tp)); 7017: } 7018: else { 7019: (void)sprintf(date, "no date available\n"); 7020: } 7021: (void)sprintf(buffer, "\nComposite: hole %s core %d; UNDONE %s", 7022: affinetable.hole[lastaffinehole].name, affinetable.hole[lastaffinehole].core[lastaffinecore].name,date); 7023: SpUpdateReport(buffer); 7024: 7025: if(draw_offsets == YES){ 7026: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 7027: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 7028: } 7029: } 7030: 7031: lastdidoffsetstate = NO; 7032: lastshiftwho = NONE; 7033: lastdepoffset = 0.0; 7034: lastaffinehole = -1; 7035: lastaffinecore = -1; 7036: (void)sprintf(string, ""); 7037: (void)sprintf(date, ""); 7038: } 7039: 7040: 7041: /* ARGSUSED */ 7042: void 7043: DrawDrawingAreaCompCorrelation(w, client, call) 7044: Widget w; 7045: XtPointer client; 7046: XtPointer call; 7047: { 7048: /*SUPPRESS 594*/ 7049: 7050: int i, j, d, nlagtic, sx, sy, sdx, sdy, 7051: xaxispixlen, yaxispixlen, err1, err2, tie, coren, coreoffset, nwin; 7052: char s[50]; 7053: String str; 7054: float lagtic, maxlag, coredep[MAXPERCORE], corevar[MAXPERCORE]; 7055: double fract, check, ip, std, std1, std2, dum; 7056: Dimension win_height, win_width; 7057: XGCValues gcValues; 7058: void AxisCorr(); 7059: int XAxisDepthCorrSetup(); 7060: 7061: XClearWindow(XtDisplay(w), XtWindow(w)); 7062: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 7063: 7064: /*calc. the length of the y axis and the half length 7065: of the x axis. adjust the length of x axis if its 7066: total length is not divisable by ten 7067: */ 7068: xaxispixlen = ((int)win_width - (2 * SPACE))/2; 7069: yaxispixlen = ((int)win_height - (2 * SPACE)); 7070: 7071: if(have_spcorr == DO && lead_lag > 0){ 7072: check = yaxispixlen; 7073: fract = modf((check/10.0), &ip); 7074: if(fract == 0.0){ 7075: } 7076: else if(fract < 0.5){ 7077: yaxispixlen = ip * 10.0; 7078: } 7079: else { 7080: yaxispixlen = (ip * 10.0) + 10.0; 7081: } 7082: check = yaxispixlen; 7083: if((corrperpix = 2.0/check) <= 0) { 7084: return; 7085: } 7086: 7087: /* x=lead-lag axis 7088: */ 7089: if((err1 = XAxisDepthCorrSetup(lead_lag, depstep, &xaxispixlen, &lagtic, &nlagtic, &lagperpix, &maxlag)) != 0) { 7090: return; 7091: } 7092: 7093: /* set axis and label color 7094: */ 7095: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceCorrelation, 7096: fgPixel[LABEL_COLOR]); 7097: AxisCorr(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceCorrelation, 7098: lagtic, nlagtic, maxlag, yaxispixlen, xaxispixlen, 1); 7099: 7100: /* set corr. coef. color and draw it 7101: */ 7102: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceCorrelation, 7103: fgPixel[CORRCOEF_COLOR]); 7104: gcValues.line_width = 2; 7105: XChangeGC(XtDisplay(w), gc_drawingAreaSpliceCorrelation, GCLineWidth, &gcValues); 7106: for(i=0; i<corr.num_lead_lag[dset]-1; ++i){ 7107: sx = (corr.depleadlag[dset][i]/lagperpix) + SPACE + xaxispixlen; 7108: sy = -1.0 * (corr.coef[dset][i]/corrperpix) + SPACE + yaxispixlen/2; 7109: sdx = (corr.depleadlag[dset][i+1]/lagperpix) + SPACE + xaxispixlen; 7110: sdy = -1.0 * (corr.coef[dset][i+1]/corrperpix) + SPACE + yaxispixlen/2; 7111: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceCorrelation, 7112: sx, sy, sdx, sdy); 7113: if(i == best_corr_num || i+1 == best_corr_num){ 7114: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceCorrelation, 7115: fgPixel[BESTCORR_COLOR]); 7116: if(i == best_corr_num){ 7117: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceCorrelation, 7118: sx, (SPACE + yaxispixlen/2) - 5, sx, (SPACE + yaxispixlen/2) + 5); 7119: } 7120: else if(i+1 == best_corr_num){ 7121: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceCorrelation, 7122: sdx, (SPACE + yaxispixlen/2) - 5, sdx, (SPACE + yaxispixlen/2) + 5); 7123: } 7124: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceCorrelation, 7125: fgPixel[CORRCOEF_COLOR]); 7126: } 7127: } 7128: gcValues.line_width = 0; 7129: XChangeGC(XtDisplay(w), gc_drawingAreaSpliceCorrelation, GCLineWidth, &gcValues); 7130: if(dataset_cnt > 1) { 7131: XSetForeground(XtDisplay(w), gc_drawingAreaTieCorrelation, 7132: fgPixel[OVERLAYOUTCORR_COLOR]); 7133: for(d=0; d<dataset_cnt; ++d) { 7134: if(d != dset) { 7135: for(i=0; i<corr.num_lead_lag[d]-1; ++i){ 7136: sx=(corr.depleadlag[d][i]/lagperpix) + SPACE + xaxispixlen; 7137: sy= -1.0 * (corr.coef[d][i]/corrperpix) + SPACE + yaxispixlen/2; 7138: sdx=(corr.depleadlag[d][i+1]/lagperpix) + SPACE + xaxispixlen; 7139: sdy= -1.0 * (corr.coef[d][i+1]/corrperpix) + SPACE + yaxispixlen/2; 7140: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieCorrelation, 7141: sx, sy, sdx, sdy); 7142: } 7143: } 7144: } 7145: } 7146: 7147: /* check to see if the tie is the best correlation and if the value difference 7148: at the tie is within CHECKVALUEDIFF fraction of the standard deviation 7149: only do this if are splicing constrained 7150: */ 7151: if(are_splicing == CONSTRAINED) { 7152: tie = splicearraynum; 7153: err1 = CleanUpCore(dset, spliceholenum, splicecorenum, &coren, coredep, corevar, NO, &tie); 7154: if(err1 != 0) { 7155: return; 7156: } 7157: str = XmTextGetString(textCompWindowLen); 7158: winlen = atof(str); 7159: XtFree(str); 7160: if(winlen > 0.0) { 7161: for(i=0; i<coren; ++i){ 7162: if(coredep[i] >= coredep[tie] - winlen){ 7163: coreoffset=i; 7164: break; 7165: } 7166: } 7167: nwin=0; 7168: for(j=i; j<coren; ++j){ 7169: if(coredep[j] > coredep[tie] + winlen){ 7170: break; 7171: } 7172: else { 7173: ++nwin; 7174: } 7175: } 7176: } 7177: else { 7178: coreoffset = 0; 7179: nwin = coren; 7180: } 7181: err1 = StdDev(corevar, coren, coreoffset, nwin, &std1, &dum); 7182: 7183: if(winlen > 0.0) { 7184: for(i=0; i<spcomp.numpercore[spcompcorenum]; ++i){ 7185: if(spcomp.sb_depth[spcompcorenum][i] >= spcomp.sb_depth[spcompcorenum][spcomparraynum] - winlen){ 7186: coreoffset=i; 7187: break; 7188: } 7189: } 7190: nwin=0; 7191: for(j=i; j<spcomp.numpercore[spcompcorenum]; ++j){ 7192: if(spcomp.sb_depth[spcompcorenum][j] > spcomp.sb_depth[spcompcorenum][spcomparraynum] + winlen){ 7193: break; 7194: } 7195: else { 7196: ++nwin; 7197: } 7198: } 7199: } 7200: else { 7201: coreoffset = 0; 7202: nwin = spcomp.numpercore[spcompcorenum]; 7203: } 7204: err2 = StdDev(spcomp.var[spcompcorenum], spcomp.numpercore[spcompcorenum], coreoffset, nwin, &std2, &dum); 7205: 7206: if(err1 == 0 && err2 == 0) { 7207: std = (std1 + std2)/2.0; 7208: if(fabs(interpsplice_val - spcomp.var[spcompcorenum][spcomparraynum]) <= 7209: (std * CHECKVALUEDIFF) && best_corr_num == (corr.num_lead_lag[dset] - 1)/2) { 7210: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceCorrelation, 7211: fgPixel[BESTCORR_COLOR]); 7212: if(splice_how == REAL) { 7213: (void)sprintf(s, "This is a good tie!"); 7214: } 7215: else if(splice_how == INTERPOLATED) { 7216: (void)sprintf(s, "This is a good interpolated tie!"); 7217: } 7218: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceCorrelation, 7219: SPACE, win_height-SPACE + 15, s, (int)strlen(s)); 7220: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceCorrelation, 7221: fgPixel[CORRCOEF_COLOR]); 7222: } 7223: } 7224: } 7225: 7226: } 7227: else { 7228: } 7229: 7230: (void)sprintf(s, ""); 7231: } 7232: 7233: 7234: /* ARGSUSED */ 7235: void 7236: TieDismiss(w, client, call) 7237: Widget w; 7238: XtPointer client; 7239: XtPointer call; 7240: { 7241: /*SUPPRESS 594*/ 7242: 7243: void DrawDrawingAreaEdit(); 7244: 7245: have_corr = DONT; 7246: have_tie = DONT; 7247: have_shift = DONT; 7248: last_tie = NONE; 7249: are_compositing = NO; 7250: 7251: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, " ", NULL); 7252: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 7253: XClearWindow(XtDisplay(drawingAreaTieCorrelation), XtWindow(drawingAreaTieCorrelation)); 7254: } 7255: if(XtIsManaged(XtParent(drawingAreaEdit))) { 7256: if(have_tie1 == DO || have_tie2 == DO) { 7257: have_tie1 = DONT; 7258: have_tie2 = DONT; 7259: reason_for_redraw = DRAW_CLEARTIE; 7260: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 7261: } 7262: } 7263: XtUnmanageChild(formTie); 7264: } 7265: 7266: 7267: /* ARGSUSED */ 7268: void 7269: CustomDisplay(w, client, call) 7270: Widget w; 7271: XtPointer client; 7272: XtPointer call; 7273: { 7274: 7275: if(smooth.method == NONE){ 7276: XmToggleButtonSetState(toggleButtonPlotUnsmooth, True); 7277: XmToggleButtonSetState(toggleButtonPlotSmooth, False); 7278: XmToggleButtonSetState(toggleButtonPlotBoth, False); 7279: } 7280: else { 7281: if(smooth.plot == UNSMOOTHED) { 7282: XmToggleButtonSetState(toggleButtonPlotUnsmooth, True); 7283: XmToggleButtonSetState(toggleButtonPlotSmooth, False); 7284: XmToggleButtonSetState(toggleButtonPlotBoth, False); 7285: } 7286: else if(smooth.plot == SMOOTHED) { 7287: XmToggleButtonSetState(toggleButtonPlotUnsmooth, False); 7288: XmToggleButtonSetState(toggleButtonPlotSmooth, True); 7289: XmToggleButtonSetState(toggleButtonPlotBoth, False); 7290: } 7291: else if(smooth.plot == SMOOTHEDBOTH) { 7292: XmToggleButtonSetState(toggleButtonPlotUnsmooth, False); 7293: XmToggleButtonSetState(toggleButtonPlotSmooth, False); 7294: XmToggleButtonSetState(toggleButtonPlotBoth, True); 7295: } 7296: } 7297: 7298: if(have_data == DONT) { 7299: XtSetSensitive(toggleButtonPlotSmooth, False); 7300: XtSetSensitive(toggleButtonPlotUnsmooth, False); 7301: XtSetSensitive(toggleButtonPlotBoth, False); 7302: XtSetSensitive(labelVarAxisLen, False); 7303: XtSetSensitive(labelVarMin, False); 7304: XtSetSensitive(labelVarMax, False); 7305: XtSetSensitive(textVarAxisLen, False); 7306: XtSetSensitive(textVarMin, False); 7307: XtSetSensitive(textVarMax, False); 7308: } 7309: else if(have_data == DO) { 7310: XtSetSensitive(toggleButtonPlotSmooth, True); 7311: XtSetSensitive(toggleButtonPlotUnsmooth, True); 7312: XtSetSensitive(toggleButtonPlotBoth, True); 7313: XtSetSensitive(labelVarAxisLen, True); 7314: XtSetSensitive(labelVarMin, True); 7315: XtSetSensitive(labelVarMax, True); 7316: XtSetSensitive(textVarAxisLen, True); 7317: XtSetSensitive(textVarMin, True); 7318: XtSetSensitive(textVarMax, True); 7319: } 7320: 7321: XtManageChild(form); 7322: XtPopup(XtParent(form),XtGrabNone); 7323: } 7324: 7325: /* ARGSUSED */ 7326: void 7327: Composite(w, client, call) 7328: Widget w; 7329: XtPointer client; 7330: XtPointer call; 7331: { 7332: /*SUPPRESS 594*/ 7333: 7334: char string[50]; 7335: XmString xmstring; 7336: 7337: have_corr = DONT; 7338: have_shift = DONT; 7339: have_tie = DONT; 7340: last_tie = NONE; 7341: have_tie1 = DONT; 7342: have_tie2 = DONT; 7343: 7344: clip_x = 0; 7345: clip_y = 0; 7346: clip_width = 0; 7347: clip_height = 0; 7348: 7349: if(have_data == DO && data[dset]->numholes >= 2) { 7350: are_compositing = YES; 7351: XtSetSensitive(pushButtonSaveAffine,True); 7352: } 7353: else { 7354: are_compositing = NO; 7355: } 7356: 7357: /* set the window length and lead,lag to the defaults 7358: */ 7359: (void)sprintf(string, "%.2f", WINLEN); 7360: XtVaSetValues(textFieldTieWinLen, XmNvalue, string, NULL); 7361: (void)sprintf(string, "%.2f", LEADLAG); 7362: XtVaSetValues(textFieldTieLeadLag, XmNvalue, string, NULL); 7363: 7364: /* make sure the ties, depth step and adjust depth text 7365: is clear 7366: */ 7367: (void)sprintf(string, ""); 7368: xmstring = XmStringCreateSimple(string); 7369: XtVaSetValues(labelTie1ID, XmNlabelString, xmstring, NULL); 7370: XtVaSetValues(labelTie1var, XmNlabelString, xmstring, NULL); 7371: XtVaSetValues(labelTie1sbd, XmNlabelString, xmstring, NULL); 7372: XtVaSetValues(labelTie2ID, XmNlabelString, xmstring, NULL); 7373: XtVaSetValues(labelTie2var, XmNlabelString, xmstring, NULL); 7374: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 7375: XmStringFree(xmstring); 7376: XtVaSetValues(textFieldTieDepthStep, XmNvalue, string, NULL); 7377: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 7378: 7379: /* set the defaults toggles on 7380: */ 7381: XmToggleButtonSetState(toggleButtonTieShiftBestCorr, True, NULL); 7382: XmToggleButtonSetState(toggleButtonTieShiftTie, False, NULL); 7383: XmToggleButtonSetState(toggleButtonTieShiftGiven, False, NULL); 7384: 7385: XmToggleButtonSetState(toggleButtonTieShiftAll, True, NULL); 7386: XmToggleButtonSetState(toggleButtonTieShiftCore, False, NULL); 7387: 7388: /* set all buttons and adjust depth text insensitive 7389: */ 7390: if(have_data == DO && data[dset]->numholes < 2){ 7391: (void)sprintf(buffer, "can't composite when there is only one hole"); 7392: SpManageWarningBox(buffer); 7393: } 7394: XtSetSensitive(pushButtonTieClear, FALSE); 7395: XtSetSensitive(pushButtonTieCorrelation, FALSE); 7396: XtSetSensitive(pushButtonTieShift, FALSE); 7397: XtVaSetValues(pushButtonTieShift, XmNborderWidth, 1, NULL); 7398: XtSetSensitive(pushButtonTieShiftUndo, FALSE); 7399: XtSetSensitive(toggleButtonTieUndoLast, False); 7400: XmToggleButtonSetState(toggleButtonTieUndoLast, True, NULL); 7401: XtSetSensitive(toggleButtonTieUndoAll, False); 7402: XtSetSensitive(textFieldTieAdjustDepth, False); 7403: XtSetSensitive(toggleButtonTieShiftBestCorr, False); 7404: XtSetSensitive(toggleButtonTieShiftTie, False); 7405: XtSetSensitive(toggleButtonTieShiftGiven, False); 7406: XtSetSensitive(toggleButtonTieShiftAll, False); 7407: XtSetSensitive(toggleButtonTieShiftCore, False); 7408: 7409: XtManageChild(formTie); 7410: 7411: XtPopup(XtParent(formTie),XtGrabNone); 7412: PlaceDialog(formTie, TOPRIGHT); 7413: (void)sprintf(string, ""); 7414: } 7415: 7416: /* ARGSUSED */ 7417: void 7418: TieShiftCore(w, client, call) 7419: Widget w; 7420: XtPointer client; 7421: XtPointer call; 7422: { 7423: /*SUPPRESS 594*/ 7424: } 7425: 7426: /* ARGSUSED */ 7427: void 7428: DrawDrawingAreaTieCorrelation(w, client, call) 7429: Widget w; 7430: XtPointer client; 7431: XtPointer call; 7432: { 7433: /*SUPPRESS 594*/ 7434: 7435: int i, d, nlagtic, sx, sy, sdx, sdy, xaxispixlen, yaxispixlen, err; 7436: float lagtic, maxlag; 7437: double fract, check, ip; 7438: Dimension win_height, win_width; 7439: XGCValues gcValues; 7440: void AxisCorr(); 7441: int XAxisDepthCorrSetup(); 7442: 7443: XClearWindow(XtDisplay(w), XtWindow(w)); 7444: 7445: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 7446: xaxispixlen = ((int)win_width - (2 * SPACE))/2; 7447: yaxispixlen = ((int)win_height - (2 * SPACE)); 7448: 7449: if(have_corr == DO && lead_lag > 0) { 7450: 7451: /*calc. the length of the y axis and the half length 7452: of the x axis. adjust the length of x axis if its 7453: total length is not divisable by ten 7454: */ 7455: /* y=corr.coef. axis 7456: */ 7457: check = yaxispixlen; 7458: fract = modf((check/5.0), &ip); 7459: if(fract == 0.0){ 7460: } 7461: else if(fract < 0.5){ 7462: yaxispixlen = ip * 5.0; 7463: } 7464: else { 7465: yaxispixlen = (ip * 5.0) + 5.0; 7466: } 7467: check = yaxispixlen; 7468: if((corrperpix = 2.0/check) <= 0) { 7469: return; 7470: } 7471: 7472: /* x=lead-lag axis 7473: */ 7474: if((err = XAxisDepthCorrSetup(lead_lag, depstep, &xaxispixlen, &lagtic, &nlagtic, &lagperpix, &maxlag)) != 0) { 7475: return; 7476: } 7477: 7478: /*set the axis and label color 7479: */ 7480: XSetForeground(XtDisplay(w), gc_drawingAreaTieCorrelation, 7481: fgPixel[LABEL_COLOR]); 7482: AxisCorr(XtDisplay(w), XtWindow(w), gc_drawingAreaTieCorrelation, 7483: lagtic, nlagtic, maxlag, yaxispixlen, xaxispixlen, 1); 7484: 7485: /*set the corr. coef. color 7486: */ 7487: XSetForeground(XtDisplay(w), gc_drawingAreaTieCorrelation, 7488: fgPixel[CORRCOEF_COLOR]); 7489: gcValues.line_width = 2; 7490: XChangeGC(XtDisplay(w), gc_drawingAreaTieCorrelation, GCLineWidth, &gcValues); 7491: for(i=0; i<corr.num_lead_lag[dset]-1; ++i){ 7492: sx=(corr.depleadlag[dset][i]/lagperpix) + SPACE + xaxispixlen; 7493: sy= -1.0 * (corr.coef[dset][i]/corrperpix) + SPACE + yaxispixlen/2; 7494: sdx=(corr.depleadlag[dset][i+1]/lagperpix) + SPACE + xaxispixlen; 7495: sdy= -1.0 * (corr.coef[dset][i+1]/corrperpix) + SPACE + yaxispixlen/2; 7496: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieCorrelation, 7497: sx, sy, sdx, sdy); 7498: if(i == best_corr_num || i+1 == best_corr_num){ 7499: XSetForeground(XtDisplay(w), gc_drawingAreaTieCorrelation, 7500: fgPixel[BESTCORR_COLOR]); 7501: if(i == best_corr_num){ 7502: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieCorrelation, 7503: sx, (SPACE + yaxispixlen/2) - 5, sx, (SPACE + yaxispixlen/2) + 5); 7504: } 7505: else if(i+1 == best_corr_num){ 7506: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieCorrelation, 7507: sdx, (SPACE + yaxispixlen/2) - 5, sdx, (SPACE + yaxispixlen/2) + 5); 7508: } 7509: XSetForeground(XtDisplay(w), gc_drawingAreaTieCorrelation, 7510: fgPixel[CORRCOEF_COLOR]); 7511: } 7512: } 7513: gcValues.line_width = 0; 7514: XChangeGC(XtDisplay(w), gc_drawingAreaTieCorrelation, GCLineWidth, &gcValues); 7515: if(dataset_cnt > 1) { 7516: XSetForeground(XtDisplay(w), gc_drawingAreaTieCorrelation, 7517: fgPixel[OVERLAYOUTCORR_COLOR]); 7518: for(d=0; d<dataset_cnt; ++d) { 7519: if(d != dset) { 7520: for(i=0; i<corr.num_lead_lag[d]-1; ++i){ 7521: sx=(corr.depleadlag[d][i]/lagperpix) + SPACE + xaxispixlen; 7522: sy= -1.0 * (corr.coef[d][i]/corrperpix) + SPACE + yaxispixlen/2; 7523: sdx=(corr.depleadlag[d][i+1]/lagperpix) + SPACE + xaxispixlen; 7524: sdy= -1.0 * (corr.coef[d][i+1]/corrperpix) + SPACE + yaxispixlen/2; 7525: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieCorrelation, 7526: sx, sy, sdx, sdy); 7527: } 7528: } 7529: } 7530: } 7531: } 7532: else { 7533: } 7534: } 7535: 7536: /* ARGSUSED */ 7537: void 7538: TieShiftAll(w, client, call) 7539: Widget w; 7540: XtPointer client; 7541: XtPointer call; 7542: { 7543: /*SUPPRESS 594*/ 7544: } 7545: 7546: /* ARGSUSED */ 7547: void 7548: TieShiftToBestCorr(w, client, call) 7549: Widget w; 7550: XtPointer client; 7551: XtPointer call; 7552: { 7553: /*SUPPRESS 594*/ 7554: 7555: char string[50]; 7556: 7557: XtSetSensitive(textFieldTieAdjustDepth, True); 7558: XtVaSetValues(textFieldTieAdjustDepth,XmNeditable, False, NULL); 7559: (void)sprintf(string, "%.2f", corr.depoffset[best_corr_num]); 7560: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 7561: 7562: (void)sprintf(string, ""); 7563: } 7564: 7565: /* ARGSUSED */ 7566: void 7567: TieShiftToTie(w, client, call) 7568: Widget w; 7569: XtPointer client; 7570: XtPointer call; 7571: { 7572: /*SUPPRESS 594*/ 7573: 7574: char string[50]; 7575: 7576: XtSetSensitive(textFieldTieAdjustDepth, True); 7577: XtVaSetValues(textFieldTieAdjustDepth,XmNeditable, False, NULL); 7578: (void)sprintf(string, "%.2f", tiedepoffset); 7579: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 7580: 7581: (void)sprintf(string, ""); 7582: } 7583: 7584: /* ARGSUSED */ 7585: void 7586: TieShiftToGiven(w, client, call) 7587: Widget w; 7588: XtPointer client; 7589: XtPointer call; 7590: { 7591: /*SUPPRESS 594*/ 7592: 7593: char string[50]; 7594: 7595: (void)sprintf(string, ""); 7596: XtSetSensitive(textFieldTieAdjustDepth, True); 7597: XtVaSetValues(textFieldTieAdjustDepth,XmNeditable, True, NULL); 7598: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 7599: 7600: (void)sprintf(string, ""); 7601: } 7602: 7603: /* ARGSUSED */ 7604: void 7605: TieClear(w, client, call) 7606: Widget w; 7607: XtPointer client; 7608: XtPointer call; 7609: { 7610: /*SUPPRESS 594*/ 7611: 7612: char string[50]; 7613: XmString xmstring; 7614: void DrawDrawingAreaEdit(); 7615: 7616: have_tie = DONT; 7617: have_shift = DONT; 7618: have_corr = DONT; 7619: last_tie = NONE; 7620: have_tie1 = DONT; 7621: have_tie2 = DONT; 7622: 7623: (void)sprintf(string, ""); 7624: xmstring = XmStringCreateSimple(string); 7625: XtVaSetValues(labelTie1ID, XmNlabelString, xmstring, NULL); 7626: XtVaSetValues(labelTie1var, XmNlabelString, xmstring, NULL); 7627: XtVaSetValues(labelTie1sbd, XmNlabelString, xmstring, NULL); 7628: XtVaSetValues(labelTie2ID, XmNlabelString, xmstring, NULL); 7629: XtVaSetValues(labelTie2var, XmNlabelString, xmstring, NULL); 7630: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 7631: XmStringFree(xmstring); 7632: XtVaSetValues(textFieldTieDepthStep, XmNvalue, string, NULL); 7633: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 7634: 7635: /* set all buttons except dismiss and tie insensitive 7636: */ 7637: XtSetSensitive(pushButtonTieClear, FALSE); 7638: XtSetSensitive(pushButtonTieCorrelation, FALSE); 7639: XtSetSensitive(pushButtonTieShift, FALSE); 7640: XtSetSensitive(pushButtonTieShiftUndo, False); 7641: XtSetSensitive(toggleButtonTieUndoLast, False); 7642: XtSetSensitive(toggleButtonTieUndoAll, False); 7643: XtSetSensitive(textFieldTieAdjustDepth, False); 7644: XtVaSetValues(textFieldTieAdjustDepth,XmNeditable, False, NULL); 7645: 7646: /* reset window length and leadlag back to defaults 7647: */ 7648: (void)sprintf(string, "%.2f", WINLEN); 7649: XtVaSetValues(textFieldTieWinLen, XmNvalue, string, NULL); 7650: (void)sprintf(string, "%.2f", LEADLAG); 7651: XtVaSetValues(textFieldTieLeadLag, XmNvalue, string, NULL); 7652: 7653: /* set the toggles back to defaults 7654: */ 7655: XmToggleButtonSetState(toggleButtonTieShiftBestCorr, True, NULL); 7656: XmToggleButtonSetState(toggleButtonTieShiftTie, False, NULL); 7657: XmToggleButtonSetState(toggleButtonTieShiftGiven, False, NULL); 7658: 7659: XmToggleButtonSetState(toggleButtonTieShiftAll, True, NULL); 7660: XmToggleButtonSetState(toggleButtonTieShiftCore, False, NULL); 7661: 7662: XtSetSensitive(toggleButtonTieShiftBestCorr, False); 7663: XtSetSensitive(toggleButtonTieShiftTie, False); 7664: XtSetSensitive(toggleButtonTieShiftGiven, False); 7665: XtSetSensitive(toggleButtonTieShiftAll, False); 7666: XtSetSensitive(toggleButtonTieShiftCore, False); 7667: 7668: /* clear the correlation plot and redraw the composite 7669: */ 7670: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 7671: XClearWindow(XtDisplay(drawingAreaTieCorrelation), XtWindow(drawingAreaTieCorrelation)); 7672: } 7673: if(XtIsManaged(XtParent(drawingAreaEdit))) { 7674: reason_for_redraw = DRAW_CLEARTIE; 7675: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 7676: } 7677: 7678: tie1holenum = 0; 7679: tie1corenum = 0; 7680: tie1arraynum = 0; 7681: tie2holenum = 0; 7682: tie2corenum = 0; 7683: tie2arraynum = 0; 7684: 7685: clip_x = 0; 7686: clip_y = 0; 7687: clip_width = 0; 7688: clip_height = 0; 7689: 7690: (void)sprintf(string, ""); 7691: } 7692: 7693: /* ARGSUSED */ 7694: void 7695: ColorHelp(w, client, call) 7696: Widget w; 7697: XtPointer client; 7698: XtPointer call; 7699: { 7700: /*SUPPRESS 594*/ 7701: } 7702: 7703: /* ARGSUSED */ 7704: void 7705: CustomColor(w, client, call) 7706: Widget w; 7707: XtPointer client; 7708: XtPointer call; 7709: { 7710: /*SUPPRESS 594*/ 7711: 7712: int i; 7713: void SetCustomeColorWidgetBGColors(), SetCustomeColorWidgetFGColors(), 7714: SetCustomeColorButtonColors(), SetColorSetBGandFG(); 7715: 7716: XtManageChild(formSetColor); 7717: XtPopup(XtParent(formSetColor), XtGrabNone); 7718: 7719: /* set the temp colors to the current colors using 7720: */ 7721: tempbgPixel = bgPixel; 7722: (void)sprintf(tempcolor[BG_COLOR], "%s", color[BG_COLOR]); 7723: for(i=1; i<NCOLOR; ++i) { 7724: tempfgPixel[i] = fgPixel[i]; 7725: (void)sprintf(tempcolor[i], "%s", color[i]); 7726: } 7727: 7728: (void)SetColorSetBGandFG(); 7729: (void)SetCustomeColorWidgetBGColors(bgPixel); 7730: (void)SetCustomeColorWidgetFGColors(fgPixel[LABEL_COLOR]); 7731: (void)SetCustomeColorButtonColors(bgPixel, fgPixel, color); 7732: } 7733: 7734: /* ARGSUSED */ 7735: void 7736: DisplayOK(w, client, call) 7737: Widget w; 7738: XtPointer client; 7739: XtPointer call; 7740: { 7741: /*SUPPRESS 594*/ 7742: 7743: int err; 7744: void DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 7745: 7746: err = GetDisplayValues(dset); 7747: 7748: if(err == 0){ 7749: XtUnmanageChild(form); 7750: reason_for_redraw = DISPLAY_CHANGE; 7751: if(have_data == DO){ 7752: if(XtIsManaged(XtParent(drawingAreaEdit))) { 7753: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 7754: } 7755: } 7756: if(have_splice == DO){ 7757: if(XtIsManaged(XtParent(drawingAreaView))) { 7758: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 7759: } 7760: } 7761: if(have_splicetoage == DO) { 7762: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 7763: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 7764: } 7765: } 7766: } 7767: } 7768: 7769: /* ARGSUSED */ 7770: void 7771: DisplayHelp(w, client, call) 7772: Widget w; 7773: XtPointer client; 7774: XtPointer call; 7775: { 7776: /*SUPPRESS 594*/ 7777: } 7778: 7779: /* ARGSUSED */ 7780: void 7781: GetSelectCore(w, client, call) 7782: Widget w; 7783: XtPointer client; 7784: XtPointer call; 7785: { 7786: /*SUPPRESS 594*/ 7787: 7788: int i, j, k, l, m, nv, ds, corename, check, sm, start, err, splhole, splcore; 7789: char string[50], date[200]; 7790: float topdep, botdep, depth; 7791: time_t tp; 7792: String str; 7793: XmString xmstring; 7794: int CleanUpSpliceCore(); 7795: void DrawDrawingAreaView(); 7796: 7797: /* make the clear tie, correlate and splice to tie buttons insensitive 7798: */ 7799: XtSetSensitive(pushButtonSpliceClearTie, False); 7800: XtSetSensitive(pushButtonSpliceCorrelate, False); 7801: XtSetSensitive(pushButtonSpliceToTie, False); 7802: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 7803: 7804: /* set the window length and lead,lag to the defaults 7805: */ 7806: (void)sprintf(string, "%.2f", WINLEN); 7807: XtVaSetValues(textCompWindowLen, XmNvalue, string, NULL); 7808: (void)sprintf(string, "%.2f", LEADLAG); 7809: XtVaSetValues(textCompLeadLag, XmNvalue, string, NULL); 7810: 7811: /* make sure the ties and depth step are clear 7812: */ 7813: (void)sprintf(string, ""); 7814: xmstring = XmStringCreateSimple(string); 7815: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 7816: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 7817: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 7818: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 7819: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 7820: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 7821: XtVaSetValues(labelSpliceDifferenceInValue, XmNlabelString, xmstring, NULL); 7822: XmStringFree(xmstring); 7823: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 7824: 7825: /* get the text field for selected hole and find hole array number 7826: check for leading blanks in text field. 7827: */ 7828: str = XmTextGetString(textCompSelectHole); 7829: check = -1; 7830: for(m=0; isspace(str[m]); ++m); 7831: for(i=0; i<data[dset]->numholes; ++i){ 7832: if(str[m] == data[dset]->holes[i]->name){ 7833: spliceholenum = i; 7834: check = 1; 7835: break; 7836: } 7837: } 7838: XtFree(str); 7839: if(check == -1){ 7840: (void)sprintf(buffer, "Could not find a matching hole name."); 7841: SpManageWarningBox(buffer); 7842: return; 7843: } 7844: else { 7845: } 7846: 7847: /* get the text field for selected core and find core array number 7848: */ 7849: str = XmTextGetString(textCompSelectCore); 7850: sscanf(str, "%d", &corename); 7851: XtFree(str); 7852: check = -1; 7853: for(j=0; j<data[dset]->holes[spliceholenum]->numcores; ++j){ 7854: if(corename == data[dset]->holes[spliceholenum]->core[j]->num){ 7855: splicecorenum = j; 7856: check = 1; 7857: break; 7858: } 7859: } 7860: if(check == -1){ 7861: (void)sprintf(buffer, "Could not find a matching core number."); 7862: SpManageWarningBox(buffer); 7863: return; 7864: } 7865: /* is this a culled core? not possible? but check anyway 7866: */ 7867: else if(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->quality == BAD_CORE_NUM){ 7868: (void)sprintf(buffer, "This core has been culled from data set."); 7869: SpManageWarningBox(buffer); 7870: return; 7871: } 7872: /* are there good data pts. in this core? 7873: */ 7874: for(i=0; data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->quality != GOOD; ++i){ 7875: if(i >= data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues){ 7876: (void)sprintf(buffer, "There are no good data points in this core."); 7877: SpManageWarningBox(buffer); 7878: return; 7879: } 7880: } 7881: 7882: /* are starting a splice composite so this 7883: core is the first and automatically becomes the first core 7884: of the splice composite 7885: */ 7886: if(have_splice == DONT){ 7887: 7888: have_splice = DO; 7889: have_core_to_splice = DONT; 7890: have_splice_tie = DONT; 7891: last_sp_tie = NONE; 7892: have_sp_tie1 = DONT; 7893: have_sp_tie2 = DONT; 7894: splice_how = NONE; 7895: 7896: XtSetSensitive(pushButtonSaveSplicerTable,True); 7897: XtSetSensitive(pushButtonSaveSplicerData,True); 7898: XtSetSensitive(pushButtonClearSplice, True); 7899: XtSetSensitive(pushButtonOpenSplicerTable,False); 7900: 7901: /*report to report that have selected the first core of the splice record 7902: */ 7903: /* write tie to report 7904: */ 7905: if(time(&tp)) { 7906: (void)sprintf(date, "%s", ctime(&tp)); 7907: } 7908: else { 7909: (void)sprintf(date, "no date available\n"); 7910: } 7911: if(are_splicing == CONSTRAINED) { 7912: (void)sprintf(buffer,"\nSplice: Constrained; hole %c core %d; FIRST CORE OF SPLICE %s", 7913: data[dset]->holes[spliceholenum]->name, data[dset]->holes[spliceholenum]->core[splicecorenum]->num, date); 7914: } 7915: else if(are_splicing == UNCONSTRAINED) { 7916: (void)sprintf(buffer,"\nSplice: Unconstrained; hole %c core %d; FIRST CORE OF SPLICE %s", date); 7917: } 7918: else { 7919: (void)sprintf(buffer,""); 7920: } 7921: SpUpdateReport(buffer); 7922: 7923: /* make the undo button sensitive. it will stay so until 7924: there are none to undo 7925: */ 7926: XtSetSensitive(pushButtonSpliceUndoLast, True); 7927: 7928: /* and the clear grab 7929: */ 7930: XtSetSensitive(pushButtonClearGrab, False); 7931: XtSetSensitive(pushButtonSpliceUndoLast, True); 7932: 7933: /* spcomp.var is always the raw, good data. so no matter what smooth options 7934: are, send smooth = no to CleanUpSpliceCore() 7935: */ 7936: sm = NO; 7937: for(start=0; data[dset]->holes[spliceholenum]->core[splicecorenum]->value[start]->quality != GOOD; ++start); 7938: 7939: spcomp.Depthoffset[0] = data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 7940: 7941: spcomp.MapToOrig[0][0] = start; 7942: 7943: err = CleanUpSpliceCore(spliceholenum, splicecorenum, &spcomp.numpercore[0], 7944: spcomp.sb_depth[0], spcomp.var[0], sm, 0, start, spcomp.MapToOrig[0]); 7945: 7946: if(err == 0){ 7947: /* set the map values; these are the array members numbers to use 7948: to reference original data. 7949: */ 7950: spcomp.hole[0] = spliceholenum; 7951: spcomp.core[0] = splicecorenum; 7952: spcomp.numcores = 1; 7953: } 7954: else if(err > 0){ 7955: (void)sprintf(buffer, "Error trying to get selected core."); 7956: SpManageWarningBox(buffer); 7957: return; 7958: } 7959: 7960: splicertable.alloc_cnt=ALLOC_INT; 7961: if((splicertable.data=(SplicerTableInfo*)calloc(splicertable.alloc_cnt,sizeof(SplicerTableInfo)))==NULL) 7962: SpBadMemAlloc("BAD MEM"); 7963: 7964: /* put this in the splice table 7965: */ 7966: splicertable.data[0].site = data[dset]->site; 7967: splicertable.data[0].hole = data[dset]->holes[spliceholenum]->name; 7968: splicertable.data[0].core = data[dset]->holes[spliceholenum]->core[splicecorenum]->num; 7969: splicertable.data[0].core_type = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->type; 7970: (void)strcpy(splicertable.data[0].section, data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->section); 7971: splicertable.data[0].top_int = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->top_int; 7972: splicertable.data[0].bot_int = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->bot_int; 7973: splicertable.data[0].mbsf = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->sb_depth; 7974: splicertable.data[0].mcd = splicertable.data[0].mbsf + spcomp.Depthoffset[0]; 7975: (void)strcpy(splicertable.data[0].type_of_splice, "none"); 7976: 7977: nv = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues -1; 7978: splicertable.data[1].site = data[dset]->site; 7979: splicertable.data[1].hole = data[dset]->holes[spliceholenum]->name; 7980: splicertable.data[1].core = data[dset]->holes[spliceholenum]->core[splicecorenum]->num; 7981: splicertable.data[1].core_type = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[nv]->type; 7982: (void)strcpy(splicertable.data[1].type_of_splice, "none"); 7983: 7984: /* if more than one data set find which dataset that has the depthest core 7985: */ 7986: ds = dset; 7987: splhole = spliceholenum; 7988: splcore = splicecorenum; 7989: if(dataset_cnt > 1) { 7990: depth = data[ds]->holes[spliceholenum]->core[splicecorenum]->value[nv]->sb_depth; 7991: for(j=0; j<dataset_cnt; ++j) { 7992: if(j != dset) { 7993: /* is the splice hole,core in this dataset? 7994: */ 7995: for(k=0; k<data[j]->numholes; ++k) { 7996: if(data[j]->holes[k]->name == data[dset]->holes[spliceholenum]->name) { 7997: for(l=0; l<data[j]->holes[k]->numcores; ++l) { 7998: if(data[j]->holes[k]->core[l]->num == data[dset]->holes[spliceholenum]->core[splicecorenum]->num) { 7999: nv = data[j]->holes[k]->core[l]->numvalues - 1; 8000: if(data[j]->holes[k]->core[l]->value[nv]->sb_depth > depth) { 8001: ds = j; 8002: depth = data[j]->holes[k]->core[l]->value[nv]->sb_depth; 8003: splhole = k; 8004: splcore = l; 8005: } 8006: } 8007: } 8008: } 8009: } 8010: } 8011: } 8012: } 8013: else { 8014: } 8015: nv = data[ds]->holes[splhole]->core[splcore]->numvalues - 1; 8016: (void)strcpy(splicertable.data[1].section, data[ds]->holes[splhole]->core[splcore]->value[nv]->section); 8017: splicertable.data[1].top_int = data[ds]->holes[splhole]->core[splcore]->value[nv]->top_int; 8018: splicertable.data[1].bot_int = data[ds]->holes[splhole]->core[splcore]->value[nv]->bot_int; 8019: splicertable.data[1].mbsf = data[ds]->holes[splhole]->core[splcore]->value[nv]->sb_depth; 8020: splicertable.data[1].mcd = splicertable.data[1].mbsf + spcomp.Depthoffset[0]; 8021: 8022: splicertable.data_cnt = 2; 8023: spcomp.map_to_table[0] = 0; 8024: 8025: if(XtIsManaged(XtParent(drawingAreaView))) { 8026: reason_for_redraw = DRAW_EVERYTHING; 8027: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 8028: } 8029: } 8030: else if(have_splice == DO){ 8031: 8032: /* check that this core has not been selected already 8033: */ 8034: for(i=0; i<spcomp.numcores; ++i){ 8035: if(data[dset]->holes[spliceholenum]->name == data[dset]->holes[spcomp.hole[i]]->name && 8036: data[dset]->holes[spliceholenum]->core[splicecorenum]->num == data[dset]->holes[spcomp.hole[i]]->core[spcomp.core[i]]->num){ 8037: (void)sprintf(buffer, "you have selected a core that is already in the splice!"); 8038: SpManageWarningBox(buffer); 8039: return; 8040: } 8041: } 8042: 8043: /* check if there are missing core(s) from splicer table below 8044: last core of spcomp 8045: */ 8046: if(spcomp.map_to_table[spcomp.numcores-1] < splicertable.data_cnt -2) { 8047: (void)sprintf(buffer, "you can not splice when there are missing cores below last core.\n"); 8048: (void)strcat(buffer, "you must first delete these missing cores from the splice table.\n"); 8049: SpManageWarningBox(buffer); 8050: return; 8051: } 8052: 8053: /* find the top and bottom depth of the core to be spliced 8054: */ 8055: i = 0; 8056: while(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->quality != GOOD && 8057: i < data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues-1) { 8058: ++i; 8059: } 8060: topdep = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->sb_depth + 8061: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 8062: i = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues-1; 8063: while(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->quality != GOOD && i > 0) { 8064: --i; 8065: } 8066: botdep = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->sb_depth + 8067: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 8068: 8069: /* check that the selected core falls deeper than 8070: the top of the last core in splice 8071: */ 8072: if(botdep < spcomp.sb_depth[spcomp.numcores-1][0]) { 8073: (void)sprintf(buffer, "you can not splice a core that falls above the last core of the splice.\n"); 8074: SpManageWarningBox(buffer); 8075: return; 8076: } 8077: 8078: have_core_to_splice = DO; 8079: have_spcorr = DONT; 8080: have_splice_tie = DONT; 8081: have_splice_shift = DONT; 8082: last_sp_tie = NONE; 8083: have_sp_tie1 = DONT; 8084: have_sp_tie2 = DONT; 8085: splice_how = NONE; 8086: 8087: /* make the clear grab sensitive. 8088: there is a core to splice that can be cleared or tied 8089: make undo last insenitive until clear core or splice 8090: */ 8091: XtSetSensitive(pushButtonClearGrab, True); 8092: XtSetSensitive(pushButtonSpliceUndoLast, False); 8093: XtSetSensitive(pushButtonSuggestTies, True); 8094: 8095: /* check whether core to splice overlaps splice. if it 8096: does, disable append, otherwise enable it. 8097: if the overlap is slight allow append 8098: */ 8099: 8100: if(topdep <= spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1]) { 8101: if(ALLOWAPPENDOVERLAP + topdep >= spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1]) { 8102: XtSetSensitive(pushButtonAppendSplice, True); 8103: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 1, NULL); 8104: splice_overlap = OVERLAPAPPEND; 8105: } 8106: else { 8107: XtSetSensitive(pushButtonAppendSplice, False); 8108: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 8109: splice_overlap = YES; 8110: } 8111: } 8112: else { 8113: XtSetSensitive(pushButtonAppendSplice, True); 8114: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 1, NULL); 8115: splice_overlap = NO; 8116: } 8117: 8118: /* and clear previous corr plot 8119: */ 8120: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 8121: XClearWindow(XtDisplay(drawingAreaCompCorrelation), XtWindow(drawingAreaCompCorrelation)); 8122: } 8123: if(XtIsManaged(XtParent(drawingAreaView))) { 8124: reason_for_redraw = DRAW_COREGRABBED; 8125: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 8126: } 8127: } 8128: 8129: (void)sprintf(string, ""); 8130: (void)sprintf(date, ""); 8131: } 8132: 8133: 8134: /* ARGSUSED */ 8135: void 8136: TieCorrelate(w, client, call) 8137: Widget w; 8138: XtPointer client; 8139: XtPointer call; 8140: { 8141: /*SUPPRESS 594*/ 8142: 8143: int i, j, n, h, c, d, core1n, core2n, core1offset, core2offset, tie1num, tie2num, 8144: lag, nwin, sm, err, num_lead_lag, save_tie1, save_tie2, 8145: start, newtie1hole, newtie1core, newtie1array, newtie2hole, newtie2core, newtie2array; 8146: char string[50]; 8147: float coef, range1, range2, intpt, depth, 8148: core1dep[MAXPERCORE], core1var[MAXPERCORE], 8149: core2dep[MAXPERCORE], core2var[MAXPERCORE]; 8150: String str; 8151: int CleanUpCore(), RepickDepth(), Correlate(); 8152: void DrawDrawingAreaEdit(), DrawDrawingAreaTieCorrelation(); 8153: 8154: 8155: /* make the shift button sensitive 8156: */ 8157: XtSetSensitive(pushButtonTieShift, True); 8158: 8159: /* calc. the depth offset at tie 8160: */ 8161: tiedepoffset = (data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth + 8162: data[dset]->holes[tie1holenum]->core[tie1corenum]->cum_dep_offset) - 8163: (data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth + 8164: data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset); 8165: 8166: 8167: /* clean up the cores and find the new array ties if 8168: cull or average. return the two cores in temp arrays. 8169: repick the depth in temp arrays at constant depth step. 8170: */ 8171: if(smooth.method == NONE){ 8172: sm = NO; 8173: } 8174: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 8175: (smooth.plot == UNSMOOTHED)){ 8176: sm = NO; 8177: } 8178: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 8179: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 8180: (data[dset]->holes[tie1holenum]->core[tie1corenum]->smooth_status == SMOK && 8181: data[dset]->holes[tie2holenum]->core[tie2corenum]->smooth_status == SMOK)){ 8182: sm = YES; 8183: } 8184: else { 8185: sm = NO; 8186: } 8187: 8188: tie1num = tie1arraynum; 8189: tie2num = tie2arraynum; 8190: 8191: err = CleanUpCore(dset, tie1holenum, tie1corenum, &core1n, core1dep, core1var, sm, &tie1num); 8192: if(err > 0){ 8193: (void)sprintf(buffer, "Error trying to get the first core."); 8194: SpManageWarningBox(buffer); 8195: return; 8196: } 8197: err = CleanUpCore(dset, tie2holenum, tie2corenum, &core2n, core2dep, core2var, sm, &tie2num); 8198: if(err > 0){ 8199: (void)sprintf(buffer, "Error trying to get the second core."); 8200: SpManageWarningBox(buffer); 8201: return; 8202: } 8203: 8204: str = XmTextGetString(textFieldTieDepthStep); 8205: depstep = atof(str); 8206: XtFree(str); 8207: range1 = core1dep[core1n-1] - core1dep[0]; 8208: range2 = core2dep[core2n-1] - core2dep[0]; 8209: if(range1/depstep > MAXPERCORE || range2/depstep > MAXPERCORE){ 8210: (void)sprintf(buffer, "The depth step you have chosen exceeds the limits of samples allowed in cores to correlate."); 8211: SpManageWarningBox(buffer); 8212: XtSetSensitive(pushButtonTieCorrelation, True); 8213: XtSetSensitive(pushButtonTieShift, False); 8214: return; 8215: } 8216: else if(depstep > 0.0){ 8217: RepickDepth(core1dep, core1var, &core1n, &tie1num, depstep); 8218: RepickDepth(core2dep, core2var, &core2n, &tie2num, depstep); 8219: } 8220: else { 8221: (void)sprintf(buffer, "Error: The depth step is less than or equal to 0.0"); 8222: SpManageWarningBox(buffer); 8223: XtSetSensitive(pushButtonTieCorrelation, True); 8224: XtSetSensitive(pushButtonTieShift, False); 8225: return; 8226: } 8227: 8228: /*get the window length and find the first value(array member) of core 2 8229: that is within the window. then count out to the last value that is in the window 8230: */ 8231: str= XmTextGetString(textFieldTieWinLen); 8232: winlen = atof(str); 8233: XtFree(str); 8234: if(winlen > 0.0) { 8235: for(i=0; i<core2n; ++i){ 8236: if(core2dep[i] >= core2dep[tie2num]-winlen){ 8237: core2offset=i; 8238: break; 8239: } 8240: } 8241: nwin=0; 8242: for(j=i; j<core2n; ++j){ 8243: if(core2dep[j] > core2dep[tie2num]+winlen){ 8244: break; 8245: } 8246: else { 8247: ++nwin; 8248: } 8249: } 8250: } 8251: else { 8252: (void)sprintf(buffer, "Error: The window length is less than or equal to 0.0."); 8253: SpManageWarningBox(buffer); 8254: XtSetSensitive(pushButtonTieCorrelation, True); 8255: XtSetSensitive(pushButtonTieShift, False); 8256: return; 8257: } 8258: 8259: 8260: /* the lead,lag(in meters) and find the lead,lag 8261: in data points 8262: */ 8263: str = XmTextGetString(textFieldTieLeadLag); 8264: leadlagmeters = atof(str); 8265: XtFree(str); 8266: if(leadlagmeters > 0.0){ 8267: lead_lag = leadlagmeters/depstep; 8268: num_lead_lag = lead_lag * 2 + 1; 8269: lag = -1.0 * lead_lag; 8270: } 8271: else { 8272: lead_lag=0; 8273: lag=0; 8274: } 8275: if(num_lead_lag > MAXCORR){ 8276: (void)sprintf(buffer, "The lead/lag you have chosen exceeds the limit for number of correlations allowed."); 8277: SpManageWarningBox(buffer); 8278: XtSetSensitive(pushButtonTieCorrelation, True); 8279: XtSetSensitive(pushButtonTieShift, False); 8280: return; 8281: } 8282: 8283: /* calc. corr. coef. for each lead,lag in given window 8284: note that core1offset causes core 1 to lag and then lead 8285: core 2 8286: */ 8287: corr.num_lead_lag[dset] = 0; 8288: tie_corr_num = 0; 8289: for(i=0;i<num_lead_lag; ++i){ 8290: core1offset = tie1num - tie2num - lag; 8291: Correlate(core1n, nwin, core1offset, core2offset, core1var, core2var, 8292: &coef, &n); 8293: 8294: /* cull out any lead/lag that had less than TOOFEWCORRPAIRS 8295: which includes situations where the lead/lag caused core 1 8296: to not overlay core 2; n=0 8297: */ 8298: if(n < TOOFEWCORRPAIRS){ 8299: 8300: } 8301: else { 8302: corr.coef[dset][corr.num_lead_lag[dset]] = coef; 8303: corr.n[corr.num_lead_lag[dset]] = n; 8304: corr.leadlag[dset][corr.num_lead_lag[dset]] = lag; 8305: corr.depoffset[corr.num_lead_lag[dset]] = core1dep[tie1num] - core2dep[tie2num] - lag * depstep; 8306: corr.depleadlag[dset][corr.num_lead_lag[dset]] = lag * depstep; 8307: if(lag == 0){ 8308: tie_corr_num = corr.num_lead_lag[dset]; 8309: } 8310: ++corr.num_lead_lag[dset]; 8311: } 8312: ++lag; 8313: } 8314: 8315: /* find the highest corr. coef. and save its array member number 8316: and draw the correlation 8317: */ 8318: if(lead_lag > 0){ 8319: best_corr = corr.coef[dset][0]; 8320: best_corr_num = 0; 8321: for(i=1; i<corr.num_lead_lag[dset]; ++i){ 8322: if(corr.coef[dset][i] > best_corr){ 8323: best_corr = corr.coef[dset][i]; 8324: best_corr_num = i; 8325: } 8326: } 8327: have_corr = DO; 8328: } 8329: else { 8330: } 8331: 8332: /* correlate any other data sets 8333: */ 8334: if(dataset_cnt > 1) { 8335: for(d=0; d<dataset_cnt; ++d) { 8336: if(d != dset) { 8337: 8338: newtie1hole = -1; 8339: newtie1core = -1; 8340: newtie1array = -1; 8341: newtie2hole = -1; 8342: newtie2core = -1; 8343: newtie2array = -1; 8344: for(i=0; i<data[d]->numholes; ++i) { 8345: if(data[d]->holes[i]->name == data[dset]->holes[tie1holenum]->name) { 8346: newtie1hole = i; 8347: break; 8348: } 8349: } 8350: if(newtie1hole == -1) { 8351: } 8352: else { 8353: for(i=0; i<data[d]->holes[newtie1hole]->numcores; ++i) { 8354: if(data[d]->holes[newtie1hole]->core[i]->num == data[dset]->holes[tie1holenum]->core[tie1corenum]->num) { 8355: newtie1core = i; 8356: break; 8357: } 8358: } 8359: if(newtie1core == -1) { 8360: } 8361: else { 8362: h = newtie1hole; 8363: c = newtie1core; 8364: core1n = 0; 8365: for(i=0; i<data[d]->holes[h]->core[c]->numvalues; ++i) { 8366: if(data[d]->holes[h]->core[c]->value[i]->quality & BAD_SB_DEPTH) { 8367: } 8368: else if(data[d]->holes[h]->core[c]->value[i]->quality == GOOD) { 8369: core1dep[core1n] = data[d]->holes[h]->core[c]->value[i]->sb_depth; 8370: if(sm == YES) { 8371: core1var[core1n] = data[d]->holes[h]->core[c]->value[i]->sm_data; 8372: } 8373: else { 8374: core1var[core1n] = *data[d]->holes[h]->core[c]->value[i]->data; 8375: } 8376: ++core1n; 8377: } 8378: } 8379: if(core1n > 5) { 8380: 8381: depth = data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth; 8382: if(depth < core1dep[0] || depth > core1dep[core1n-1]) { 8383: } 8384: else { 8385: err = InterpolateTiePtValue(core1n, core1dep, core1var, depth, &intpt, &start); 8386: if(err > 0) { 8387: } 8388: else if(start < 0 || start >= core1n) { 8389: } 8390: else { 8391: for(i=core1n; i>start+1; --i) { 8392: core1dep[i] = core1dep[i-1]; 8393: core1var[i] = core1var[i-1]; 8394: } 8395: ++core1n; 8396: core1dep[start + 1] = depth; 8397: core1var[start + 1] = intpt; 8398: newtie1array = start + 1; 8399: } 8400: } 8401: } 8402: } 8403: } 8404: for(i=0; i<data[d]->numholes; ++i) { 8405: if(data[d]->holes[i]->name == data[dset]->holes[tie2holenum]->name) { 8406: newtie2hole = i; 8407: break; 8408: } 8409: } 8410: if(newtie2hole == -1) { 8411: } 8412: else { 8413: for(i=0; i<data[d]->holes[newtie2hole]->numcores; ++i) { 8414: if(data[d]->holes[newtie2hole]->core[i]->num == data[dset]->holes[tie2holenum]->core[tie2corenum]->num) { 8415: newtie2core = i; 8416: break; 8417: } 8418: } 8419: if(newtie2core == -1) { 8420: } 8421: else { 8422: h = newtie2hole; 8423: c = newtie2core; 8424: core2n = 0; 8425: for(i=0; i<data[d]->holes[h]->core[c]->numvalues; ++i) { 8426: if(data[d]->holes[h]->core[c]->value[i]->quality & BAD_SB_DEPTH) { 8427: } 8428: else if(data[d]->holes[h]->core[c]->value[i]->quality == GOOD) { 8429: core2dep[core2n] = data[d]->holes[h]->core[c]->value[i]->sb_depth; 8430: if(sm == YES) { 8431: core2var[core2n] = data[d]->holes[h]->core[c]->value[i]->sm_data; 8432: } 8433: else { 8434: core2var[core2n] = *data[d]->holes[h]->core[c]->value[i]->data; 8435: } 8436: ++core2n; 8437: } 8438: } 8439: if(core2n > 5) { 8440: 8441: depth = data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth; 8442: if(depth < core2dep[0] || depth > core2dep[core2n-1]) { 8443: } 8444: else { 8445: err = InterpolateTiePtValue(core2n, core2dep, core2var, depth, &intpt, &start); 8446: if(err > 0) { 8447: } 8448: else if(start < 0 || start >= core2n) { 8449: } 8450: else { 8451: for(i=core2n; i>start+1; --i) { 8452: core2dep[i] = core2dep[i-1]; 8453: core2var[i] = core2var[i-1]; 8454: } 8455: ++core2n; 8456: core2dep[start + 1] = depth; 8457: core2var[start + 1] = intpt; 8458: newtie2array = start + 1; 8459: } 8460: } 8461: } 8462: } 8463: } 8464: if(newtie1array != -1 && newtie2array != -1) { 8465: if(err == 0){ 8466: range1 = core1dep[core1n-1] - core1dep[0]; 8467: range2 = core2dep[core2n-1] - core2dep[0]; 8468: if(range1/depstep < MAXPERCORE || range2/depstep < MAXPERCORE){ 8469: tie1num = newtie1array; 8470: tie2num = newtie2array; 8471: RepickDepth(core1dep, core1var, &core1n, &tie1num, depstep); 8472: RepickDepth(core2dep, core2var, &core2n, &tie2num, depstep); 8473: } 8474: else { 8475: err = 1; 8476: } 8477: } 8478: } 8479: if(newtie1array != -1 && newtie2array != -1 && err == 0) { 8480: 8481: for(i=0; i<core2n; ++i){ 8482: if(core2dep[i] >= core2dep[tie2num]-winlen){ 8483: core2offset=i; 8484: break; 8485: } 8486: } 8487: nwin=0; 8488: for(j=i; j<core2n; ++j){ 8489: if(core2dep[j] > core2dep[tie2num]+winlen){ 8490: break; 8491: } 8492: else { 8493: ++nwin; 8494: } 8495: } 8496: if(leadlagmeters > 0.0){ 8497: lead_lag = leadlagmeters/depstep; 8498: num_lead_lag = lead_lag * 2 + 1; 8499: lag = -1.0 * lead_lag; 8500: } 8501: else { 8502: lead_lag=0; 8503: lag=0; 8504: } 8505: 8506: corr.num_lead_lag[d] = 0; 8507: for(i=0;i<num_lead_lag; ++i){ 8508: core1offset = tie1num - tie2num - lag; 8509: Correlate(core1n, nwin, core1offset, core2offset, core1var, core2var, 8510: &coef, &n); 8511: 8512: if(n < TOOFEWCORRPAIRS){ 8513: } 8514: else { 8515: corr.coef[d][corr.num_lead_lag[d]] = coef; 8516: corr.leadlag[d][corr.num_lead_lag[d]] = lag; 8517: corr.depleadlag[d][corr.num_lead_lag[d]] = lag * depstep; 8518: if(lag == 0){ 8519: tie_corr_num = corr.num_lead_lag[d]; 8520: } 8521: ++corr.num_lead_lag[d]; 8522: } 8523: ++lag; 8524: } 8525: } 8526: } 8527: } 8528: } 8529: 8530: /* set the adjust depth text to equal best correlation 8531: */ 8532: XtSetSensitive(textFieldTieAdjustDepth, True); 8533: XtVaSetValues(textFieldTieAdjustDepth,XmNeditable, False, NULL); 8534: (void)sprintf(string, "%.2f", corr.depoffset[best_corr_num]); 8535: XtVaSetValues(textFieldTieAdjustDepth, XmNvalue, string, NULL); 8536: 8537: /* set the defaults toggles on 8538: */ 8539: XtSetSensitive(toggleButtonTieShiftBestCorr, True); 8540: XtSetSensitive(toggleButtonTieShiftTie, True); 8541: XtSetSensitive(toggleButtonTieShiftGiven, True); 8542: XtSetSensitive(toggleButtonTieShiftAll, True); 8543: XtSetSensitive(toggleButtonTieShiftCore, True); 8544: XmToggleButtonSetState(toggleButtonTieShiftBestCorr, True, NULL); 8545: XmToggleButtonSetState(toggleButtonTieShiftTie, False, NULL); 8546: XmToggleButtonSetState(toggleButtonTieShiftGiven, False, NULL); 8547: XmToggleButtonSetState(toggleButtonTieShiftAll, True, NULL); 8548: XmToggleButtonSetState(toggleButtonTieShiftCore, False, NULL); 8549: 8550: /* draw the core 2 overlay of core 1 8551: */ 8552: have_tie = DONT; 8553: have_shift = DO; 8554: if(XtIsManaged(XtParent(drawingAreaEdit))) { 8555: reason_for_redraw = DRAW_TIES; 8556: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 8557: } 8558: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 8559: DrawDrawingAreaTieCorrelation(drawingAreaTieCorrelation, (XtPointer)NULL, (XtPointer)NULL); 8560: } 8561: 8562: (void)sprintf(string, ""); 8563: } 8564: 8565: 8566: /* ARGSUSED */ 8567: void 8568: SpliceClearTie(w, client, call) 8569: Widget w; 8570: XtPointer client; 8571: XtPointer call; 8572: { 8573: /*SUPPRESS 594*/ 8574: 8575: char string[50]; 8576: XmString xmstring; 8577: void DrawDrawingAreaView(); 8578: 8579: have_splice_tie = DONT; 8580: have_splice_shift = DONT; 8581: have_spcorr = DONT; 8582: last_sp_tie = NONE; 8583: have_sp_tie1 = DONT; 8584: have_sp_tie2 = DONT; 8585: splice_how = NONE; 8586: 8587: /* reset buttons and text 8588: */ 8589: /* set the window length and lead,lag to the defaults 8590: */ 8591: (void)sprintf(string, "%.2f", WINLEN); 8592: XtVaSetValues(textCompWindowLen, XmNvalue, string, NULL); 8593: (void)sprintf(string, "%.2f", LEADLAG); 8594: XtVaSetValues(textCompLeadLag, XmNvalue, string, NULL); 8595: 8596: /* make sure the ties, depth step and selected core text 8597: are clear 8598: */ 8599: (void)sprintf(string, ""); 8600: XtVaSetValues(textCompSelectHole, XmNvalue, string, NULL); 8601: XtVaSetValues(textCompSelectCore, XmNvalue, string, NULL); 8602: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 8603: xmstring = XmStringCreateSimple(string); 8604: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 8605: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 8606: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 8607: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 8608: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 8609: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 8610: XtVaSetValues(labelSpliceDifferenceInValue, XmNlabelString, xmstring, NULL); 8611: XmStringFree(xmstring); 8612: 8613: /* set all buttons except dismiss, grab, clear grab, and 8614: undo last insensitive 8615: */ 8616: XtSetSensitive(pushButtonGetSelectCore, True); 8617: XtSetSensitive(pushButtonClearGrab, True); 8618: XtSetSensitive(pushButtonSpliceClearTie, FALSE); 8619: XtSetSensitive(pushButtonSpliceCorrelate, FALSE); 8620: XtSetSensitive(pushButtonSpliceToTie, False); 8621: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 8622: XtSetSensitive(pushButtonSuggestTies, True); 8623: 8624: if(splice_overlap == YES) { 8625: XtSetSensitive(pushButtonAppendSplice, False); 8626: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 8627: } 8628: else if(splice_overlap == NO || splice_overlap == OVERLAPAPPEND) { 8629: XtSetSensitive(pushButtonAppendSplice, True); 8630: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 1, NULL); 8631: } 8632: 8633: /* and clear the correlation window 8634: */ 8635: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 8636: XClearWindow(XtDisplay(drawingAreaCompCorrelation), 8637: XtWindow(drawingAreaCompCorrelation)); 8638: } 8639: 8640: if(XtIsManaged(XtParent(drawingAreaView))) { 8641: reason_for_redraw = DRAW_EVERYTHING; 8642: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 8643: } 8644: 8645: (void)sprintf(string, ""); 8646: } 8647: 8648: /* ARGSUSED */ 8649: void 8650: SpliceCorrelate(w, client, call) 8651: Widget w; 8652: XtPointer client; 8653: XtPointer call; 8654: { 8655: /*SUPPRESS 594*/ 8656: 8657: int i, j, n, d, h, c, core1n, core2n, core1arraynum, core2arraynum, core1offset, core2offset, 8658: lag, nwin, sm, err, num_lead_lag, tie1num, tie2num, 8659: start, newtie1hole, newtie1core, newtie1array, newtie2hole, newtie2core, newtie2array; 8660: float coef, range1, range2, intpt, depth, 8661: core1dep[MAXPERCORE], core1var[MAXPERCORE], 8662: core2dep[MAXPERCORE], core2var[MAXPERCORE]; 8663: String str; 8664: int CleanUpCore(), RepickDepth(), Correlate(); 8665: void DrawDrawingAreaView(), DrawDrawingAreaCompCorrelation(); 8666: 8667: XtSetSensitive(pushButtonSpliceToTie, True); 8668: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 1, NULL); 8669: XtSetSensitive(pushButtonSpliceClearTie, True); 8670: XtSetSensitive(pushButtonClearGrab, True); 8671: XtSetSensitive(pushButtonGetSelectCore, False); 8672: XtSetSensitive(pushButtonAppendSplice, FALSE); 8673: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 8674: XtSetSensitive(pushButtonSpliceUndoLast, FALSE); 8675: 8676: /* calc. the depth offset at tie 8677: */ 8678: if(are_splicing == CONSTRAINED) { 8679: splicedepoffset = 0.0; 8680: } 8681: else if(are_splicing == UNCONSTRAINED) { 8682: splicedepoffset = (spcomp.sb_depth[spcompcorenum][spcomparraynum]) - 8683: (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth + 8684: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset); 8685: } 8686: 8687: /* clean up the core to splice(spliced comp allready clean) 8688: and find the new array tie if cull or average. 8689: put it and the spliced comp in temp arrays. 8690: repick the depth in temp arrays at constant depth step. 8691: */ 8692: if(smooth.method == NONE){ 8693: sm = NO; 8694: } 8695: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 8696: (smooth.plot == UNSMOOTHED)){ 8697: sm = NO; 8698: } 8699: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 8700: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 8701: (data[dset]->holes[spliceholenum]->core[splicecorenum]->smooth_status == SMOK && 8702: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->smooth_status == SMOK)){ 8703: sm = YES; 8704: } 8705: else { 8706: sm = NO; 8707: } 8708: 8709: /* get the core to be spliced 8710: */ 8711: core2arraynum = splicearraynum; 8712: err = CleanUpCore(dset, spliceholenum, splicecorenum, &core2n, core2dep, core2var, sm, &core2arraynum); 8713: if(err > 0){ 8714: (void)sprintf(buffer, "Error trying to get the core to splice."); 8715: SpManageWarningBox(buffer); 8716: return; 8717: } 8718: 8719: /* if are splicing constrained and the tie is at an interpolated value; 8720: need to put the interpolated point in core... array. 8721: note that splicearraynum would then be the indicy of next real point 8722: */ 8723: if(are_splicing == CONSTRAINED && splice_how == INTERPOLATED) { 8724: for(i=core2n; i>core2arraynum; --i){ 8725: core2dep[i] = core2dep[i-1]; 8726: core2var[i] = core2var[i-1]; 8727: } 8728: core2dep[core2arraynum] = interpsplice_spl_depth; 8729: core2var[core2arraynum] = interpsplice_val; 8730: ++core2n; 8731: } 8732: 8733: /* put the spliced composite in a temp array 8734: */ 8735: for(i=0; i<spcomp.numpercore[spcompcorenum]; ++i){ 8736: if(sm == YES && data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][i]]->smooth_ok >= SMOK){ 8737: core1var[i] = data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][i]]->sm_data; 8738: } 8739: else { 8740: core1var[i] = spcomp.var[spcompcorenum][i]; 8741: } 8742: core1dep[i] = spcomp.sb_depth[spcompcorenum][i]; 8743: } 8744: core1n = spcomp.numpercore[spcompcorenum]; 8745: core1arraynum = spcomparraynum; 8746: 8747: str = XmTextGetString(textCompDepthStep); 8748: depstep = atof(str); 8749: XtFree(str); 8750: range1 = core1dep[core1n-1] - core1dep[0]; 8751: range2 = core2dep[core2n-1] - core2dep[0]; 8752: if(range1/depstep > MAXPERCORE || range2/depstep > MAXPERCORE){ 8753: (void)sprintf(buffer, "The depth step you have chosen exceeds the limits of samples allowed in cores to correlate."); 8754: SpManageWarningBox(buffer); 8755: XtSetSensitive(pushButtonSpliceCorrelate, True); 8756: return; 8757: } 8758: else if(depstep > 0.0){ 8759: RepickDepth(core1dep, core1var, &core1n, &core1arraynum, depstep); 8760: RepickDepth(core2dep, core2var, &core2n, &core2arraynum, depstep); 8761: } 8762: else { 8763: (void)sprintf(buffer, "Error: The depth step is less than or equal to 0.0."); 8764: SpManageWarningBox(buffer); 8765: XtSetSensitive(pushButtonSpliceCorrelate, True); 8766: return; 8767: } 8768: 8769: /*get the window length and find the first value(array member) of core 2 8770: that is within the window. then count out to the last value that is in the window 8771: */ 8772: str = XmTextGetString(textCompWindowLen); 8773: winlen = atof(str); 8774: XtFree(str); 8775: if(winlen > 0.0) { 8776: for(i=0; i<core2n; ++i){ 8777: if(core2dep[i] >= core2dep[core2arraynum] - winlen){ 8778: core2offset=i; 8779: break; 8780: } 8781: } 8782: nwin=0; 8783: for(j=i; j<core2n; ++j){ 8784: if(core2dep[j] > core2dep[core2arraynum] + winlen){ 8785: break; 8786: } 8787: else { 8788: ++nwin; 8789: } 8790: } 8791: } 8792: else { 8793: (void)sprintf(buffer, "Error: The window length is less than or equal to 0.0."); 8794: SpManageWarningBox(buffer); 8795: XtSetSensitive(pushButtonSpliceCorrelate, True); 8796: return; 8797: } 8798: 8799: 8800: /*get the lead,lag(in meters) and find the lead,lag 8801: in data points 8802: */ 8803: str= XmTextGetString(textCompLeadLag); 8804: leadlagmeters = atof(str); 8805: XtFree(str); 8806: if(leadlagmeters > 0.0){ 8807: lead_lag = leadlagmeters/depstep; 8808: num_lead_lag = lead_lag * 2 + 1; 8809: lag = -1.0 * lead_lag; 8810: } 8811: else { 8812: lead_lag=0; 8813: lag=0; 8814: } 8815: if(num_lead_lag > MAXCORR){ 8816: (void)sprintf(buffer, "The lead/lag you have chosen exceeds the limit for number of correlations allowed."); 8817: XtSetSensitive(pushButtonSpliceCorrelate, True); 8818: SpManageWarningBox(buffer); 8819: return; 8820: } 8821: 8822: /* calc. corr. coef. for each lead,lag in given window 8823: note that core1offset causes core 1 to lag and then lead 8824: core 2 8825: */ 8826: corr.num_lead_lag[dset] = 0; 8827: tie_corr_num = 0; 8828: for(i=0;i<num_lead_lag; ++i){ 8829: core1offset = core1arraynum - core2arraynum - lag; 8830: Correlate(core1n, nwin, core1offset, core2offset, core1var, core2var, 8831: &coef, &n); 8832: 8833: /* cull out any lead/lag that had less than TOOFEWCORRPAIRS 8834: which includes situations where the lead/lag caused core 1 8835: to not overlay core 2; n=0 8836: */ 8837: if(n < TOOFEWCORRPAIRS){ 8838: 8839: } 8840: else { 8841: corr.coef[dset][corr.num_lead_lag[dset]] = coef; 8842: corr.n[corr.num_lead_lag[dset]] = n; 8843: corr.leadlag[dset][corr.num_lead_lag[dset]] = lag; 8844: corr.depoffset[corr.num_lead_lag[dset]] = core1dep[core1arraynum] - core2dep[core2arraynum] - lag * depstep; 8845: corr.depleadlag[dset][corr.num_lead_lag[dset]] = lag * depstep; 8846: if(lag == 0){ 8847: tie_corr_num = corr.num_lead_lag[dset]; 8848: } 8849: ++corr.num_lead_lag[dset]; 8850: } 8851: ++lag; 8852: } 8853: 8854: /* find the highest corr. coef. and remember its array member 8855: number 8856: and draw the correlation 8857: */ 8858: if(lead_lag > 0){ 8859: best_corr = corr.coef[dset][0]; 8860: best_corr_num = 0; 8861: for(i=1; i<corr.num_lead_lag[dset]; ++i){ 8862: if(corr.coef[dset][i] > best_corr){ 8863: best_corr = corr.coef[dset][i]; 8864: best_corr_num = i; 8865: } 8866: } 8867: have_spcorr = DO; 8868: } 8869: else { 8870: } 8871: 8872: /* correlate any other data sets 8873: */ 8874: if(dataset_cnt > 1) { 8875: for(d=0; d<dataset_cnt; ++d) { 8876: if(d != dset) { 8877: 8878: newtie1hole = -1; 8879: newtie1core = -1; 8880: newtie1array = -1; 8881: newtie2hole = -1; 8882: newtie2core = -1; 8883: newtie2array = -1; 8884: 8885: /* get the splice 8886: */ 8887: for(i=0; i<data[d]->numholes; ++i) { 8888: if(data[d]->holes[i]->name == data[dset]->holes[spcomp.hole[spcompcorenum]]->name) { 8889: newtie1hole = i; 8890: break; 8891: } 8892: } 8893: if(newtie1hole == -1) { 8894: } 8895: else { 8896: for(i=0; i<data[d]->holes[newtie1hole]->numcores; ++i) { 8897: if(data[d]->holes[newtie1hole]->core[i]->num == 8898: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->num) { 8899: newtie1core = i; 8900: break; 8901: } 8902: } 8903: if(newtie1core == -1) { 8904: } 8905: else { 8906: h = newtie1hole; 8907: c = newtie1core; 8908: core1n = 0; 8909: for(i=0; i<data[d]->holes[h]->core[c]->numvalues; ++i) { 8910: if(data[d]->holes[h]->core[c]->value[i]->quality & BAD_SB_DEPTH) { 8911: } 8912: else if(data[d]->holes[h]->core[c]->value[i]->quality == GOOD) { 8913: core1dep[core1n] = data[d]->holes[h]->core[c]->value[i]->sb_depth + 8914: data[d]->holes[h]->core[c]->cum_dep_offset; 8915: if(sm == YES) { 8916: core1var[core1n] = data[d]->holes[h]->core[c]->value[i]->sm_data; 8917: } 8918: else { 8919: core1var[core1n] = *data[d]->holes[h]->core[c]->value[i]->data; 8920: } 8921: ++core1n; 8922: } 8923: } 8924: if(core1n > 5) { 8925: depth = spcomp.sb_depth[spcompcorenum][spcomparraynum]; 8926: if(depth < core1dep[0] || depth > core1dep[core1n-1]) { 8927: } 8928: else { 8929: err = InterpolateTiePtValue(core1n, core1dep, core1var, depth, &intpt, &start); 8930: if(err > 0) { 8931: } 8932: else if(start < 0 || start >= core1n) { 8933: } 8934: else { 8935: for(i=core1n; i>start+1; --i) { 8936: core1dep[i] = core1dep[i-1]; 8937: core1var[i] = core1var[i-1]; 8938: } 8939: ++core1n; 8940: core1dep[start + 1] = depth; 8941: core1var[start + 1] = intpt; 8942: newtie1array = start + 1; 8943: } 8944: } 8945: } 8946: } 8947: } 8948: 8949: /* get the core to be spliced 8950: */ 8951: for(i=0; i<data[d]->numholes; ++i) { 8952: if(data[d]->holes[i]->name == data[dset]->holes[spliceholenum]->name) { 8953: newtie2hole = i; 8954: break; 8955: } 8956: } 8957: if(newtie2hole == -1) { 8958: } 8959: else { 8960: for(i=0; i<data[d]->holes[newtie2hole]->numcores; ++i) { 8961: if(data[d]->holes[newtie2hole]->core[i]->num == data[dset]->holes[spliceholenum]->core[splicecorenum]->num) { 8962: newtie2core = i; 8963: break; 8964: } 8965: } 8966: if(newtie2core == -1) { 8967: } 8968: else { 8969: h = newtie2hole; 8970: c = newtie2core; 8971: core2n = 0; 8972: for(i=0; i<data[d]->holes[h]->core[c]->numvalues; ++i) { 8973: if(data[d]->holes[h]->core[c]->value[i]->quality & BAD_SB_DEPTH) { 8974: } 8975: else if(data[d]->holes[h]->core[c]->value[i]->quality == GOOD) { 8976: core2dep[core2n] = data[d]->holes[h]->core[c]->value[i]->sb_depth + 8977: data[d]->holes[h]->core[c]->cum_dep_offset; 8978: if(sm == YES) { 8979: core2var[core2n] = data[d]->holes[h]->core[c]->value[i]->sm_data; 8980: } 8981: else { 8982: core2var[core2n] = *data[d]->holes[h]->core[c]->value[i]->data; 8983: } 8984: ++core2n; 8985: } 8986: } 8987: if(core2n > 5) { 8988: depth = interpsplice_spl_depth; 8989: if(depth < core2dep[0] || depth > core2dep[core2n-1]) { 8990: } 8991: else { 8992: err = InterpolateTiePtValue(core2n, core2dep, core2var, depth, &intpt, &start); 8993: if(err > 0) { 8994: } 8995: else if(start < 0 || start >= core2n) { 8996: } 8997: else { 8998: for(i=core2n; i>start+1; --i) { 8999: core2dep[i] = core2dep[i-1]; 9000: core2var[i] = core2var[i-1]; 9001: } 9002: ++core2n; 9003: core2dep[start + 1] = depth; 9004: core2var[start + 1] = intpt; 9005: newtie2array = start + 1; 9006: } 9007: } 9008: } 9009: } 9010: } 9011: if(newtie1array != -1 && newtie2array != -1) { 9012: if(err == 0){ 9013: range1 = core1dep[core1n-1] - core1dep[0]; 9014: range2 = core2dep[core2n-1] - core2dep[0]; 9015: if(range1/depstep < MAXPERCORE || range2/depstep < MAXPERCORE){ 9016: tie1num = newtie1array; 9017: tie2num = newtie2array; 9018: RepickDepth(core1dep, core1var, &core1n, &tie1num, depstep); 9019: RepickDepth(core2dep, core2var, &core2n, &tie2num, depstep); 9020: } 9021: else { 9022: err = 1; 9023: } 9024: } 9025: } 9026: if(newtie1array != -1 && newtie2array != -1 && err == 0) { 9027: for(i=0; i<core2n; ++i){ 9028: if(core2dep[i] >= core2dep[tie2num]-winlen){ 9029: core2offset=i; 9030: break; 9031: } 9032: } 9033: nwin=0; 9034: for(j=i; j<core2n; ++j){ 9035: if(core2dep[j] > core2dep[tie2num]+winlen){ 9036: break; 9037: } 9038: else { 9039: ++nwin; 9040: } 9041: } 9042: if(leadlagmeters > 0.0){ 9043: lead_lag = leadlagmeters/depstep; 9044: num_lead_lag = lead_lag * 2 + 1; 9045: lag = -1.0 * lead_lag; 9046: } 9047: else { 9048: lead_lag=0; 9049: lag=0; 9050: } 9051: 9052: corr.num_lead_lag[d] = 0; 9053: for(i=0;i<num_lead_lag; ++i){ 9054: core1offset = tie1num - tie2num - lag; 9055: Correlate(core1n, nwin, core1offset, core2offset, core1var, core2var, 9056: &coef, &n); 9057: 9058: if(n < TOOFEWCORRPAIRS){ 9059: } 9060: else { 9061: corr.coef[d][corr.num_lead_lag[d]] = coef; 9062: corr.leadlag[d][corr.num_lead_lag[d]] = lag; 9063: corr.depleadlag[d][corr.num_lead_lag[d]] = lag * depstep; 9064: if(lag == 0){ 9065: tie_corr_num = corr.num_lead_lag[d]; 9066: } 9067: ++corr.num_lead_lag[d]; 9068: } 9069: ++lag; 9070: } 9071: } 9072: } 9073: } 9074: } 9075: 9076: /* draw the core 2 overlay of core 1 9077: */ 9078: have_splice_tie = DONT; 9079: have_splice_shift = DO; 9080: if(XtIsManaged(XtParent(drawingAreaView))) { 9081: reason_for_redraw = DRAW_TIES; 9082: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 9083: } 9084: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 9085: DrawDrawingAreaCompCorrelation(drawingAreaCompCorrelation, (XtPointer)NULL, (XtPointer)NULL); 9086: } 9087: } 9088: 9089: /* ARGSUSED */ 9090: void 9091: SpliceDismiss(w, client, call) 9092: Widget w; 9093: XtPointer client; 9094: XtPointer call; 9095: { 9096: /*SUPPRESS 594*/ 9097: 9098: void DrawDrawingAreaView(); 9099: 9100: have_splice_tie = DONT; 9101: have_splice_shift = DONT; 9102: have_spcorr = DONT; 9103: last_sp_tie = NO; 9104: have_sp_tie1 = DONT; 9105: have_sp_tie2 = DONT; 9106: are_splicing = NO; 9107: splice_how = NONE; 9108: 9109: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 9110: XClearWindow(XtDisplay(drawingAreaCompCorrelation), XtWindow(drawingAreaCompCorrelation)); 9111: } 9112: if(XtIsManaged(XtParent(drawingAreaView))) { 9113: if(have_core_to_splice == DO) { 9114: reason_for_redraw = DRAW_CORECLEARED; 9115: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 9116: } 9117: } 9118: have_core_to_splice = DONT; 9119: 9120: XtUnmanageChild(formSplicing); 9121: } 9122: 9123: /* ARGSUSED */ 9124: void 9125: SpliceHelp(w, client, call) 9126: Widget w; 9127: XtPointer client; 9128: XtPointer call; 9129: { 9130: /*SUPPRESS 594*/ 9131: } 9132: 9133: /* ARGSUSED */ 9134: void 9135: AppendSplice(w, client, call) 9136: Widget w; 9137: XtPointer client; 9138: XtPointer call; 9139: { 9140: /*SUPPRESS 594*/ 9141: 9142: int i, j, l, n, nv, k, ds, err, sm, sect, array, splhole, splcore; 9143: time_t tp; 9144: char string[50], date[200], *ptr; 9145: float depth, raw_val, sm_val, sect_dep; 9146: double fract, ip; 9147: XmString xmstring; 9148: int CleanUpSpliceCore(), FindValueInCoreToSplice(); 9149: void DrawDrawingAreaView(), SpliceToTie(); 9150: 9151: if(smooth.method == NONE){ 9152: sm = NO; 9153: } 9154: else if(smooth.method == GAUSSIAN || smooth.method == OTHER && 9155: smooth.plot == UNSMOOTHED){ 9156: sm = NO; 9157: } 9158: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 9159: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 9160: sm = YES; 9161: } 9162: else { 9163: sm = NO; 9164: } 9165: 9166: /* if the cores overlapped only slightly get the tie point 9167: for the last value in the splice and go to SpliceToTie 9168: to tie it 9169: */ 9170: if(have_core_to_splice == DO && splice_overlap == OVERLAPAPPEND) { 9171: depth = spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1] - 1]; 9172: err = FindValueInCoreToSplice(dset, sm, depth, spliceholenum, splicecorenum, 9173: &splicearraynum, &splice_how, &raw_val, &sm_val); 9174: if(err == 0) { 9175: spcompcorenum = spcomp.numcores-1; 9176: spcomparraynum = spcomp.numpercore[spcomp.numcores-1] - 1; 9177: interpsplice_val = raw_val; 9178: interpsplice_sm_val = sm_val; 9179: interpsplice_spl_depth = depth; 9180: SpliceToTie((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 9181: } 9182: else { 9183: } 9184: return; 9185: } 9186: 9187: /* make sure the ties, depth step and selected core text 9188: are clear 9189: */ 9190: (void)sprintf(string, ""); 9191: XtVaSetValues(textCompSelectHole, XmNvalue, string, NULL); 9192: XtVaSetValues(textCompSelectCore, XmNvalue, string, NULL); 9193: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 9194: xmstring = XmStringCreateSimple(string); 9195: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 9196: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 9197: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 9198: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 9199: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 9200: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 9201: XtVaSetValues(labelSpliceDifferenceInValue, XmNlabelString, xmstring, NULL); 9202: XmStringFree(xmstring); 9203: 9204: if(have_core_to_splice == DO){ 9205: 9206: have_core_to_splice = DONT; 9207: have_splice_tie = DONT; 9208: have_splice_shift = DONT; 9209: last_sp_tie = NONE; 9210: have_sp_tie1 = DONT; 9211: have_sp_tie2 = DONT; 9212: splice_how = NONE; 9213: 9214: /* set all buttons except dismiss, undo and grab insensitive 9215: */ 9216: XtSetSensitive(pushButtonGetSelectCore, True); 9217: XtSetSensitive(pushButtonClearGrab, FALSE); 9218: XtSetSensitive(pushButtonSpliceClearTie, FALSE); 9219: XtSetSensitive(pushButtonSpliceCorrelate, FALSE); 9220: XtSetSensitive(pushButtonSpliceToTie, FALSE); 9221: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 9222: XtSetSensitive(pushButtonAppendSplice, FALSE); 9223: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 9224: XtSetSensitive(pushButtonSpliceUndoLast, True); 9225: XtSetSensitive(pushButtonSuggestTies, False); 9226: 9227: i = spcomp.numcores; 9228: ++spcomp.numcores; 9229: splicearraynum = 0; 9230: 9231: spcomp.Depthoffset[i] = data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 9232: err = CleanUpSpliceCore(spliceholenum, splicecorenum, &spcomp.numpercore[i], 9233: spcomp.sb_depth[i], spcomp.var[i], sm, i, splicearraynum, spcomp.MapToOrig[i]); 9234: 9235: if(err > 0){ 9236: (void)sprintf(buffer, "ERROR; Could not append this core."); 9237: SpManageWarningBox(buffer); 9238: --spcomp.numcores; 9239: XtSetSensitive(pushButtonClearGrab, True); 9240: return; 9241: } 9242: 9243: /* check to see if the append core overlaps the splice composite 9244: */ 9245: if(splice_overlap == YES && spcomp.sb_depth[i][0] <= spcomp.sb_depth[i-1][spcomp.numpercore[i-1] - 1]){ 9246: (void)sprintf(buffer, "ERROR; the core to append overlaps the one above."); 9247: SpManageWarningBox(buffer); 9248: have_core_to_splice = DO; 9249: XtSetSensitive(pushButtonClearGrab, True); 9250: --spcomp.numcores; 9251: return; 9252: } 9253: else { 9254: 9255: spcomp.hole[i] = spliceholenum; 9256: spcomp.core[i] = splicecorenum; 9257: spcomp.splice_how[i] = APPEND; 9258: 9259: n = splicertable.data_cnt -1; 9260: (void)strcpy(splicertable.data[n].type_of_splice, "append"); 9261: 9262: ++splicertable.data_cnt; 9263: ++n; 9264: splicertable.data[n].site = data[dset]->site; 9265: splicertable.data[n].hole = data[dset]->holes[spliceholenum]->name; 9266: splicertable.data[n].core = data[dset]->holes[spliceholenum]->core[splicecorenum]->num; 9267: splicertable.data[n].core_type = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[0]->type; 9268: (void)strcpy(splicertable.data[n].type_of_splice, "append"); 9269: if(strcmp(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section, "CC") == 0) { 9270: sect = 1; 9271: (void)sprintf(buffer, "Warning; The top of core to splice is in the core catcher.\n"); 9272: (void)strcat(buffer, " Unable to calculate core top depth.\n"); 9273: (void)strcat(buffer, " Proceding but beware; the splice table will be incorrect."); 9274: SpManageWarningBox(buffer); 9275: } 9276: else { 9277: sect = atoi(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section); 9278: } 9279: sect_dep = (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->bot_int - 9280: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->top_int)/2.0 + 9281: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->top_int; 9282: fract = modf(sect_dep/1.0, &ip); 9283: if(fract <= 0.41) { 9284: sect_dep = ip; 9285: } 9286: else if(fract >= 0.59) { 9287: sect_dep = ip + 1.0; 9288: } 9289: else { 9290: sect_dep = ip + 1.0; 9291: } 9292: (void)strcpy(splicertable.data[n].section, "1"); 9293: splicertable.data[n].top_int = 0.0; 9294: splicertable.data[n].bot_int = 0.0; 9295: splicertable.data[n].mbsf = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth - 9296: sect_dep/100.0 - ((sect - 1) * 1.5); 9297: splicertable.data[n].mcd = splicertable.data[n].mbsf + spcomp.Depthoffset[i]; 9298: 9299: spcomp.map_to_table[i] = n; 9300: 9301: if(splicertable.data[n].mcd <= spcomp.sb_depth[i-1][spcomp.numpercore[i-1] - 1]) { 9302: (void)sprintf(buffer, "Warning; the calc. depth of appended core top overlaps splice above."); 9303: SpManageWarningBox(buffer); 9304: } 9305: 9306: if(splicertable.data_cnt+1>=splicertable.alloc_cnt) { 9307: if((ptr=(char*)realloc((char*)splicertable.data,(splicertable.alloc_cnt+=ALLOC_INT)*sizeof(SplicerTableInfo)))==NULL) { 9308: SpBadMemAlloc("BAD MEM"); 9309: } 9310: else { 9311: splicertable.data=(SplicerTableInfo*)ptr; 9312: } 9313: } 9314: 9315: ++n; 9316: ++splicertable.data_cnt; 9317: nv = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues - 1; 9318: splicertable.data[n].site = data[dset]->site; 9319: splicertable.data[n].hole = data[dset]->holes[spliceholenum]->name; 9320: splicertable.data[n].core = data[dset]->holes[spliceholenum]->core[splicecorenum]->num; 9321: splicertable.data[n].core_type = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[nv]->type; 9322: 9323: 9324: /* if more than one data set find which dataset that has the depthest core 9325: */ 9326: ds = dset; 9327: splhole = spliceholenum; 9328: splcore = splicecorenum; 9329: if(dataset_cnt > 1) { 9330: depth = data[ds]->holes[spliceholenum]->core[splicecorenum]->value[nv]->sb_depth; 9331: for(j=0; j<dataset_cnt; ++j) { 9332: if(j != dset) { 9333: /* is the splice hole,core in this dataset? 9334: */ 9335: for(k=0; k<data[j]->numholes; ++k) { 9336: if(data[j]->holes[k]->name == data[dset]->holes[spliceholenum]->name) { 9337: for(l=0; l<data[j]->holes[k]->numcores; ++l) { 9338: if(data[j]->holes[k]->core[l]->num == data[dset]->holes[spliceholenum]->core[splicecorenum]->num) { 9339: nv = data[j]->holes[k]->core[l]->numvalues - 1; 9340: if(data[j]->holes[k]->core[l]->value[nv]->sb_depth > depth) { 9341: ds = j; 9342: depth = data[j]->holes[k]->core[l]->value[nv]->sb_depth; 9343: splhole = k; 9344: splcore = l; 9345: } 9346: } 9347: } 9348: } 9349: } 9350: } 9351: } 9352: } 9353: else { 9354: } 9355: nv = data[ds]->holes[splhole]->core[splcore]->numvalues - 1; 9356: (void)strcpy(splicertable.data[n].section, data[ds]->holes[splhole]->core[splcore]->value[nv]->section); 9357: splicertable.data[n].top_int = data[ds]->holes[splhole]->core[splcore]->value[nv]->top_int; 9358: splicertable.data[n].bot_int = data[ds]->holes[splhole]->core[splcore]->value[nv]->bot_int; 9359: splicertable.data[n].mbsf = data[ds]->holes[splhole]->core[splcore]->value[nv]->sb_depth; 9360: splicertable.data[n].mcd = splicertable.data[n].mbsf + spcomp.Depthoffset[i]; 9361: 9362: did_splicing = YES; 9363: saved_splice = NO; 9364: 9365: /* write tie to report 9366: */ 9367: if(time(&tp)) { 9368: (void)sprintf(date, "%s", ctime(&tp)); 9369: } 9370: else { 9371: (void)sprintf(date, "no date available\n"); 9372: } 9373: if(are_splicing == CONSTRAINED) { 9374: (void)sprintf(buffer,"\nSplice: Constrained; hole %c core %d; CORE APPEND TO SPLICE %s", 9375: data[dset]->holes[spliceholenum]->name, data[dset]->holes[spliceholenum]->core[splicecorenum]->num, date); 9376: } 9377: else if(are_splicing == UNCONSTRAINED) { 9378: (void)sprintf(buffer,"\nSplice: Unconstrained; hole %c core %d; CORE APPEND TO SPLICE %s", 9379: data[dset]->holes[spliceholenum]->name, data[dset]->holes[spliceholenum]->core[splicecorenum]->num, date); 9380: } 9381: else { 9382: (void)sprintf(buffer,""); 9383: } 9384: SpUpdateReport(buffer); 9385: 9386: if(XtIsManaged(XtParent(drawingAreaView))) { 9387: reason_for_redraw = DRAW_APPEND; 9388: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 9389: } 9390: } 9391: } 9392: 9393: (void)sprintf(string, ""); 9394: (void)sprintf(date, ""); 9395: } 9396: 9397: /* ARGSUSED */ 9398: void 9399: SpliceUndoLast(w, client, call) 9400: Widget w; 9401: XtPointer client; 9402: XtPointer call; 9403: { 9404: /*SUPPRESS 594*/ 9405: 9406: int i, j, k, l, splicer_cnt, ncore, dnum, hnum, cnum, anum, sm, err, changed; 9407: float depth; 9408: time_t tp; 9409: char string[50], date[200]; 9410: XmString xmstring; 9411: int MakeSplice(), CleanUpSpliceCore(); 9412: void DrawDrawingAreaView(), DrawDrawingAreaAgeDepth(), XmListDeletePos(), PlotSpliceVsAge(); 9413: 9414: 9415: /* if have no more cores in splice make undo last 9416: button insensitive. but not if still have cores 9417: in splice table 9418: */ 9419: if(spcomp.numcores - 1 < 1){ 9420: if(splicertable.data_cnt-2 > 0) { 9421: } 9422: else { 9423: XtSetSensitive(pushButtonSpliceUndoLast, FALSE); 9424: XtSetSensitive(pushButtonSaveSplicerTable,FALSE); 9425: XtSetSensitive(pushButtonSaveSplicerData,FALSE); 9426: XtSetSensitive(pushButtonClearSplice, False); 9427: XtSetSensitive(pushButtonOpenSplicerTable,True); 9428: did_splicing = NO; 9429: saved_splice = NO; 9430: } 9431: } 9432: 9433: /* reset buttons and text 9434: */ 9435: /* set the window length and lead,lag to the defaults 9436: */ 9437: (void)sprintf(string, "%.2f", WINLEN); 9438: XtVaSetValues(textCompWindowLen, XmNvalue, string, NULL); 9439: (void)sprintf(string, "%.2f", LEADLAG); 9440: XtVaSetValues(textCompLeadLag, XmNvalue, string, NULL); 9441: 9442: /* make sure the ties, depth step and selected core text 9443: are clear 9444: */ 9445: (void)sprintf(string, ""); 9446: XtVaSetValues(textCompSelectHole, XmNvalue, string, NULL); 9447: XtVaSetValues(textCompSelectCore, XmNvalue, string, NULL); 9448: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 9449: xmstring = XmStringCreateSimple(string); 9450: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 9451: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 9452: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 9453: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 9454: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 9455: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 9456: XtVaSetValues(labelSpliceDifferenceInValue,XmNlabelString, xmstring, NULL); 9457: XmStringFree(xmstring); 9458: 9459: /* set all buttons except dismiss, grab undo last insensitive 9460: */ 9461: XtSetSensitive(pushButtonGetSelectCore, True); 9462: XtSetSensitive(pushButtonClearGrab, FALSE); 9463: XtSetSensitive(pushButtonSpliceClearTie, FALSE); 9464: XtSetSensitive(pushButtonSpliceCorrelate, FALSE); 9465: XtSetSensitive(pushButtonSpliceToTie, FALSE); 9466: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 9467: XtSetSensitive(pushButtonAppendSplice, FALSE); 9468: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 9469: 9470: /* and clear the correlation window 9471: */ 9472: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 9473: XClearWindow(XtDisplay(drawingAreaCompCorrelation), 9474: XtWindow(drawingAreaCompCorrelation)); 9475: } 9476: 9477: 9478: if(smooth.method == NONE){ 9479: sm = NO; 9480: } 9481: else if(smooth.method == GAUSSIAN || smooth.method == OTHER && 9482: smooth.plot == UNSMOOTHED){ 9483: sm = NO; 9484: } 9485: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 9486: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 9487: sm = YES; 9488: } 9489: else { 9490: sm = NO; 9491: } 9492: 9493: /* get the time 9494: */ 9495: ncore = spcomp.numcores - 1; 9496: if(time(&tp)) { 9497: (void)sprintf(date, "%s", ctime(&tp)); 9498: } 9499: else { 9500: (void)sprintf(date, "no date available\n"); 9501: } 9502: 9503: if(splicertable.data_cnt == 0) { 9504: } 9505: else if(spcomp.numcores > 1 && spcomp.map_to_table[ncore] == splicertable.data_cnt-2) { 9506: --spcomp.numcores; 9507: --ncore; 9508: hnum = spcomp.hole[ncore]; 9509: cnum = spcomp.core[ncore]; 9510: anum = spcomp.MapToOrig[ncore][0]; 9511: 9512: splicertable.data_cnt = splicertable.data_cnt -2; 9513: 9514: if(are_splicing == CONSTRAINED) { 9515: (void)sprintf(buffer,"\nSplice: Constrained; hole %c core %d; CORE SPLICE UNDONE %s", 9516: data[dset]->holes[spcomp.hole[ncore]]->name, data[dset]->holes[spcomp.hole[ncore]]->core[spcomp.core[ncore]]->num, date); 9517: } 9518: else if(are_splicing == UNCONSTRAINED) { 9519: (void)sprintf(buffer,"\nSplice: Unconstrained; hole %c core %d; CORE SPLICE UNDONE %s", 9520: data[dset]->holes[spcomp.hole[ncore]]->name, data[dset]->holes[spcomp.hole[ncore]]->core[spcomp.core[ncore]]->num, date); 9521: } 9522: else { 9523: (void)sprintf(buffer,""); 9524: } 9525: SpUpdateReport(buffer); 9526: } 9527: 9528: else if(spcomp.numcores == 1 && spcomp.map_to_table[ncore] == splicertable.data_cnt-2) { 9529: have_splice = DONT; 9530: splicertable.data_cnt = splicertable.data_cnt - 2; 9531: spcomp.numcores = 0; 9532: if(are_splicing == CONSTRAINED) { 9533: (void)sprintf(buffer,"\nSplice: Constrained; hole %c core %d; CORE SPLICE UNDONE %s", 9534: data[dset]->holes[spcomp.hole[ncore]]->name, data[dset]->holes[spcomp.hole[ncore]]->core[spcomp.core[ncore]]->num, date); 9535: } 9536: else if(are_splicing == UNCONSTRAINED) { 9537: (void)sprintf(buffer,"\nSplice: Unconstrained; hole %c core %d; CORE SPLICE UNDONE %s", 9538: data[dset]->holes[spcomp.hole[ncore]]->name, data[dset]->holes[spcomp.hole[ncore]]->core[spcomp.core[ncore]]->num, date); 9539: } 9540: else { 9541: (void)sprintf(buffer,""); 9542: } 9543: SpUpdateReport(buffer); 9544: (void)sprintf(buffer,"Last core of splice removed.\n", 9545: data[dset]->holes[spcomp.hole[0]]->name, data[dset]->holes[spcomp.hole[0]]->core[spcomp.core[0]]->num); 9546: SpUpdateReport(buffer); 9547: } 9548: 9549: else if(splicertable.data_cnt > 0) { 9550: splicertable.data_cnt = splicertable.data_cnt -2; 9551: if(are_splicing == CONSTRAINED) { 9552: (void)sprintf(buffer,"\nSplice: Constrained; hole %c core %d; SPLICE TABLE UNDONE %s", 9553: splicertable.data[splicertable.data_cnt].hole, splicertable.data[splicertable.data_cnt].core, date); 9554: } 9555: else if(are_splicing == UNCONSTRAINED) { 9556: (void)sprintf(buffer,"\nSplice: Unconstrained; hole %c core %d; SPLICE TABLE UNDONE %s", 9557: splicertable.data[splicertable.data_cnt].hole, splicertable.data[splicertable.data_cnt].core, date); 9558: } 9559: else { 9560: (void)sprintf(buffer,""); 9561: } 9562: SpUpdateReport(buffer); 9563: } 9564: 9565: else { 9566: printf("unsplicing; missed something.\n"); 9567: } 9568: 9569: /* make the last splice table record be end of core not tie 9570: if more than one data set, find the deepest 9571: if none of the data sets have the last core of the splice warn 9572: */ 9573: if(spcomp.numcores >= 1 && splicertable.data_cnt >= 2) { 9574: 9575: dnum = -1; 9576: hnum = -1; 9577: cnum = -1; 9578: depth = -9999.0; 9579: for(j=0; j<dataset_cnt; ++j) { 9580: /* is the splice hole,core in this dataset? 9581: */ 9582: for(k=0; k<data[j]->numholes; ++k) { 9583: if(data[j]->holes[k]->name == splicertable.data[splicertable.data_cnt-1].hole) { 9584: for(l=0; l<data[j]->holes[k]->numcores; ++l) { 9585: if(data[j]->holes[k]->core[l]->num == splicertable.data[splicertable.data_cnt-1].core) { 9586: anum = data[j]->holes[k]->core[l]->numvalues - 1; 9587: if(data[j]->holes[k]->core[l]->value[anum]->sb_depth > depth) { 9588: dnum = j; 9589: depth = data[j]->holes[k]->core[l]->value[anum]->sb_depth; 9590: hnum = k; 9591: cnum = l; 9592: } 9593: } 9594: } 9595: } 9596: } 9597: } 9598: if(dnum != -1 && hnum != -1 && cnum != -1) { 9599: anum = data[dnum]->holes[hnum]->core[cnum]->numvalues - 1; 9600: (void)strcpy(splicertable.data[splicertable.data_cnt-1].section, data[dnum]->holes[hnum]->core[cnum]->value[anum]->section); 9601: splicertable.data[splicertable.data_cnt-1].top_int = data[dnum]->holes[hnum]->core[cnum]->value[anum]->top_int; 9602: splicertable.data[splicertable.data_cnt-1].bot_int = data[dnum]->holes[hnum]->core[cnum]->value[anum]->bot_int; 9603: splicertable.data[splicertable.data_cnt-1].mbsf = data[dnum]->holes[hnum]->core[cnum]->value[anum]->sb_depth; 9604: splicertable.data[splicertable.data_cnt-1].mcd = data[dnum]->holes[hnum]->core[cnum]->value[anum]->sb_depth + 9605: data[dnum]->holes[hnum]->core[cnum]->cum_dep_offset; 9606: } 9607: else { 9608: (void)sprintf(buffer,"Warning: Could not restore the botton of the last core in splicer table."); 9609: SpManageWarningBox(buffer); 9610: } 9611: } 9612: 9613: /* can't restore table, warn 9614: */ 9615: else if(spcomp.numcores >= 1){ 9616: (void)sprintf(buffer,"Warning: Could not restore the botton of the last core in splicer table."); 9617: SpManageWarningBox(buffer); 9618: } 9619: 9620: /* remake the splice 9621: */ 9622: if(spcomp.numcores >= 1) { 9623: MakeSplice(dset, &spcomp); 9624: } 9625: 9626: 9627: /* if have agemodel, check if there are any hand age picks in part of splice removed 9628: if so get rid of them 9629: */ 9630: if(agemodel_cnt > 0) { 9631: if(agemodel_cnt == 1 && agemodel[0].avembsf == 0.0) { 9632: } 9633: else { 9634: changed = NO; 9635: for(i=0; i<agemodel_cnt; ++i) { 9636: if(agemodel[i].type == HANDPICK) { 9637: if(agemodel[i].avemcd >= splicertable.data[splicertable.data_cnt].mcd && 9638: agemodel[i].avemcd <= splicertable.data[splicertable.data_cnt+1].mcd) { 9639: 9640: (void)XmListDeletePos(listConstructAgeModel, i+1); 9641: for(j=i; j<agemodel_cnt-1; ++j) { 9642: if(strcmp(agemodel[j+1].code, "X") == 0) { 9643: agemodel[j].aveage = agemodel[j+1].aveage; 9644: agemodel[j].avembsf = agemodel[j+1].avembsf; 9645: agemodel[j].avemcd = agemodel[j+1].avemcd; 9646: (void)sprintf(agemodel[j].code, "X"); 9647: } 9648: else { 9649: agemodel[j] = agemodel[j+1]; 9650: } 9651: } 9652: --agemodel_cnt; 9653: changed = YES; 9654: } 9655: } 9656: } 9657: } 9658: if(changed == YES) { 9659: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 9660: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 9661: } 9662: PlotSpliceVsAge(NO); 9663: } 9664: } 9665: 9666: if(splicertable.data_cnt == 0) { 9667: SpCleanUp(INPUTSPLICERTABLE); 9668: } 9669: else { 9670: did_splicing = YES; 9671: saved_splice = NO; 9672: } 9673: 9674: if(XtIsManaged(XtParent(drawingAreaView))) { 9675: reason_for_redraw = DRAW_UNDONE; 9676: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 9677: } 9678: 9679: (void)sprintf(string, ""); 9680: (void)sprintf(date, ""); 9681: } 9682: 9683: /* ARGSUSED */ 9684: void 9685: SpliceToTie(w, client, call) 9686: Widget w; 9687: XtPointer client; 9688: XtPointer call; 9689: { 9690: /*SUPPRESS 594*/ 9691: 9692: int i, j, k, l, n, nv, ds, err, sm, sect_above, sect_below, splhole, splcore; 9693: float top_mbsf, depth; 9694: time_t tp; 9695: char date[200], *string, *ptr; 9696: XmString xmstring; 9697: double check; 9698: int CleanUpSpliceCore(); 9699: void DrawDrawingAreaView(); 9700: 9701: /* note that i is the current spcomp core so don't use it 9702: in any loops! 9703: */ 9704: 9705: if(have_core_to_splice == DO){ 9706: 9707: /* warn if tie creates an additional offset that exceeds standard 9708: */ 9709: if((fabs(splicedepoffset)) > CHECKSPLICEOFFSET){ 9710: (void)sprintf(buffer,"This tie creates an additional depth offset exceeding +/-%.2f meters.", CHECKSPLICEOFFSET); 9711: SpManageWarningBox(buffer); 9712: } 9713: 9714: have_core_to_splice = DONT; 9715: have_splice_tie = DONT; 9716: have_splice_shift = DONT; 9717: last_sp_tie = NONE; 9718: have_sp_tie1 = DONT; 9719: have_sp_tie2 = DONT; 9720: 9721: /* set all buttons except dismiss, undo and grab insensitive 9722: */ 9723: XtSetSensitive(pushButtonGetSelectCore, True); 9724: XtSetSensitive(pushButtonClearGrab, FALSE); 9725: XtSetSensitive(pushButtonSpliceClearTie, FALSE); 9726: XtSetSensitive(pushButtonSpliceCorrelate, FALSE); 9727: XtSetSensitive(pushButtonSpliceToTie, FALSE); 9728: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 9729: XtSetSensitive(pushButtonAppendSplice, FALSE); 9730: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 9731: XtSetSensitive(pushButtonSpliceUndoLast, True); 9732: 9733: ++spcomp.numcores; 9734: if(spcomp.numcores < 2){ 9735: (void)sprintf(buffer,"ERROR; SpliceToTie; something wrong with number of cores; n<2!"); 9736: SpManageWarningBox(buffer); 9737: return; 9738: } 9739: else { 9740: i = spcomp.numcores - 1; 9741: } 9742: 9743: if(smooth.method == NONE){ 9744: sm = NO; 9745: } 9746: else if(smooth.method == GAUSSIAN || smooth.method == OTHER && 9747: smooth.plot == UNSMOOTHED){ 9748: sm = NO; 9749: } 9750: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 9751: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 9752: sm = YES; 9753: } 9754: else { 9755: sm = NO; 9756: } 9757: 9758: spcomp.Depthoffset[i] = data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset + 9759: splicedepoffset; 9760: err = CleanUpSpliceCore(spliceholenum, splicecorenum, &spcomp.numpercore[i], 9761: spcomp.sb_depth[i], spcomp.var[i], sm, i, splicearraynum, spcomp.MapToOrig[i]); 9762: 9763: if(err > 0){ 9764: (void)sprintf(buffer,"ERROR; SpliceToTie; could not cleanup splice core"); 9765: SpManageWarningBox(buffer); 9766: --spcomp.numcores; 9767: return; 9768: } 9769: else { 9770: 9771: /* get rid of the points below the tie in the 9772: splice composite 9773: */ 9774: spcomp.numpercore[i-1] = spcomparraynum + 1; 9775: 9776: spcomp.hole[i] = spliceholenum; 9777: spcomp.core[i] = splicecorenum; 9778: 9779: if(splice_how == REAL) { 9780: spcomp.splice_how[i] = REAL; 9781: } 9782: else if(splice_how == INTERPOLATED) { 9783: spcomp.splice_how[i] = INTERPOLATED; 9784: spcomp.interpolated_spl_depth[i] = interpsplice_spl_depth; 9785: spcomp.interpolated_sb_depth[i] = interpsplice_spl_depth - spcomp.Depthoffset[i]; 9786: spcomp.interpolated_value[i] = interpsplice_val; 9787: spcomp.interpolated_sm_value[i] = interpsplice_sm_val; 9788: 9789: /* find the section and section depth for this interpolated point 9790: note that the map to original will hold the indicy of the next real 9791: point. and that this could never be the first or last value in core. 9792: but check anyway 9793: */ 9794: if(splicearraynum == 0 || splicearraynum == data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues - 1) { 9795: (void)sprintf(buffer,"ERROR; SpliceToTie; something is wrong with interpolated point."); 9796: SpManageWarningBox(buffer); 9797: --spcomp.numcores; 9798: return; 9799: } 9800: else { 9801: 9802: /* make the sections ints so easier to compare. if one or the other is the core catcher 9803: signify this with -1 9804: */ 9805: if(strcmp(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum-1]->section, "CC") == 0) { 9806: sect_above = -1; 9807: } 9808: else { 9809: sect_above = atoi(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum - 1]->section); 9810: } 9811: if(strcmp(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section, "CC") == 0) { 9812: sect_below = -1; 9813: } 9814: else { 9815: sect_below = atoi(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section); 9816: } 9817: 9818: /* sections above and below interpolated point are the same 9819: */ 9820: if(sect_above == sect_below) { 9821: strcpy(spcomp.interpolated_section[i], data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section); 9822: spcomp.interpolated_top_int[i] = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->top_int - 9823: (150.0 * (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth - spcomp.interpolated_sb_depth[i])); 9824: spcomp.interpolated_bot_int[i] = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->bot_int - 9825: (150.0 * (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth - spcomp.interpolated_sb_depth[i])); 9826: if(spcomp.interpolated_top_int[i] < 0.0 || spcomp.interpolated_top_int[i] > 150.0) { 9827: (void)sprintf(buffer,"ERROR; SpliceToTie; something is wrong with interpolated point."); 9828: SpManageWarningBox(buffer); 9829: --spcomp.numcores; 9830: return; 9831: } 9832: } 9833: 9834: /* the section below the interpolated point is the core catcher 9835: and the one above is not 9836: */ 9837: else if(sect_below == -1) { 9838: (void)sprintf(buffer,"ERROR; SpliceToTie; real pt below interpolated pt in CC, no code yet."); 9839: SpManageWarningBox(buffer); 9840: --spcomp.numcores; 9841: return; 9842: } 9843: 9844: /* the section below the interpolated point is greater than the one above. 9845: is it the next section? 9846: */ 9847: else if(sect_below > sect_above) { 9848: spcomp.interpolated_top_int[i] = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->top_int - 9849: (150.0 * (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth - spcomp.interpolated_sb_depth[i])); 9850: spcomp.interpolated_bot_int[i] = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->bot_int - 9851: (150.0 * (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth - spcomp.interpolated_sb_depth[i])); 9852: if(spcomp.interpolated_top_int[i] >= 0.0) { 9853: strcpy(spcomp.interpolated_section[i], data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section); 9854: } 9855: else { 9856: --sect_below; 9857: top_mbsf = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth - 9858: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->top_int/100.0; 9859: while(top_mbsf - spcomp.interpolated_sb_depth[i] > 1.5) { 9860: --sect_below; 9861: top_mbsf = top_mbsf - 1.50; 9862: } 9863: if(sect_below < sect_above) { 9864: (void)sprintf(buffer,"ERROR; SpliceToTie; something is wrong with interpolated point."); 9865: SpManageWarningBox(buffer); 9866: --spcomp.numcores; 9867: return; 9868: } 9869: else { 9870: spcomp.interpolated_top_int[i] = 150.0 - ((top_mbsf - spcomp.interpolated_sb_depth[i]) * 100.0); 9871: spcomp.interpolated_bot_int[i] = 150.0 - ((top_mbsf - spcomp.interpolated_sb_depth[i]) * 100.0); 9872: sprintf(spcomp.interpolated_section[i], "%d", sect_below); 9873: } 9874: } 9875: } 9876: 9877: /* no other reasonable choices; right? 9878: */ 9879: else { 9880: (void)sprintf(buffer,"ERROR; SpliceToTie; something is wrong with interpolated point."); 9881: SpManageWarningBox(buffer); 9882: --spcomp.numcores; 9883: return; 9884: } 9885: } 9886: } 9887: else { 9888: (void)sprintf(buffer,"ERROR; SpliceToTie; could not tell if splice real or interpolated."); 9889: SpManageWarningBox(buffer); 9890: --spcomp.numcores; 9891: return; 9892: } 9893: 9894: /* put info in splice table 9895: */ 9896: n = splicertable.data_cnt -1; 9897: splicertable.data[n].site = data[dset]->site; 9898: splicertable.data[n].hole = data[dset]->holes[spcomp.hole[spcompcorenum]]->name; 9899: splicertable.data[n].core = data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->num; 9900: splicertable.data[n].core_type = 9901: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->type; 9902: (void)strcpy(splicertable.data[n].section, 9903: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->section); 9904: splicertable.data[n].top_int = 9905: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->top_int; 9906: splicertable.data[n].bot_int = 9907: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->bot_int; 9908: splicertable.data[n].mbsf = 9909: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->sb_depth; 9910: splicertable.data[n].mcd = 9911: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->sb_depth + 9912: spcomp.Depthoffset[i-1]; 9913: 9914: if(splicertable.data_cnt+1>=splicertable.alloc_cnt) { 9915: if((ptr=(char*)realloc((char*)splicertable.data,(splicertable.alloc_cnt+=ALLOC_INT)*sizeof(SplicerTableInfo)))==NULL) { 9916: SpBadMemAlloc("BAD MEM"); 9917: } 9918: else { 9919: splicertable.data=(SplicerTableInfo*)ptr; 9920: } 9921: } 9922: 9923: ++n; 9924: ++splicertable.data_cnt; 9925: splicertable.data[n].site = data[dset]->site; 9926: splicertable.data[n].hole = data[dset]->holes[spliceholenum]->name; 9927: splicertable.data[n].core = data[dset]->holes[spliceholenum]->core[splicecorenum]->num; 9928: splicertable.data[n].core_type = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->type; 9929: if(spcomp.splice_how[i] == REAL) { 9930: (void)strcpy(splicertable.data[n].section, data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section); 9931: splicertable.data[n].top_int = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->top_int; 9932: splicertable.data[n].bot_int = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->bot_int; 9933: splicertable.data[n].mbsf = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth; 9934: (void)strcpy(splicertable.data[n].type_of_splice, "tie"); 9935: } 9936: else if(spcomp.splice_how[i] == INTERPOLATED) { 9937: (void)strcpy(splicertable.data[n].section, spcomp.interpolated_section[i]); 9938: splicertable.data[n].top_int = spcomp.interpolated_top_int[i]; 9939: splicertable.data[n].bot_int = spcomp.interpolated_bot_int[i]; 9940: splicertable.data[n].mbsf = spcomp.interpolated_sb_depth[i]; 9941: (void)strcpy(splicertable.data[n].type_of_splice, "interp"); 9942: } 9943: splicertable.data[n].mcd = splicertable.data[n].mbsf + spcomp.Depthoffset[i]; 9944: 9945: spcomp.map_to_table[i] = n; 9946: 9947: if(splicertable.data_cnt+1>=splicertable.alloc_cnt) { 9948: if((ptr=(char*)realloc((char*)splicertable.data,(splicertable.alloc_cnt+=ALLOC_INT)*sizeof(SplicerTableInfo)))==NULL) { 9949: SpBadMemAlloc("BAD MEM"); 9950: } 9951: else { 9952: splicertable.data=(SplicerTableInfo*)ptr; 9953: } 9954: } 9955: 9956: ++n; 9957: ++splicertable.data_cnt; 9958: nv = data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues - 1; 9959: splicertable.data[n].site = data[dset]->site; 9960: splicertable.data[n].hole = data[dset]->holes[spliceholenum]->name; 9961: splicertable.data[n].core = data[dset]->holes[spliceholenum]->core[splicecorenum]->num; 9962: splicertable.data[n].core_type = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[nv]->type; 9963: 9964: /* if more than one data set find which dataset that has the depthest core 9965: */ 9966: ds = dset; 9967: splhole = spliceholenum; 9968: splcore = splicecorenum; 9969: if(dataset_cnt > 1) { 9970: depth = data[ds]->holes[spliceholenum]->core[splicecorenum]->value[nv]->sb_depth; 9971: for(j=0; j<dataset_cnt; ++j) { 9972: if(j != dset) { 9973: /* is the splice hole,core in this dataset? 9974: */ 9975: for(k=0; k<data[j]->numholes; ++k) { 9976: if(data[j]->holes[k]->name == data[dset]->holes[spliceholenum]->name) { 9977: for(l=0; l<data[j]->holes[k]->numcores; ++l) { 9978: if(data[j]->holes[k]->core[l]->num == data[dset]->holes[spliceholenum]->core[splicecorenum]->num) { 9979: nv = data[j]->holes[k]->core[l]->numvalues - 1; 9980: if(data[j]->holes[k]->core[l]->value[nv]->sb_depth > depth) { 9981: ds = j; 9982: depth = data[j]->holes[k]->core[l]->value[nv]->sb_depth; 9983: splhole = k; 9984: splcore = l; 9985: } 9986: } 9987: } 9988: } 9989: } 9990: } 9991: } 9992: } 9993: else { 9994: } 9995: nv = data[ds]->holes[splhole]->core[splcore]->numvalues - 1; 9996: (void)strcpy(splicertable.data[n].section, data[ds]->holes[splhole]->core[splcore]->value[nv]->section); 9997: splicertable.data[n].top_int = data[ds]->holes[splhole]->core[splcore]->value[nv]->top_int; 9998: splicertable.data[n].bot_int = data[ds]->holes[splhole]->core[splcore]->value[nv]->bot_int; 9999: splicertable.data[n].mbsf = data[ds]->holes[splhole]->core[splcore]->value[nv]->sb_depth; 10000: splicertable.data[n].mcd = splicertable.data[n].mbsf + spcomp.Depthoffset[i]; 10001: 10002: did_splicing = YES; 10003: saved_splice = NO; 10004: 10005: /* write tie to report 10006: */ 10007: if(time(&tp)) { 10008: (void)sprintf(date, "%s", ctime(&tp)); 10009: } 10010: else { 10011: (void)sprintf(date, "no date available\n"); 10012: } 10013: if(are_splicing == CONSTRAINED) { 10014: (void)sprintf(buffer,"\nSplice: Constrained; hole %c core %d CORE SPLICED %s", 10015: data[dset]->holes[spliceholenum]->name, data[dset]->holes[spliceholenum]->core[splicecorenum]->num, date); 10016: } 10017: else if(are_splicing == UNCONSTRAINED) { 10018: (void)sprintf(buffer,"\nSplice: Unconstrained; hole %c core %d CORE SPLICED %s", 10019: data[dset]->holes[spliceholenum]->name, data[dset]->holes[spliceholenum]->core[splicecorenum]->num, date); 10020: } 10021: else { 10022: (void)sprintf(buffer,""); 10023: } 10024: SpUpdateReport(buffer); 10025: 10026: /* write splice tie to report 10027: */ 10028: (void)sprintf(buffer,"splice tie %d %d %c %d %c %s %.1f %.1f %.2f to %d %d %c %d %c %s %.1f %.1f %.2f\n", 10029: data[dset]->leg, 10030: data[dset]->site, 10031: data[dset]->holes[spcomp.hole[spcompcorenum]]->name, 10032: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->num, 10033: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->type, 10034: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->section, 10035: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->top_int, 10036: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->bot_int, 10037: data[dset]->holes[spcomp.hole[spcompcorenum]]->core[spcomp.core[spcompcorenum]]->value[spcomp.MapToOrig[spcompcorenum][spcomparraynum]]->sb_depth, 10038: data[dset]->leg, 10039: data[dset]->site, 10040: data[dset]->holes[spliceholenum]->name, 10041: data[dset]->holes[spliceholenum]->core[splicecorenum]->num, 10042: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->type, 10043: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->section, 10044: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->top_int, 10045: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->bot_int, 10046: data[dset]->holes[spliceholenum]->core[splicecorenum]->value[splicearraynum]->sb_depth); 10047: SpUpdateReport(buffer); 10048: 10049: /*write the correlation info to the report and the value difference 10050: */ 10051: XtVaGetValues(labelSpliceDifferenceInValue, XmNlabelString, &xmstring, NULL ); 10052: XmStringGetLtoR(xmstring, XmFONTLIST_DEFAULT_TAG, &string); 10053: if(are_splicing == CONSTRAINED && splice_how == INTERPOLATED) { 10054: (void)sprintf(buffer,"Tie evaluation; corr. coef. %.3f, value difference %s INTERPOLATED TIE\n", 10055: corr.coef[dset][best_corr_num], string); 10056: } 10057: else { 10058: (void)sprintf(buffer,"Tie evaluation; corr. coef. %.3f, value difference %s REAL TIE\n", 10059: corr.coef[dset][best_corr_num], string); 10060: } 10061: XtFree(string); 10062: SpUpdateReport(buffer); 10063: 10064: if(XtIsManaged(XtParent(drawingAreaView))) { 10065: reason_for_redraw = DRAW_SPLICED; 10066: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 10067: } 10068: } 10069: } 10070: 10071: (void)sprintf(date, ""); 10072: } 10073: 10074: 10075: /* ARGSUSED */ 10076: void 10077: SpliceClearGrab(w, client, call) 10078: Widget w; 10079: XtPointer client; 10080: XtPointer call; 10081: { 10082: /*SUPPRESS 594*/ 10083: 10084: char string[50]; 10085: XmString xmstring; 10086: void DrawDrawingAreaView(); 10087: 10088: have_core_to_splice = DONT; 10089: have_splice_tie = DONT; 10090: have_splice_shift = DONT; 10091: have_spcorr = DONT; 10092: last_sp_tie = NONE; 10093: have_sp_tie1 = DONT; 10094: have_sp_tie2 = DONT; 10095: splice_how = NONE; 10096: 10097: spliceholenum = 0; 10098: splicecorenum = 0; 10099: splicearraynum = 0; 10100: 10101: /* reset buttons and text 10102: */ 10103: /* set the window length and lead,lag to the defaults 10104: */ 10105: (void)sprintf(string, "%.2f", WINLEN); 10106: XtVaSetValues(textCompWindowLen, XmNvalue, string, NULL); 10107: (void)sprintf(string, "%.2f", LEADLAG); 10108: XtVaSetValues(textCompLeadLag, XmNvalue, string, NULL); 10109: 10110: /* make sure the ties, depth step and selected core text 10111: are clear 10112: */ 10113: (void)sprintf(string, ""); 10114: XtVaSetValues(textCompSelectHole, XmNvalue, string, NULL); 10115: XtVaSetValues(textCompSelectCore, XmNvalue, string, NULL); 10116: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 10117: xmstring = XmStringCreateSimple(string); 10118: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 10119: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 10120: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 10121: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 10122: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 10123: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 10124: XtVaSetValues(labelSpliceDifferenceInValue, XmNlabelString, xmstring, NULL); 10125: XmStringFree(xmstring); 10126: 10127: /* set all buttons except dismiss, grab undo last insensitive 10128: */ 10129: XtSetSensitive(pushButtonGetSelectCore, True); 10130: XtSetSensitive(pushButtonClearGrab, FALSE); 10131: XtSetSensitive(pushButtonSpliceClearTie, FALSE); 10132: XtSetSensitive(pushButtonSpliceCorrelate, FALSE); 10133: XtSetSensitive(pushButtonSpliceToTie, FALSE); 10134: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 10135: XtSetSensitive(pushButtonAppendSplice, FALSE); 10136: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 10137: XtSetSensitive(pushButtonSpliceUndoLast, True); 10138: XtSetSensitive(pushButtonSuggestTies, False); 10139: 10140: /* and clear the correlation window 10141: */ 10142: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 10143: XClearWindow(XtDisplay(drawingAreaCompCorrelation), 10144: XtWindow(drawingAreaCompCorrelation)); 10145: } 10146: if(XtIsManaged(XtParent(drawingAreaView))) { 10147: reason_for_redraw = DRAW_CORECLEARED; 10148: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 10149: } 10150: 10151: (void)sprintf(string, ""); 10152: } 10153: 10154: 10155: /* ARGSUSED */ 10156: void 10157: DrawDrawingAreaDepthOffset(w, client, call) 10158: Widget w; 10159: XtPointer client; 10160: XtPointer call; 10161: { 10162: /*SUPPRESS 594*/ 10163: 10164: int i, j, sx, sy, axispixlen, ticpixlen, annot, label, pixpermeter; 10165: char s[50]; 10166: float max, maxmeter, maxoffset, unitinc, depticinc, sect, sect_dep, dep, percentdepchange; 10167: double check, fract, ip; 10168: String str; 10169: Dimension win_width, win_height; 10170: void HardwireAxis(), AxisDep(), AxisDepthOffset(); 10171: 10172: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 10173: 10174: /*clear the drawing area 10175: */ 10176: XClearWindow(XtDisplay(w), XtWindow(w)); 10177: 10178: max = 0.0; 10179: if(have_data == DO){ 10180: for(i=0; i<data[dset]->numholes; ++i){ 10181: for(j=0; j<data[dset]->holes[i]->numcores; ++j){ 10182: if(data[dset]->holes[i]->core[j]->did_offset == YES && 10183: data[dset]->holes[i]->core[j]->value[0]->sb_depth > max){ 10184: max = data[dset]->holes[i]->core[j]->value[0]->sb_depth; 10185: } 10186: } 10187: } 10188: } 10189: 10190: unitinc = 0.0; /*the starting value of the depth axis*/ 10191: 10192: /*calc. the length of the axis in pixels 10193: */ 10194: axispixlen = (int)win_height - OFF - SPACE; 10195: 10196: /* hardwire the scale and such so maximize axis length 10197: */ 10198: HardwireAxis(max, &maxmeter, &annot, &depticinc, &pixpermeter, &ticpixlen, &offsetdepperpix, axispixlen, 1); 10199: 10200: /* set color for axis and labels 10201: */ 10202: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[LABEL_COLOR]); 10203: label = YES; 10204: AxisDep(w, XtDisplay(w), XtWindow(w), gc_drawingAreaDepthOffset, 10205: maxmeter, OFF, 0, ticpixlen, depticinc, unitinc, offsetdepperpix, annot, label); 10206: 10207: unitinc = 0.0; 10208: depticinc = 5.0; 10209: maxoffset = 10.0; 10210: 10211: /*calc. the length of the axis 10212: adjust the length of x axis if its 10213: total length is not divisable by ten 10214: */ 10215: axispixlen = (int)win_width - OFF - SPACE; 10216: 10217: check = maxoffset/depticinc; 10218: fract = modf(check, &ip); 10219: if(fract == 0.0){ 10220: } 10221: else { 10222: maxoffset = (ip * depticinc) + depticinc; 10223: } 10224: 10225: if(have_data == DONT){ 10226: } 10227: else { 10228: max = -9999.0; 10229: for(i=0; i<data[dset]->numholes; ++i){ 10230: for(j=0; j<data[dset]->holes[i]->numcores; ++j){ 10231: if(data[dset]->holes[i]->core[j]->did_offset == YES && data[dset]->holes[i]->core[j]->cum_dep_offset > max){ 10232: max = data[dset]->holes[i]->core[j]->cum_dep_offset; 10233: } 10234: } 10235: } 10236: 10237: if(max < 10.0){ 10238: maxoffset = 10.0; 10239: } 10240: else if(maxoffset < max){ 10241: if(max > 30.0){ 10242: depticinc = 10.0; 10243: } 10244: while(maxoffset < max){ 10245: maxoffset = maxoffset + depticinc; 10246: } 10247: } 10248: } 10249: 10250: /* calculate how many pixels in a meter; truncate the result so mult. 10251: meters are equal to a pixel value that is a whole number 10252: */ 10253: check = axispixlen/maxoffset; 10254: fract = modf(check, &ip); 10255: pixpermeter = ip; 10256: 10257: ticpixlen = pixpermeter * depticinc; 10258: check = pixpermeter; 10259: depthoffsetperpix = 1.0/check; 10260: 10261: annot = 1; 10262: AxisDepthOffset(w, XtDisplay(w), XtWindow(w), gc_drawingAreaDepthOffset, 10263: maxoffset, OFF, 0, ticpixlen, depticinc, unitinc, depthoffsetperpix, annot); 10264: 10265: /* draw the percent cum depth change 'trend' line 10266: */ 10267: str = XmTextGetString(textDepthChange); 10268: percentdepchange = atof(str); 10269: XtFree(str); 10270: 10271: if(percentdepchange <= 0){ 10272: } 10273: else { 10274: /* set color for the line 10275: */ 10276: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFLINE_COLOR]); 10277: if(percentdepchange/100.0 * maxmeter <= maxoffset){ 10278: sx = (percentdepchange/100.0 * maxmeter)/depthoffsetperpix + OFF; 10279: sy = maxmeter/offsetdepperpix + OFF; 10280: } 10281: else { 10282: sx = maxoffset/depthoffsetperpix + OFF; 10283: sy = (maxoffset/(percentdepchange/100.0))/offsetdepperpix + OFF; 10284: } 10285: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaDepthOffset, 10286: OFF, OFF, sx, sy); 10287: } 10288: 10289: /* draw the offsets 10290: */ 10291: if(have_data == DO && draw_offsets == YES){ 10292: 10293: for(i=0; i<data[dset]->numholes; ++i){ 10294: 10295: if(i+1 == 1){ 10296: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE1_COLOR]); 10297: } 10298: else if(i+1 == 2){ 10299: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE2_COLOR]); 10300: } 10301: else if(i+1 == 3){ 10302: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE3_COLOR]); 10303: } 10304: else if(i+1 == 4){ 10305: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE4_COLOR]); 10306: } 10307: else if(i+1 == 5){ 10308: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE5_COLOR]); 10309: } 10310: else if(i+1 == 6){ 10311: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE6_COLOR]); 10312: } 10313: else if(i+1 == 7){ 10314: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE7_COLOR]); 10315: } 10316: else if(i+1 == 8){ 10317: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE8_COLOR]); 10318: } 10319: else if(i+1 == 9){ 10320: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE9_COLOR]); 10321: } 10322: else if(i+1 == 10){ 10323: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE10_COLOR]); 10324: } 10325: else if(i+1 == 11){ 10326: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE11_COLOR]); 10327: } 10328: else { 10329: XSetForeground(XtDisplay(w), gc_drawingAreaDepthOffset, fgPixel[DEPOFFHOLE1_COLOR]); 10330: } 10331: 10332: for(j=0; j<data[dset]->holes[i]->numcores; ++j){ 10333: 10334: if(data[dset]->holes[i]->core[j]->did_offset == YES){ 10335: if((int)strcmp(data[dset]->holes[i]->core[j]->value[0]->section, "CC") == 0){ 10336: sect = 1.0; 10337: } 10338: else { 10339: sect = atof(data[dset]->holes[i]->core[j]->value[0]->section); 10340: } 10341: sx = data[dset]->holes[i]->core[j]->cum_dep_offset/depthoffsetperpix + OFF; 10342: sect_dep = (data[dset]->holes[i]->core[j]->value[0]->bot_int - data[dset]->holes[i]->core[j]->value[0]->top_int)/2.0 + 10343: data[dset]->holes[i]->core[j]->value[0]->top_int; 10344: fract = modf(sect_dep/1.0, &ip); 10345: if(fract <= 0.41) { 10346: sect_dep = ip; 10347: } 10348: else if(fract >= 0.59) { 10349: sect_dep = ip + 1.0; 10350: } 10351: else { 10352: sect_dep = ip + 1.0; 10353: } 10354: dep = data[dset]->holes[i]->core[j]->value[0]->sb_depth - sect_dep/100.0 - ((sect - 1.0) * 1.5); 10355: sy = dep/offsetdepperpix + OFF; 10356: (void)sprintf(s, "%d", data[dset]->holes[i]->core[j]->num); 10357: if(data[dset]->holes[i]->core[j]->num >= 10){ 10358: sx = sx - 4; 10359: } 10360: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaDepthOffset, 10361: sx, sy + POINTSIZE, s, (int)strlen(s)); 10362: } 10363: } 10364: 10365: (void)sprintf(s, "%d%c", data[dset]->site, data[dset]->holes[i]->name); 10366: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaDepthOffset, 10367: OFF + (i * OFF) + 10, win_height - (SPACE/2), s, (int)strlen(s)); 10368: } 10369: } 10370: else { 10371: } 10372: 10373: (void)sprintf(s, ""); 10374: } 10375: 10376: /* ARGSUSED */ 10377: void 10378: DepthOffsetDismiss(w, client, call) 10379: Widget w; 10380: XtPointer client; 10381: XtPointer call; 10382: { 10383: /*SUPPRESS 594*/ 10384: 10385: draw_offsets = NO; 10386: 10387: XtUnmanageChild(formDepthOffset); 10388: } 10389: 10390: /* ARGSUSED */ 10391: void 10392: DisplayPlotSmooth(w, client, call) 10393: Widget w; 10394: XtPointer client; 10395: XtPointer call; 10396: { 10397: /*SUPPRESS 594*/ 10398: 10399: } 10400: 10401: /* ARGSUSED */ 10402: void 10403: DisplayPlotUnsmooth(w, client, call) 10404: Widget w; 10405: XtPointer client; 10406: XtPointer call; 10407: { 10408: /*SUPPRESS 594*/ 10409: 10410: } 10411: 10412: /* ARGSUSED */ 10413: void 10414: DisplayPlotBoth(w, client, call) 10415: Widget w; 10416: XtPointer client; 10417: XtPointer call; 10418: { 10419: /*SUPPRESS 594*/ 10420: 10421: } 10422: 10423: /* ARGSUSED */ 10424: void 10425: ViewDepthOffset(w, client, call) 10426: Widget w; 10427: XtPointer client; 10428: XtPointer call; 10429: { 10430: /*SUPPRESS 594*/ 10431: 10432: void DrawDrawingAreaDepthOffset(); 10433: 10434: XtManageChild(formDepthOffset); 10435: XtPopup(XtParent(formDepthOffset), XtGrabNone); 10436: 10437: draw_offsets = YES; 10438: 10439: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 10440: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 10441: } 10442: } 10443: 10444: /* ARGSUSED */ 10445: void 10446: TieSuggestTextActive(w, client, call) 10447: Widget w; 10448: XtPointer client; 10449: XtPointer call; 10450: { 10451: /*SUPPRESS 594*/ 10452: } 10453: 10454: 10455: /* ARGSUSED */ 10456: void 10457: DepthOffsetTextActivate(w, client, call) 10458: Widget w; 10459: XtPointer client; 10460: XtPointer call; 10461: { 10462: /*SUPPRESS 594*/ 10463: 10464: void DrawDrawingAreaDepthOffset(); 10465: 10466: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 10467: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 10468: } 10469: } 10470: 10471: /* ARGSUSED */ 10472: void 10473: SuggestTies(w, client, call) 10474: Widget w; 10475: XtPointer client; 10476: XtPointer call; 10477: { 10478: /*SUPPRESS 594*/ 10479: 10480: if((message.label=(char*)calloc(100,CHAR_SIZE))==NULL) 10481: SpBadMemAlloc("Sp"); 10482: (void)sprintf(message.label,"This Option is incomplete."); 10483: SpManageMessage(message); 10484: /* 10485: XtManageChild(formTieSuggestions); 10486: XtPopup(XtParent(formTieSuggestions),XtGrabNone); 10487: */ 10488: } 10489: 10490: /* ARGSUSED */ 10491: void 10492: TieSuggestionsDismiss(w, client, call) 10493: Widget w; 10494: XtPointer client; 10495: XtPointer call; 10496: { 10497: /*SUPPRESS 594*/ 10498: 10499: XtUnmanageChild(formTieSuggestions); 10500: } 10501: 10502: /* ARGSUSED */ 10503: void 10504: TieSuggestionsHelp(w, client, call) 10505: Widget w; 10506: XtPointer client; 10507: XtPointer call; 10508: { 10509: /*SUPPRESS 594*/ 10510: } 10511: 10512: /* ARGSUSED */ 10513: void 10514: TieSuggestReplot(w, client, call) 10515: Widget w; 10516: XtPointer client; 10517: XtPointer call; 10518: { 10519: /*SUPPRESS 594*/ 10520: } 10521: 10522: 10523: /* Function Name: BxPopupCB 10524: * 10525: * Description: This function accepts a string of the form: 10526: * "(WL)[widgetName, widgetName, ...]" 10527: * It attempts to convert the widget names to Widget IDs 10528: * and then popup the widgets WITHOUT any grab. 10529: * 10530: * Arguments: Widget w: the activating widget. 10531: * XtPointer client: the string of widget names to 10532: * popup. 10533: * XtPointer call: the call data (unused). 10534: * 10535: * Notes: * This function expects that there is an application 10536: * shell from which all other widgets are descended. 10537: * * BxPopupCB can only work on Shell widgets. It will not 10538: * work on other object types. This is because popping up 10539: * can only be done to a shell. A check is made using 10540: * XtIsShell() and an appropriate error is output if the 10541: * passed object is not a Shell. 10542: */ 10543: 10544: /* ARGSUSED */ 10545: void 10546: BxPopupCB ARGLIST((w, client, call)) 10547: ARG( Widget, w) 10548: ARG( XtPointer, client) 10549: GRAU( XtPointer, call) 10550: { 10551: WidgetList widgets; 10552: int i; 10553: 10554: /* 10555: * This function returns a NULL terminated WidgetList. The memory for 10556: * the list needs to be freed when it is no longer needed. 10557: */ 10558: widgets = BxWidgetIdsFromNames(w, "BxPopupCB", (String)client); 10559: 10560: i = 0; 10561: while( widgets && widgets[i] != NULL ) 10562: { 10563: if ( XtIsShell(widgets[i]) ) 10564: { 10565: XtPopup(widgets[i], XtGrabNone); 10566: } 10567: else 10568: { 10569: (void)printf("Callback Error (BxPopupCB):\n\t\ 10570: Object %s is not a Shell\n", XtName(widgets[i])); 10571: } 10572: i++; 10573: } 10574: XtFree((char *)widgets); 10575: } 10576: 10577: /* ARGSUSED */ 10578: void 10579: DisplayDepthScale(w, client, call) 10580: Widget w; 10581: XtPointer client; 10582: XtPointer call; 10583: { 10584: /*SUPPRESS 594*/ 10585: 10586: int err; 10587: int GetDisplayValues(); 10588: void DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 10589: 10590: err = GetDisplayValues(dset); 10591: 10592: if(err == 0){ 10593: reason_for_redraw = DISPLAY_CHANGE; 10594: if(XtIsManaged(XtParent(drawingAreaEdit))) { 10595: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 10596: } 10597: if(XtIsManaged(XtParent(drawingAreaView))) { 10598: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 10599: } 10600: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 10601: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 10602: } 10603: } 10604: } 10605: 10606: /* ARGSUSED */ 10607: void 10608: DisplayDepthTic(w, client, call) 10609: Widget w; 10610: XtPointer client; 10611: XtPointer call; 10612: { 10613: /*SUPPRESS 594*/ 10614: 10615: int err; 10616: int GetDisplayValues(); 10617: void DrawDrawingAreaEdit(), DrawDrawingAreaView(); 10618: 10619: err = GetDisplayValues(dset); 10620: 10621: if(err == 0){ 10622: reason_for_redraw = DISPLAY_CHANGE; 10623: if(XtIsManaged(XtParent(drawingAreaEdit))) { 10624: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 10625: } 10626: if(XtIsManaged(XtParent(drawingAreaView))) { 10627: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 10628: } 10629: } 10630: } 10631: 10632: /* ARGSUSED */ 10633: void 10634: DisplayVarAxisLen(w, client, call) 10635: Widget w; 10636: XtPointer client; 10637: XtPointer call; 10638: { 10639: /*SUPPRESS 594*/ 10640: 10641: int err; 10642: int GetDisplayValues(); 10643: void DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 10644: 10645: err = GetDisplayValues(dset); 10646: 10647: if(err == 0){ 10648: if(have_data == DO){ 10649: reason_for_redraw = DISPLAY_CHANGE; 10650: if(XtIsManaged(XtParent(drawingAreaEdit))) { 10651: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 10652: } 10653: } 10654: if(have_splice == DO){ 10655: if(XtIsManaged(XtParent(drawingAreaView))) { 10656: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 10657: } 10658: } 10659: if(have_splicetoage == DO) { 10660: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 10661: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 10662: } 10663: } 10664: } 10665: } 10666: 10667: /* ARGSUSED */ 10668: void 10669: DisplayVarMin(w, client, call) 10670: Widget w; 10671: XtPointer client; 10672: XtPointer call; 10673: { 10674: /*SUPPRESS 594*/ 10675: 10676: int err; 10677: int GetDisplayValues(); 10678: void DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 10679: 10680: err = GetDisplayValues(dset); 10681: 10682: if(err == 0){ 10683: if(have_data == DO){ 10684: reason_for_redraw = DISPLAY_CHANGE; 10685: if(XtIsManaged(XtParent(drawingAreaEdit))) { 10686: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 10687: } 10688: } 10689: if(have_splice == DO){ 10690: if(XtIsManaged(XtParent(drawingAreaView))) { 10691: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 10692: } 10693: } 10694: if(have_splicetoage == DO) { 10695: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 10696: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 10697: } 10698: } 10699: } 10700: } 10701: 10702: /* ARGSUSED */ 10703: void 10704: DisplayVarMax(w, client, call) 10705: Widget w; 10706: XtPointer client; 10707: XtPointer call; 10708: { 10709: /*SUPPRESS 594*/ 10710: 10711: int err; 10712: int GetDisplayValues(); 10713: void DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaSpliceToAge(); 10714: 10715: err = GetDisplayValues(dset); 10716: 10717: if(err == 0){ 10718: reason_for_redraw = DISPLAY_CHANGE; 10719: if(have_data == DO){ 10720: if(XtIsManaged(XtParent(drawingAreaEdit))) { 10721: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 10722: } 10723: } 10724: if(have_splice == DO){ 10725: if(XtIsManaged(XtParent(drawingAreaView))) { 10726: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 10727: } 10728: } 10729: if(have_splicetoage == DO) { 10730: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 10731: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 10732: } 10733: } 10734: } 10735: } 10736: 10737: /* ARGSUSED */ 10738: void 10739: LockSlider(w, client, call) 10740: Widget w; 10741: XtPointer client; 10742: XtPointer call; 10743: { 10744: /*SUPPRESS 594*/ 10745: 10746: void DisplaySliderControl(); 10747: 10748: DisplaySliderControl(1); 10749: } 10750: 10751: /* ARGSUSED */ 10752: void 10753: TextReportDown(w, client, call) 10754: Widget w; 10755: XtPointer client; 10756: XtPointer call; 10757: { 10758: /*SUPPRESS 594*/ 10759: 10760: XmString xmstring; 10761: 10762: xmstring=XmCvtCTToXmString("View Report"); 10763: XtVaSetValues(pushButtonViewReport,XmNlabelString,xmstring,NULL); 10764: XmStringFree(xmstring); 10765: } 10766: 10767: /* ARGSUSED */ 10768: void 10769: TextReportUp(w, client, call) 10770: Widget w; 10771: XtPointer client; 10772: XtPointer call; 10773: { 10774: /*SUPPRESS 594*/ 10775: 10776: XmString xmstring; 10777: 10778: xmstring=XmCvtCTToXmString("Hide Report"); 10779: XtVaSetValues(pushButtonViewReport,XmNlabelString,xmstring,NULL); 10780: XmStringFree(xmstring); 10781: } 10782: 10783: /* ARGSUSED */ 10784: void 10785: TextReportCreate(w, client, call) 10786: Widget w; 10787: XtPointer client; 10788: XtPointer call; 10789: { 10790: /*SUPPRESS 594*/ 10791: 10792: } 10793: 10794: /* ARGSUSED */ 10795: void 10796: TextReportDestroy(w, client, call) 10797: Widget w; 10798: XtPointer client; 10799: XtPointer call; 10800: { 10801: /*SUPPRESS 594*/ 10802: printf("report destroyed\n"); 10803: } 10804: 10805: /* ARGSUSED */ 10806: void 10807: DrawDepthOffsetCreate(w, client, call) 10808: Widget w; 10809: XtPointer client; 10810: XtPointer call; 10811: { 10812: /*SUPPRESS 594*/ 10813: } 10814: 10815: /* ARGSUSED */ 10816: void 10817: DrawDepthOffsetDestroy(w, client, call) 10818: Widget w; 10819: XtPointer client; 10820: XtPointer call; 10821: { 10822: /*SUPPRESS 594*/ 10823: } 10824: 10825: /* ARGSUSED */ 10826: void 10827: DrawDepthOffsetDown(w, client, call) 10828: Widget w; 10829: XtPointer client; 10830: XtPointer call; 10831: { 10832: /*SUPPRESS 594*/ 10833: } 10834: 10835: /* ARGSUSED */ 10836: void 10837: DrawDepthOffsetUp(w, client, call) 10838: Widget w; 10839: XtPointer client; 10840: XtPointer call; 10841: { 10842: /*SUPPRESS 594*/ 10843: } 10844: 10845: /* ARGSUSED */ 10846: void 10847: Splicing(w, client, call) 10848: Widget w; 10849: XtPointer client; 10850: XtPointer call; 10851: { 10852: /*SUPPRESS 594*/ 10853: 10854: 10855: char string[50]; 10856: char *pclient = (char*) client; 10857: XmString xmstring; 10858: 10859: XtManageChild(formSplicing); 10860: XtPopup(XtParent(formSplicing),XtGrabNone); 10861: 10862: have_spcorr = DONT; 10863: have_core_to_splice = DONT; 10864: have_splice_tie = DONT; 10865: have_splice_shift = DONT; 10866: last_sp_tie = NONE; 10867: have_sp_tie1 = DONT; 10868: have_sp_tie2 = DONT; 10869: splice_how = NONE; 10870: 10871: if(*pclient == 'C') { 10872: are_splicing = CONSTRAINED; 10873: XtVaSetValues(xmDialogShellSplicing, XmNtitle, "Splicing: Constrained", NULL); 10874: } 10875: else if(*pclient == 'U') { 10876: are_splicing = UNCONSTRAINED; 10877: XtVaSetValues(xmDialogShellSplicing, XmNtitle, "Splicing: Unconstrained", NULL); 10878: } 10879: else { 10880: (void)sprintf(buffer, "Unknown splicing style. cannot proceed."); 10881: SpManageWarningBox(buffer); 10882: return; 10883: } 10884: 10885: /* set the window length and lead,lag to the defaults 10886: */ 10887: (void)sprintf(string, "%.2f", WINLEN); 10888: XtVaSetValues(textCompWindowLen, XmNvalue, string, NULL); 10889: (void)sprintf(string, "%.2f", LEADLAG); 10890: XtVaSetValues(textCompLeadLag, XmNvalue, string, NULL); 10891: 10892: /* make sure the ties, depth step and selected core text 10893: are clear 10894: */ 10895: (void)sprintf(string, ""); 10896: XtVaSetValues(textCompSelectHole, XmNvalue, string, NULL); 10897: XtVaSetValues(textCompSelectCore, XmNvalue, string, NULL); 10898: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 10899: xmstring = XmStringCreateSimple(string); 10900: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 10901: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 10902: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 10903: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 10904: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 10905: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 10906: XtVaSetValues(labelSpliceDifferenceInValue,XmNlabelString, xmstring, NULL); 10907: XmStringFree(xmstring); 10908: 10909: if(are_splicing == CONSTRAINED) { 10910: XtVaSetValues(pushButtonSuggestTies, XmNmappedWhenManaged, False, NULL); 10911: } 10912: else if(are_splicing == UNCONSTRAINED) { 10913: XtVaSetValues(pushButtonSuggestTies, XmNmappedWhenManaged, True, NULL); 10914: } 10915: 10916: /* set all buttons except dismiss and grab insensitive 10917: and undo last if have a splice 10918: */ 10919: if(have_data == DONT){ 10920: XtSetSensitive(pushButtonGetSelectCore, False); 10921: } 10922: else if(have_data == DO){ 10923: XtSetSensitive(pushButtonGetSelectCore, True); 10924: } 10925: XtSetSensitive(pushButtonClearGrab, False); 10926: XtSetSensitive(pushButtonSpliceClearTie, False); 10927: XtSetSensitive(pushButtonSpliceCorrelate, False); 10928: XtSetSensitive(pushButtonSpliceToTie, False); 10929: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 10930: XtSetSensitive(pushButtonAppendSplice, False); 10931: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 10932: if(have_splice == DONT){ 10933: XtSetSensitive(pushButtonSpliceUndoLast, False); 10934: } 10935: else if(have_splice == DO){ 10936: XtSetSensitive(pushButtonSpliceUndoLast, True); 10937: } 10938: 10939: PlaceDialog(formSplicing, BOTLEFT); 10940: 10941: (void)sprintf(string, ""); 10942: 10943: } 10944: 10945: /* ARGSUSED */ 10946: void 10947: ApplyAffineSplice(w, client, call) 10948: Widget w; 10949: XtPointer client; 10950: XtPointer call; 10951: { 10952: /*SUPPRESS 594*/ 10953: 10954: if((message.label=(char*)calloc(100,CHAR_SIZE))==NULL) 10955: SpBadMemAlloc("Sp"); 10956: (void)sprintf(message.label,"This Option is incomplete."); 10957: SpManageMessage(message); 10958: } 10959: 10960: /* ARGSUSED */ 10961: void 10962: ScaleDragYes(w, client, call) 10963: Widget w; 10964: XtPointer client; 10965: XtPointer call; 10966: { 10967: /*SUPPRESS 594*/ 10968: } 10969: 10970: /* ARGSUSED */ 10971: void 10972: ScaleDragNo(w, client, call) 10973: Widget w; 10974: XtPointer client; 10975: XtPointer call; 10976: { 10977: /*SUPPRESS 594*/ 10978: } 10979: 10980: /* ARGSUSED */ 10981: void 10982: ScaleCoreChanged(w, client, call) 10983: Widget w; 10984: XtPointer client; 10985: XtPointer call; 10986: { 10987: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 10988: 10989: void DrawDRawingAreaEdit(); 10990: 10991: if(XtIsManaged(XtParent(drawingAreaEdit))) { 10992: reason_for_redraw = DRAW_EVERYTHING; 10993: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 10994: } 10995: } 10996: 10997: /* ARGSUSED */ 10998: void 10999: ScaleCoreDragged(w, client, call) 11000: Widget w; 11001: XtPointer client; 11002: XtPointer call; 11003: { 11004: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11005: 11006: void DrawDRawingAreaEdit(); 11007: 11008: if(XtIsManaged(XtParent(drawingAreaEdit))) { 11009: reason_for_redraw = DRAW_EVERYTHING; 11010: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 11011: } 11012: } 11013: 11014: 11015: /* ARGSUSED */ 11016: void 11017: CustomeColorDismiss(w, client, call) 11018: Widget w; 11019: XtPointer client; 11020: XtPointer call; 11021: { 11022: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11023: 11024: int i; 11025: void DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaTieCorrelation(), 11026: DrawDrawingAreaCompCorrelation(), DrawDrawingAreaDepthOffset(); 11027: 11028: (void)sprintf(color[BG_COLOR], "%s", tempcolor[BG_COLOR]); 11029: if(colorset == CUSTOME_COLORSET) { 11030: (void)sprintf(cust_color[BG_COLOR], "%s", tempcolor[BG_COLOR]); 11031: } 11032: bgPixel = tempbgPixel; 11033: for(i=1; i<NCOLOR; ++i) { 11034: fgPixel[i] = tempfgPixel[i]; 11035: (void)sprintf(color[i], "%s", tempcolor[i]); 11036: if(colorset == CUSTOME_COLORSET) { 11037: (void)sprintf(cust_color[i], "%s", tempcolor[i]); 11038: } 11039: } 11040: 11041: XtVaSetValues(drawingAreaEdit, XmNbackground, bgPixel, NULL); 11042: XtVaSetValues(drawingAreaView, XmNbackground, bgPixel, NULL); 11043: XtVaSetValues(drawingAreaTieCorrelation, XmNbackground, bgPixel, NULL); 11044: XtVaSetValues(drawingAreaCompCorrelation, XmNbackground, bgPixel, NULL); 11045: XtVaSetValues(drawingAreaDepthOffset, XmNbackground, bgPixel, NULL); 11046: XtVaSetValues(drawingAreaAgeDepth, XmNbackground, bgPixel, NULL); 11047: XtVaSetValues(drawingAreaSpliceToAge, XmNbackground, bgPixel, NULL); 11048: XtVaSetValues(drawingAreaTieToTimeSeriesCorr, XmNbackground, bgPixel, NULL); 11049: 11050: /* set the border color of labels for cursor location and ties to 11051: the drawing areas background color 11052: */ 11053: XtVaSetValues(labelCursorLocation, XmNborderColor, bgPixel, NULL); 11054: XtVaSetValues(labelDepthOffsetCursorLocation, XmNborderColor, bgPixel, NULL); 11055: XtVaSetValues(labelSpliceCursorLocation, XmNborderColor, bgPixel, NULL); 11056: XtVaSetValues(labelAgeDepthCursorLocation, XmNborderColor, bgPixel, NULL); 11057: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNborderColor, bgPixel, NULL); 11058: XtVaSetValues(labelTie1ID, XmNborderColor, bgPixel, NULL); 11059: XtVaSetValues(labelTie2ID, XmNborderColor, bgPixel, NULL); 11060: XtVaSetValues(labelTie1var, XmNborderColor, bgPixel, NULL); 11061: XtVaSetValues(labelTie2var, XmNborderColor, bgPixel, NULL); 11062: XtVaSetValues(labelTie1sbd, XmNborderColor, bgPixel, NULL); 11063: XtVaSetValues(labelTie2sbd, XmNborderColor, bgPixel, NULL); 11064: XtVaSetValues(labelSpliceTie1ID, XmNborderColor, bgPixel, NULL); 11065: XtVaSetValues(labelSpliceTie2ID, XmNborderColor, bgPixel, NULL); 11066: XtVaSetValues(labelSpliceTie1var, XmNborderColor, bgPixel, NULL); 11067: XtVaSetValues(labelSpliceTie2var, XmNborderColor, bgPixel, NULL); 11068: XtVaSetValues(labelSpliceTie1sbd, XmNborderColor, bgPixel, NULL); 11069: XtVaSetValues(labelSpliceTie2sbd, XmNborderColor, bgPixel, NULL); 11070: XtVaSetValues(labelSpliceDifferenceInValue, XmNborderColor, bgPixel, NULL); 11071: 11072: /* if no foreground and or background color were read on command line args 11073: set the colors for hsplicer foreground and background to the drawing 11074: area background and labels 11075: */ 11076: if(prgfg == NO || prgbg == NO) { 11077: (void)sprintf(prgfgcolor, ""); 11078: (void)sprintf(prgfgcolor, color[LABEL_COLOR]); 11079: (void)sprintf(prgbgcolor, ""); 11080: (void)sprintf(prgbgcolor, color[BG_COLOR]); 11081: } 11082: 11083: reason_for_redraw = DRAW_EVERYTHING; 11084: if(XtIsManaged(XtParent(drawingAreaEdit))) { 11085: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 11086: } 11087: if(XtIsManaged(XtParent(drawingAreaView))) { 11088: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 11089: } 11090: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 11091: DrawDrawingAreaTieCorrelation(drawingAreaTieCorrelation, (XtPointer)NULL, (XtPointer)NULL); 11092: } 11093: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 11094: DrawDrawingAreaCompCorrelation(drawingAreaCompCorrelation, (XtPointer)NULL, (XtPointer)NULL); 11095: } 11096: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 11097: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 11098: } 11099: 11100: XtUnmanageChild(formSetColor); 11101: } 11102: 11103: 11104: /* ARGSUSED */ 11105: void 11106: ColorSelected(w, client, call) 11107: Widget w; 11108: XtPointer client; 11109: XtPointer call; 11110: { 11111: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11112: 11113: int item_count; 11114: char *rgbcolor; 11115: XmString *pcolor; 11116: Pixel sampPixel; 11117: int GetColorPixelValue(); 11118: 11119: /* get the selected color name from the list 11120: */ 11121: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11122: XmNselectedItems,&pcolor, NULL); 11123: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11124: 11125: /* and change the background color of the color display area 11126: */ 11127: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11128: XtVaSetValues(drawingAreaColorSelect, XmNbackground, sampPixel, NULL); 11129: XtFree(rgbcolor); 11130: } 11131: 11132: /* ARGSUSED */ 11133: void 11134: ColorApply(w, client, call) 11135: Widget w; 11136: XtPointer client; 11137: XtPointer call; 11138: { 11139: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11140: 11141: int i; 11142: void DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaTieCorrelation(), 11143: DrawDrawingAreaCompCorrelation(), DrawDrawingAreaDepthOffset(), 11144: DrawDrawingAreaAgeDepth(), DrawDrawingAreaSpliceToAge(), SetColorSetBGandFG(); 11145: 11146: (void)sprintf(color[BG_COLOR], "%s", tempcolor[BG_COLOR]); 11147: if(colorset == CUSTOME_COLORSET) { 11148: (void)sprintf(cust_color[BG_COLOR], "%s", tempcolor[BG_COLOR]); 11149: } 11150: bgPixel = tempbgPixel; 11151: for(i=1; i<NCOLOR; ++i) { 11152: fgPixel[i] = tempfgPixel[i]; 11153: (void)sprintf(color[i], "%s", tempcolor[i]); 11154: if(colorset == CUSTOME_COLORSET) { 11155: (void)sprintf(cust_color[i], "%s", tempcolor[i]); 11156: } 11157: } 11158: (void)SetColorSetBGandFG(); 11159: 11160: XtVaSetValues(drawingAreaEdit, XmNbackground, bgPixel, NULL); 11161: XtVaSetValues(drawingAreaView, XmNbackground, bgPixel, NULL); 11162: XtVaSetValues(drawingAreaTieCorrelation, XmNbackground, bgPixel, NULL); 11163: XtVaSetValues(drawingAreaCompCorrelation, XmNbackground, bgPixel, NULL); 11164: XtVaSetValues(drawingAreaDepthOffset, XmNbackground, bgPixel, NULL); 11165: XtVaSetValues(drawingAreaAgeDepth, XmNbackground, bgPixel, NULL); 11166: XtVaSetValues(drawingAreaSpliceToAge, XmNbackground, bgPixel, NULL); 11167: XtVaSetValues(drawingAreaTieToTimeSeriesCorr, XmNbackground, bgPixel, NULL); 11168: 11169: /* set the border color of labels for cursor location and ties to 11170: the drawing areas background color 11171: */ 11172: XtVaSetValues(labelCursorLocation, XmNborderColor, bgPixel, NULL); 11173: XtVaSetValues(labelDepthOffsetCursorLocation, XmNborderColor, bgPixel, NULL); 11174: XtVaSetValues(labelSpliceCursorLocation, XmNborderColor, bgPixel, NULL); 11175: XtVaSetValues(labelAgeDepthCursorLocation, XmNborderColor, bgPixel, NULL); 11176: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNborderColor, bgPixel, NULL); 11177: XtVaSetValues(labelTie1ID, XmNborderColor, bgPixel, NULL); 11178: XtVaSetValues(labelTie2ID, XmNborderColor, bgPixel, NULL); 11179: XtVaSetValues(labelTie1var, XmNborderColor, bgPixel, NULL); 11180: XtVaSetValues(labelTie2var, XmNborderColor, bgPixel, NULL); 11181: XtVaSetValues(labelTie1sbd, XmNborderColor, bgPixel, NULL); 11182: XtVaSetValues(labelTie2sbd, XmNborderColor, bgPixel, NULL); 11183: XtVaSetValues(labelSpliceTie1ID, XmNborderColor, bgPixel, NULL); 11184: XtVaSetValues(labelSpliceTie2ID, XmNborderColor, bgPixel, NULL); 11185: XtVaSetValues(labelSpliceTie1var, XmNborderColor, bgPixel, NULL); 11186: XtVaSetValues(labelSpliceTie2var, XmNborderColor, bgPixel, NULL); 11187: XtVaSetValues(labelSpliceTie1sbd, XmNborderColor, bgPixel, NULL); 11188: XtVaSetValues(labelSpliceTie2sbd, XmNborderColor, bgPixel, NULL); 11189: XtVaSetValues(labelSpliceDifferenceInValue, XmNborderColor, bgPixel, NULL); 11190: 11191: /* if no foreground and or background color were read on command line args 11192: set the colors for hsplicer foreground and background to the drawing 11193: area background and labels 11194: */ 11195: if(prgfg == NO || prgbg == NO) { 11196: (void)sprintf(prgfgcolor, ""); 11197: (void)sprintf(prgfgcolor, color[LABEL_COLOR]); 11198: (void)sprintf(prgbgcolor, ""); 11199: (void)sprintf(prgbgcolor, color[BG_COLOR]); 11200: } 11201: 11202: 11203: reason_for_redraw = DRAW_EVERYTHING; 11204: if(XtIsManaged(XtParent(drawingAreaEdit))) { 11205: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 11206: } 11207: if(XtIsManaged(XtParent(drawingAreaView))) { 11208: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 11209: } 11210: if(XtIsManaged(XtParent(drawingAreaTieCorrelation))) { 11211: DrawDrawingAreaTieCorrelation(drawingAreaTieCorrelation, (XtPointer)NULL, (XtPointer)NULL); 11212: } 11213: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 11214: DrawDrawingAreaCompCorrelation(drawingAreaCompCorrelation, (XtPointer)NULL, (XtPointer)NULL); 11215: } 11216: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 11217: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 11218: } 11219: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 11220: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 11221: } 11222: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 11223: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 11224: } 11225: } 11226: 11227: /* ARGSUSED */ 11228: void 11229: ColorDrawingAreaBG(w, client, call) 11230: Widget w; 11231: XtPointer client; 11232: XtPointer call; 11233: { 11234: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11235: 11236: int item_count; 11237: char *rgbcolor; 11238: XmString *pcolor; 11239: Pixel sampPixel; 11240: int GetColorPixelValue(); 11241: void SetCustomeColorWidgetBGColors(); 11242: 11243: /* get the selected color name from the list 11244: */ 11245: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11246: XmNselectedItems,&pcolor, NULL); 11247: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11248: 11249: /* and change the color of the core label button 11250: */ 11251: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11252: XtVaSetValues(pushButtonDrawingAreaColorBG, XmNbackground, sampPixel, NULL); 11253: XtVaSetValues(pushButtonDrawingAreaColorBG, XmNlabelString, pcolor[0], NULL); 11254: (void)sprintf(tempcolor[BG_COLOR], "%s", rgbcolor); 11255: tempbgPixel = sampPixel; 11256: XtFree(rgbcolor); 11257: 11258: /* set the row-column background color 11259: */ 11260: SetCustomeColorWidgetBGColors(sampPixel); 11261: } 11262: 11263: /* ARGSUSED */ 11264: void 11265: ColorDrawingAreaLabels(w, client, call) 11266: Widget w; 11267: XtPointer client; 11268: XtPointer call; 11269: { 11270: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11271: 11272: int item_count; 11273: char *rgbcolor; 11274: XmString *pcolor; 11275: Pixel sampPixel; 11276: int GetColorPixelValue(); 11277: void SetCustomeColorWidgetFGColors(); 11278: 11279: /* get the selected color name from the list 11280: */ 11281: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11282: XmNselectedItems,&pcolor, NULL); 11283: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11284: 11285: /* and change the color of the core label button 11286: */ 11287: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11288: XtVaSetValues(pushButtonDrawingAreaColorLabels, XmNbackground, sampPixel, NULL); 11289: 11290: XtVaSetValues(pushButtonDrawingAreaColorLabels, XmNlabelString, pcolor[0], NULL); 11291: (void)sprintf(tempcolor[LABEL_COLOR], "%s", rgbcolor); 11292: tempfgPixel[LABEL_COLOR] = sampPixel; 11293: XtFree(rgbcolor); 11294: 11295: /* set the row-column label colors 11296: */ 11297: SetCustomeColorWidgetFGColors(sampPixel); 11298: } 11299: 11300: /* ARGSUSED */ 11301: void 11302: ColorCorembsf(w, client, call) 11303: Widget w; 11304: XtPointer client; 11305: XtPointer call; 11306: { 11307: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11308: 11309: int item_count; 11310: char *rgbcolor; 11311: XmString *pcolor; 11312: Pixel sampPixel; 11313: int GetColorPixelValue(); 11314: 11315: /* get the selected color name from the list 11316: */ 11317: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11318: XmNselectedItems,&pcolor, NULL); 11319: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11320: 11321: /* and change the color of the core label button 11322: */ 11323: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11324: XtVaSetValues(pushButtonColorCorembsf, XmNbackground, sampPixel, NULL); 11325: 11326: XtVaSetValues(pushButtonColorCorembsf, XmNlabelString, pcolor[0], NULL); 11327: (void)sprintf(tempcolor[MBSF_COLOR], "%s", rgbcolor); 11328: tempfgPixel[MBSF_COLOR] = sampPixel; 11329: XtFree(rgbcolor); 11330: } 11331: 11332: /* ARGSUSED */ 11333: void 11334: ColorCoremcd(w, client, call) 11335: Widget w; 11336: XtPointer client; 11337: XtPointer call; 11338: { 11339: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11340: 11341: int item_count; 11342: char *rgbcolor; 11343: XmString *pcolor; 11344: Pixel sampPixel; 11345: int GetColorPixelValue(); 11346: 11347: /* get the selected color name from the list 11348: */ 11349: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11350: XmNselectedItems,&pcolor, NULL); 11351: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11352: 11353: /* and change the color of the core label button 11354: */ 11355: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11356: XtVaSetValues(pushButtonColorCoremcd, XmNbackground, sampPixel, NULL); 11357: 11358: XtVaSetValues(pushButtonColorCoremcd, XmNlabelString, pcolor[0], NULL); 11359: (void)sprintf(tempcolor[MCD_COLOR], "%s", rgbcolor); 11360: tempfgPixel[MCD_COLOR] = sampPixel; 11361: XtFree(rgbcolor); 11362: } 11363: 11364: /* ARGSUSED */ 11365: void 11366: ColorSmooth(w, client, call) 11367: Widget w; 11368: XtPointer client; 11369: XtPointer call; 11370: { 11371: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11372: 11373: int item_count; 11374: char *rgbcolor; 11375: XmString *pcolor; 11376: Pixel sampPixel; 11377: int GetColorPixelValue(); 11378: 11379: /* get the selected color name from the list 11380: */ 11381: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11382: XmNselectedItems,&pcolor, NULL); 11383: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11384: 11385: /* and change the color of the core label button 11386: */ 11387: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11388: XtVaSetValues(pushButtonColorSmooth, XmNbackground, sampPixel, NULL); 11389: 11390: XtVaSetValues(pushButtonColorSmooth, XmNlabelString, pcolor[0], NULL); 11391: (void)sprintf(tempcolor[SMOOTH_COLOR], "%s", rgbcolor); 11392: tempfgPixel[SMOOTH_COLOR] = sampPixel; 11393: XtFree(rgbcolor); 11394: } 11395: 11396: /* ARGSUSED */ 11397: void 11398: ColorSplice(w, client, call) 11399: Widget w; 11400: XtPointer client; 11401: XtPointer call; 11402: { 11403: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11404: 11405: int item_count; 11406: char *rgbcolor; 11407: XmString *pcolor; 11408: Pixel sampPixel; 11409: int GetColorPixelValue(); 11410: 11411: /* get the selected color name from the list 11412: */ 11413: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11414: XmNselectedItems,&pcolor, NULL); 11415: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11416: 11417: /* and change the color of the core label button 11418: */ 11419: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11420: XtVaSetValues(pushButtonColorSplice, XmNbackground, sampPixel, NULL); 11421: 11422: XtVaSetValues(pushButtonColorSplice, XmNlabelString, pcolor[0], NULL); 11423: (void)sprintf(tempcolor[SPLICE_COLOR], "%s", rgbcolor); 11424: tempfgPixel[SPLICE_COLOR] = sampPixel; 11425: XtFree(rgbcolor); 11426: } 11427: 11428: /* ARGSUSED */ 11429: void 11430: ColorSpliceLocation(w, client, call) 11431: Widget w; 11432: XtPointer client; 11433: XtPointer call; 11434: { 11435: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11436: 11437: int item_count; 11438: char *rgbcolor; 11439: XmString *pcolor; 11440: Pixel sampPixel; 11441: int GetColorPixelValue(); 11442: 11443: /* get the selected color name from the list 11444: */ 11445: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11446: XmNselectedItems,&pcolor, NULL); 11447: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11448: 11449: /* and change the color of the core label button 11450: */ 11451: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11452: XtVaSetValues(pushButtonColorSpliceLocation, XmNbackground, sampPixel, NULL); 11453: 11454: XtVaSetValues(pushButtonColorSpliceLocation, XmNlabelString, pcolor[0], NULL); 11455: (void)sprintf(tempcolor[SPLICELOCATION_COLOR], "%s", rgbcolor); 11456: tempfgPixel[SPLICELOCATION_COLOR] = sampPixel; 11457: XtFree(rgbcolor); 11458: } 11459: 11460: /* ARGSUSED */ 11461: void 11462: ColorTiePtFixed(w, client, call) 11463: Widget w; 11464: XtPointer client; 11465: XtPointer call; 11466: { 11467: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11468: 11469: int item_count; 11470: char *rgbcolor; 11471: XmString *pcolor; 11472: Pixel sampPixel; 11473: int GetColorPixelValue(); 11474: 11475: /* get the selected color name from the list 11476: */ 11477: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11478: XmNselectedItems,&pcolor, NULL); 11479: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11480: 11481: /* and change the color of the core label button 11482: */ 11483: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11484: XtVaSetValues(pushButtonColorTiePtFixed, XmNbackground, sampPixel, NULL); 11485: 11486: XtVaSetValues(pushButtonColorTiePtFixed, XmNlabelString, pcolor[0], NULL); 11487: (void)sprintf(tempcolor[TIEPTFIXED_COLOR], "%s", rgbcolor); 11488: tempfgPixel[TIEPTFIXED_COLOR] = sampPixel; 11489: XtFree(rgbcolor); 11490: } 11491: 11492: /* ARGSUSED */ 11493: void 11494: ColorTieLine(w, client, call) 11495: Widget w; 11496: XtPointer client; 11497: XtPointer call; 11498: { 11499: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11500: 11501: int item_count; 11502: char *rgbcolor; 11503: XmString *pcolor; 11504: Pixel sampPixel; 11505: int GetColorPixelValue(); 11506: 11507: /* get the selected color name from the list 11508: */ 11509: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11510: XmNselectedItems,&pcolor, NULL); 11511: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11512: 11513: /* and change the color of the core label button 11514: */ 11515: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11516: XtVaSetValues(pushButtonColorTieLine, XmNbackground, sampPixel, NULL); 11517: 11518: XtVaSetValues(pushButtonColorTieLine, XmNlabelString, pcolor[0], NULL); 11519: (void)sprintf(tempcolor[TIELINE_COLOR], "%s", rgbcolor); 11520: tempfgPixel[TIELINE_COLOR] = sampPixel; 11521: XtFree(rgbcolor); 11522: } 11523: 11524: /* ARGSUSED */ 11525: void 11526: ColorOverlayInCorr(w, client, call) 11527: Widget w; 11528: XtPointer client; 11529: XtPointer call; 11530: { 11531: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11532: 11533: int item_count; 11534: char *rgbcolor; 11535: XmString *pcolor; 11536: Pixel sampPixel; 11537: int GetColorPixelValue(); 11538: 11539: /* get the selected color name from the list 11540: */ 11541: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11542: XmNselectedItems,&pcolor, NULL); 11543: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11544: 11545: /* and change the color of the core label button 11546: */ 11547: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11548: XtVaSetValues(pushButtonColorOverlayInCorr, XmNbackground, sampPixel, NULL); 11549: 11550: XtVaSetValues(pushButtonColorOverlayInCorr, XmNlabelString, pcolor[0], NULL); 11551: (void)sprintf(tempcolor[OVERLAYINCORR_COLOR], "%s", rgbcolor); 11552: tempfgPixel[OVERLAYINCORR_COLOR] = sampPixel; 11553: XtFree(rgbcolor); 11554: } 11555: 11556: /* ARGSUSED */ 11557: void 11558: ColorOverlayOutCorr(w, client, call) 11559: Widget w; 11560: XtPointer client; 11561: XtPointer call; 11562: { 11563: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11564: 11565: int item_count; 11566: char *rgbcolor; 11567: XmString *pcolor; 11568: Pixel sampPixel; 11569: int GetColorPixelValue(); 11570: 11571: /* get the selected color name from the list 11572: */ 11573: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11574: XmNselectedItems,&pcolor, NULL); 11575: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11576: 11577: /* and change the color of the core label button 11578: */ 11579: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11580: XtVaSetValues(pushButtonColorOverlayOutCorr, XmNbackground, sampPixel, NULL); 11581: 11582: XtVaSetValues(pushButtonColorOverlayOutCorr, XmNlabelString, pcolor[0], NULL); 11583: (void)sprintf(tempcolor[OVERLAYOUTCORR_COLOR], "%s", rgbcolor); 11584: tempfgPixel[OVERLAYOUTCORR_COLOR] = sampPixel; 11585: XtFree(rgbcolor); 11586: } 11587: 11588: /* ARGSUSED */ 11589: void 11590: ColorPaleomag(w, client, call) 11591: Widget w; 11592: XtPointer client; 11593: XtPointer call; 11594: { 11595: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11596: 11597: int item_count; 11598: char *rgbcolor; 11599: XmString *pcolor; 11600: Pixel sampPixel; 11601: int GetColorPixelValue(); 11602: 11603: /* get the selected color name from the list 11604: */ 11605: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11606: XmNselectedItems,&pcolor, NULL); 11607: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11608: 11609: /* and change the color of the core label button 11610: */ 11611: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11612: XtVaSetValues(pushButtonColorPaleomag, XmNbackground, sampPixel, NULL); 11613: 11614: XtVaSetValues(pushButtonColorPaleomag, XmNlabelString, pcolor[0], NULL); 11615: (void)sprintf(tempcolor[PALEOMAG_COLOR], "%s", rgbcolor); 11616: tempfgPixel[PALEOMAG_COLOR] = sampPixel; 11617: XtFree(rgbcolor); 11618: } 11619: 11620: /* ARGSUSED */ 11621: void 11622: ColorDiatom(w, client, call) 11623: Widget w; 11624: XtPointer client; 11625: XtPointer call; 11626: { 11627: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11628: 11629: int item_count; 11630: char *rgbcolor; 11631: XmString *pcolor; 11632: Pixel sampPixel; 11633: int GetColorPixelValue(); 11634: 11635: /* get the selected color name from the list 11636: */ 11637: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11638: XmNselectedItems,&pcolor, NULL); 11639: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11640: 11641: /* and change the color of the core label button 11642: */ 11643: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11644: XtVaSetValues(pushButtonColorDiatom, XmNbackground, sampPixel, NULL); 11645: 11646: XtVaSetValues(pushButtonColorDiatom, XmNlabelString, pcolor[0], NULL); 11647: (void)sprintf(tempcolor[DIATOM_COLOR], "%s", rgbcolor); 11648: tempfgPixel[DIATOM_COLOR] = sampPixel; 11649: XtFree(rgbcolor); 11650: } 11651: 11652: /* ARGSUSED */ 11653: void 11654: ColorRad(w, client, call) 11655: Widget w; 11656: XtPointer client; 11657: XtPointer call; 11658: { 11659: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11660: 11661: int item_count; 11662: char *rgbcolor; 11663: XmString *pcolor; 11664: Pixel sampPixel; 11665: int GetColorPixelValue(); 11666: 11667: /* get the selected color name from the list 11668: */ 11669: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11670: XmNselectedItems,&pcolor, NULL); 11671: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11672: 11673: /* and change the color of the core label button 11674: */ 11675: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11676: XtVaSetValues(pushButtonColorRad, XmNbackground, sampPixel, NULL); 11677: 11678: XtVaSetValues(pushButtonColorRad, XmNlabelString, pcolor[0], NULL); 11679: (void)sprintf(tempcolor[RAD_COLOR], "%s", rgbcolor); 11680: tempfgPixel[RAD_COLOR] = sampPixel; 11681: XtFree(rgbcolor); 11682: } 11683: 11684: /* ARGSUSED */ 11685: void 11686: ColorForam(w, client, call) 11687: Widget w; 11688: XtPointer client; 11689: XtPointer call; 11690: { 11691: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11692: 11693: int item_count; 11694: char *rgbcolor; 11695: XmString *pcolor; 11696: Pixel sampPixel; 11697: int GetColorPixelValue(); 11698: 11699: /* get the selected color name from the list 11700: */ 11701: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11702: XmNselectedItems,&pcolor, NULL); 11703: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11704: 11705: /* and change the color of the core label button 11706: */ 11707: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11708: XtVaSetValues(pushButtonColorForam, XmNbackground, sampPixel, NULL); 11709: 11710: XtVaSetValues(pushButtonColorForam, XmNlabelString, pcolor[0], NULL); 11711: (void)sprintf(tempcolor[FORAM_COLOR], "%s", rgbcolor); 11712: tempfgPixel[FORAM_COLOR] = sampPixel; 11713: XtFree(rgbcolor); 11714: } 11715: 11716: /* ARGSUSED */ 11717: void 11718: ColorNanno(w, client, call) 11719: Widget w; 11720: XtPointer client; 11721: XtPointer call; 11722: { 11723: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11724: 11725: int item_count; 11726: char *rgbcolor; 11727: XmString *pcolor; 11728: Pixel sampPixel; 11729: int GetColorPixelValue(); 11730: 11731: /* get the selected color name from the list 11732: */ 11733: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11734: XmNselectedItems,&pcolor, NULL); 11735: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11736: 11737: /* and change the color of the core label button 11738: */ 11739: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11740: XtVaSetValues(pushButtonColorNanno, XmNbackground, sampPixel, NULL); 11741: 11742: XtVaSetValues(pushButtonColorNanno, XmNlabelString, pcolor[0], NULL); 11743: (void)sprintf(tempcolor[NANNO_COLOR], "%s", rgbcolor); 11744: tempfgPixel[NANNO_COLOR] = sampPixel; 11745: XtFree(rgbcolor); 11746: } 11747: 11748: /* ARGSUSED */ 11749: void 11750: ColorCorrCoef(w, client, call) 11751: Widget w; 11752: XtPointer client; 11753: XtPointer call; 11754: { 11755: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11756: 11757: int item_count; 11758: char *rgbcolor; 11759: XmString *pcolor; 11760: Pixel sampPixel; 11761: int GetColorPixelValue(); 11762: 11763: /* get the selected color name from the list 11764: */ 11765: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11766: XmNselectedItems,&pcolor, NULL); 11767: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11768: 11769: /* and change the color of the core label button 11770: */ 11771: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11772: XtVaSetValues(pushButtonColorCorrCoef, XmNbackground, sampPixel, NULL); 11773: 11774: XtVaSetValues(pushButtonColorCorrCoef, XmNlabelString, pcolor[0], NULL); 11775: (void)sprintf(tempcolor[CORRCOEF_COLOR], "%s", rgbcolor); 11776: tempfgPixel[CORRCOEF_COLOR] = sampPixel; 11777: XtFree(rgbcolor); 11778: } 11779: 11780: /* ARGSUSED */ 11781: void 11782: ColorBestCorr(w, client, call) 11783: Widget w; 11784: XtPointer client; 11785: XtPointer call; 11786: { 11787: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11788: 11789: int item_count; 11790: char *rgbcolor; 11791: XmString *pcolor; 11792: Pixel sampPixel; 11793: int GetColorPixelValue(); 11794: 11795: /* get the selected color name from the list 11796: */ 11797: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11798: XmNselectedItems,&pcolor, NULL); 11799: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11800: 11801: /* and change the color of the core label button 11802: */ 11803: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11804: XtVaSetValues(pushButtonColorBestCorr, XmNbackground, sampPixel, NULL); 11805: 11806: XtVaSetValues(pushButtonColorBestCorr, XmNlabelString, pcolor[0], NULL); 11807: (void)sprintf(tempcolor[BESTCORR_COLOR], "%s", rgbcolor); 11808: tempfgPixel[BESTCORR_COLOR] = sampPixel; 11809: XtFree(rgbcolor); 11810: } 11811: 11812: /* ARGSUSED */ 11813: void 11814: ColorDepthOffsetLine(w, client, call) 11815: Widget w; 11816: XtPointer client; 11817: XtPointer call; 11818: { 11819: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11820: 11821: int item_count; 11822: char *rgbcolor; 11823: XmString *pcolor; 11824: Pixel sampPixel; 11825: int GetColorPixelValue(); 11826: 11827: /* get the selected color name from the list 11828: */ 11829: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11830: XmNselectedItems,&pcolor, NULL); 11831: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11832: 11833: /* and change the color of the core label button 11834: */ 11835: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11836: XtVaSetValues(pushButtonColorDepthOffsetLine, XmNbackground, sampPixel, NULL); 11837: 11838: XtVaSetValues(pushButtonColorDepthOffsetLine, XmNlabelString, pcolor[0], NULL); 11839: (void)sprintf(tempcolor[DEPOFFLINE_COLOR], "%s", rgbcolor); 11840: tempfgPixel[DEPOFFLINE_COLOR] = sampPixel; 11841: XtFree(rgbcolor); 11842: } 11843: 11844: /* ARGSUSED */ 11845: void 11846: ColorDepthOffsetHole1(w, client, call) 11847: Widget w; 11848: XtPointer client; 11849: XtPointer call; 11850: { 11851: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11852: 11853: int item_count; 11854: char *rgbcolor; 11855: XmString *pcolor; 11856: Pixel sampPixel; 11857: int GetColorPixelValue(); 11858: 11859: /* get the selected color name from the list 11860: */ 11861: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11862: XmNselectedItems,&pcolor, NULL); 11863: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11864: 11865: /* and change the color of the core label button 11866: */ 11867: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11868: XtVaSetValues(pushButtonColorDepthOffsetHole1, XmNbackground, sampPixel, NULL); 11869: 11870: XtVaSetValues(pushButtonColorDepthOffsetHole1, XmNlabelString, pcolor[0], NULL); 11871: (void)sprintf(tempcolor[DEPOFFHOLE1_COLOR], "%s", rgbcolor); 11872: tempfgPixel[DEPOFFHOLE1_COLOR] = sampPixel; 11873: XtFree(rgbcolor); 11874: } 11875: 11876: /* ARGSUSED */ 11877: void 11878: ColorDepthOffsetHole2(w, client, call) 11879: Widget w; 11880: XtPointer client; 11881: XtPointer call; 11882: { 11883: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11884: 11885: int item_count; 11886: char *rgbcolor; 11887: XmString *pcolor; 11888: Pixel sampPixel; 11889: int GetColorPixelValue(); 11890: 11891: /* get the selected color name from the list 11892: */ 11893: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11894: XmNselectedItems,&pcolor, NULL); 11895: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11896: 11897: /* and change the color of the core label button 11898: */ 11899: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11900: XtVaSetValues(pushButtonColorDepthOffsetHole2, XmNbackground, sampPixel, NULL); 11901: 11902: XtVaSetValues(pushButtonColorDepthOffsetHole2, XmNlabelString, pcolor[0], NULL); 11903: (void)sprintf(tempcolor[DEPOFFHOLE2_COLOR], "%s", rgbcolor); 11904: tempfgPixel[DEPOFFHOLE2_COLOR] = sampPixel; 11905: XtFree(rgbcolor); 11906: } 11907: 11908: /* ARGSUSED */ 11909: void 11910: ColorDepthOffsetHole3(w, client, call) 11911: Widget w; 11912: XtPointer client; 11913: XtPointer call; 11914: { 11915: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11916: 11917: int item_count; 11918: char *rgbcolor; 11919: XmString *pcolor; 11920: Pixel sampPixel; 11921: int GetColorPixelValue(); 11922: 11923: /* get the selected color name from the list 11924: */ 11925: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11926: XmNselectedItems,&pcolor, NULL); 11927: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11928: 11929: /* and change the color of the core label button 11930: */ 11931: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11932: XtVaSetValues(pushButtonColorDepthOffsetHole3, XmNbackground, sampPixel, NULL); 11933: 11934: XtVaSetValues(pushButtonColorDepthOffsetHole3, XmNlabelString, pcolor[0], NULL); 11935: (void)sprintf(tempcolor[DEPOFFHOLE3_COLOR], "%s", rgbcolor); 11936: tempfgPixel[DEPOFFHOLE3_COLOR] = sampPixel; 11937: XtFree(rgbcolor); 11938: } 11939: 11940: /* ARGSUSED */ 11941: void 11942: ColorDepthOffsetHole4(w, client, call) 11943: Widget w; 11944: XtPointer client; 11945: XtPointer call; 11946: { 11947: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11948: 11949: int item_count; 11950: char *rgbcolor; 11951: XmString *pcolor; 11952: Pixel sampPixel; 11953: int GetColorPixelValue(); 11954: 11955: /* get the selected color name from the list 11956: */ 11957: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11958: XmNselectedItems,&pcolor, NULL); 11959: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11960: 11961: /* and change the color of the core label button 11962: */ 11963: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11964: XtVaSetValues(pushButtonColorDepthOffsetHole4, XmNbackground, sampPixel, NULL); 11965: 11966: XtVaSetValues(pushButtonColorDepthOffsetHole4, XmNlabelString, pcolor[0], NULL); 11967: (void)sprintf(tempcolor[DEPOFFHOLE4_COLOR], "%s", rgbcolor); 11968: tempfgPixel[DEPOFFHOLE4_COLOR] = sampPixel; 11969: XtFree(rgbcolor); 11970: } 11971: 11972: /* ARGSUSED */ 11973: void 11974: ColorDepthOffsetHole5(w, client, call) 11975: Widget w; 11976: XtPointer client; 11977: XtPointer call; 11978: { 11979: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 11980: 11981: int item_count; 11982: char *rgbcolor; 11983: XmString *pcolor; 11984: Pixel sampPixel; 11985: int GetColorPixelValue(); 11986: 11987: /* get the selected color name from the list 11988: */ 11989: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 11990: XmNselectedItems,&pcolor, NULL); 11991: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 11992: 11993: /* and change the color of the core label button 11994: */ 11995: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 11996: XtVaSetValues(pushButtonColorDepthOffsetHole5, XmNbackground, sampPixel, NULL); 11997: 11998: XtVaSetValues(pushButtonColorDepthOffsetHole5, XmNlabelString, pcolor[0], NULL); 11999: (void)sprintf(tempcolor[DEPOFFHOLE5_COLOR], "%s", rgbcolor); 12000: tempfgPixel[DEPOFFHOLE5_COLOR] = sampPixel; 12001: XtFree(rgbcolor); 12002: } 12003: 12004: /* ARGSUSED */ 12005: void 12006: ColorDepthOffsetHole6(w, client, call) 12007: Widget w; 12008: XtPointer client; 12009: XtPointer call; 12010: { 12011: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12012: 12013: int item_count; 12014: char *rgbcolor; 12015: XmString *pcolor; 12016: Pixel sampPixel; 12017: int GetColorPixelValue(); 12018: 12019: /* get the selected color name from the list 12020: */ 12021: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 12022: XmNselectedItems,&pcolor, NULL); 12023: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 12024: 12025: /* and change the color of the core label button 12026: */ 12027: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 12028: XtVaSetValues(pushButtonColorDepthOffsetHole6, XmNbackground, sampPixel, NULL); 12029: 12030: XtVaSetValues(pushButtonColorDepthOffsetHole6, XmNlabelString, pcolor[0], NULL); 12031: (void)sprintf(tempcolor[DEPOFFHOLE6_COLOR], "%s", rgbcolor); 12032: tempfgPixel[DEPOFFHOLE6_COLOR] = sampPixel; 12033: XtFree(rgbcolor); 12034: } 12035: 12036: /* ARGSUSED */ 12037: void 12038: ColorDepthOffsetHole7(w, client, call) 12039: Widget w; 12040: XtPointer client; 12041: XtPointer call; 12042: { 12043: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12044: 12045: int item_count; 12046: char *rgbcolor; 12047: XmString *pcolor; 12048: Pixel sampPixel; 12049: int GetColorPixelValue(); 12050: 12051: /* get the selected color name from the list 12052: */ 12053: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 12054: XmNselectedItems,&pcolor, NULL); 12055: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 12056: 12057: /* and change the color of the core label button 12058: */ 12059: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 12060: XtVaSetValues(pushButtonColorDepthOffsetHole7, XmNbackground, sampPixel, NULL); 12061: 12062: XtVaSetValues(pushButtonColorDepthOffsetHole7, XmNlabelString, pcolor[0], NULL); 12063: (void)sprintf(tempcolor[DEPOFFHOLE7_COLOR], "%s", rgbcolor); 12064: tempfgPixel[DEPOFFHOLE7_COLOR] = sampPixel; 12065: XtFree(rgbcolor); 12066: } 12067: 12068: /* ARGSUSED */ 12069: void 12070: ColorDepthOffsetHole8(w, client, call) 12071: Widget w; 12072: XtPointer client; 12073: XtPointer call; 12074: { 12075: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12076: 12077: int item_count; 12078: char *rgbcolor; 12079: XmString *pcolor; 12080: Pixel sampPixel; 12081: int GetColorPixelValue(); 12082: 12083: /* get the selected color name from the list 12084: */ 12085: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 12086: XmNselectedItems,&pcolor, NULL); 12087: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 12088: 12089: /* and change the color of the core label button 12090: */ 12091: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 12092: XtVaSetValues(pushButtonColorDepthOffsetHole8, XmNbackground, sampPixel, NULL); 12093: 12094: XtVaSetValues(pushButtonColorDepthOffsetHole8, XmNlabelString, pcolor[0], NULL); 12095: (void)sprintf(tempcolor[DEPOFFHOLE8_COLOR], "%s", rgbcolor); 12096: tempfgPixel[DEPOFFHOLE8_COLOR] = sampPixel; 12097: XtFree(rgbcolor); 12098: } 12099: 12100: /* ARGSUSED */ 12101: void 12102: ColorDepthOffsetHole9(w, client, call) 12103: Widget w; 12104: XtPointer client; 12105: XtPointer call; 12106: { 12107: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12108: 12109: int item_count; 12110: char *rgbcolor; 12111: XmString *pcolor; 12112: Pixel sampPixel; 12113: int GetColorPixelValue(); 12114: 12115: /* get the selected color name from the list 12116: */ 12117: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 12118: XmNselectedItems,&pcolor, NULL); 12119: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 12120: 12121: /* and change the color of the core label button 12122: */ 12123: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 12124: XtVaSetValues(pushButtonColorDepthOffsetHole9, XmNbackground, sampPixel, NULL); 12125: 12126: XtVaSetValues(pushButtonColorDepthOffsetHole9, XmNlabelString, pcolor[0], NULL); 12127: (void)sprintf(tempcolor[DEPOFFHOLE9_COLOR], "%s", rgbcolor); 12128: tempfgPixel[DEPOFFHOLE9_COLOR] = sampPixel; 12129: XtFree(rgbcolor); 12130: } 12131: 12132: /* ARGSUSED */ 12133: void 12134: ColorDepthOffsetHole10(w, client, call) 12135: Widget w; 12136: XtPointer client; 12137: XtPointer call; 12138: { 12139: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12140: 12141: int item_count; 12142: char *rgbcolor; 12143: XmString *pcolor; 12144: Pixel sampPixel; 12145: int GetColorPixelValue(); 12146: 12147: /* get the selected color name from the list 12148: */ 12149: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 12150: XmNselectedItems,&pcolor, NULL); 12151: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 12152: 12153: /* and change the color of the core label button 12154: */ 12155: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 12156: XtVaSetValues(pushButtonColorDepthOffsetHole10, XmNbackground, sampPixel, NULL); 12157: 12158: XtVaSetValues(pushButtonColorDepthOffsetHole10, XmNlabelString, pcolor[0], NULL); 12159: (void)sprintf(tempcolor[DEPOFFHOLE10_COLOR], "%s", rgbcolor); 12160: tempfgPixel[DEPOFFHOLE10_COLOR] = sampPixel; 12161: XtFree(rgbcolor); 12162: } 12163: 12164: /* ARGSUSED */ 12165: void 12166: ColorDepthOffsetHole11(w, client, call) 12167: Widget w; 12168: XtPointer client; 12169: XtPointer call; 12170: { 12171: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12172: 12173: int item_count; 12174: char *rgbcolor; 12175: XmString *pcolor; 12176: Pixel sampPixel; 12177: int GetColorPixelValue(); 12178: 12179: /* get the selected color name from the list 12180: */ 12181: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 12182: XmNselectedItems,&pcolor, NULL); 12183: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 12184: 12185: /* and change the color of the core label button 12186: */ 12187: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 12188: XtVaSetValues(pushButtonColorDepthOffsetHole11, XmNbackground, sampPixel, NULL); 12189: 12190: XtVaSetValues(pushButtonColorDepthOffsetHole11, XmNlabelString, pcolor[0], NULL); 12191: (void)sprintf(tempcolor[DEPOFFHOLE11_COLOR], "%s", rgbcolor); 12192: tempfgPixel[DEPOFFHOLE11_COLOR] = sampPixel; 12193: XtFree(rgbcolor); 12194: } 12195: 12196: /* ARGSUSED */ 12197: void 12198: ColorCancel(w, client, call) 12199: Widget w; 12200: XtPointer client; 12201: XtPointer call; 12202: { 12203: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12204: 12205: XtUnmanageChild(formSetColor); 12206: } 12207: 12208: /* ARGSUSED */ 12209: void 12210: ColorTiePtShift(w, client, call) 12211: Widget w; 12212: XtPointer client; 12213: XtPointer call; 12214: { 12215: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12216: 12217: int item_count; 12218: char *rgbcolor; 12219: XmString *pcolor; 12220: Pixel sampPixel; 12221: int GetColorPixelValue(); 12222: 12223: /* get the selected color name from the list 12224: */ 12225: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 12226: XmNselectedItems,&pcolor, NULL); 12227: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 12228: 12229: /* and change the color of the core label button 12230: */ 12231: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 12232: XtVaSetValues(pushButtonColorTiePtShift, XmNbackground, sampPixel, NULL); 12233: 12234: XtVaSetValues(pushButtonColorTiePtShift, XmNlabelString, pcolor[0], NULL); 12235: (void)sprintf(tempcolor[TIEPTSHIFT_COLOR], "%s", rgbcolor); 12236: tempfgPixel[TIEPTSHIFT_COLOR] = sampPixel; 12237: XtFree(rgbcolor); 12238: } 12239: 12240: /* ARGSUSED */ 12241: void 12242: SpliceUndoCancel(w, client, call) 12243: Widget w; 12244: XtPointer client; 12245: XtPointer call; 12246: { 12247: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12248: 12249: XtUnmanageChild(formSpliceUndo); 12250: 12251: /* XtSetSensitive(pushButtonGetSelectCore, False); */ 12252: 12253: (void)sprintf(buffer, "You may only add to the splice"); 12254: SpManageWarningBox(buffer); 12255: } 12256: 12257: /* ARGSUSED */ 12258: void 12259: SpliceUndoHelp(w, client, call) 12260: Widget w; 12261: XtPointer client; 12262: XtPointer call; 12263: { 12264: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12265: } 12266: 12267: /* ARGSUSED */ 12268: void 12269: SpliceUndoOK(w, client, call) 12270: Widget w; 12271: XtPointer client; 12272: XtPointer call; 12273: { 12274: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12275: 12276: XtUnmanageChild(formSpliceUndo); 12277: 12278: SpliceUndoLast(NULL, "ok", NULL); 12279: } 12280: 12281: /* ARGSUSED */ 12282: void 12283: ViewAgeDepth(w, client, call) 12284: Widget w; 12285: XtPointer client; 12286: XtPointer call; 12287: { 12288: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12289: 12290: int i; 12291: char string[20]; 12292: XmString xmstring; 12293: void DrawDrawingAreaAgeDepth(), XmListAddItem(), AgeDepthConstructAgeModel(); 12294: 12295: XtManageChild(formAgeDepth); 12296: XtPopup(XtParent(formAgeDepth), XtGrabNone); 12297: 12298: (void)sprintf(string, "1"); 12299: XtVaSetValues(textAgeDepthZoomFactor, XmNvalue, string, NULL); 12300: 12301: /* put the strat types in the list 12302: */ 12303: if(have_strat == DO) { 12304: 12305: if(have_affine == DO) { 12306: XtSetSensitive(toggleButtonAgeDepthmcd, True); 12307: } 12308: else { 12309: XtSetSensitive(toggleButtonAgeDepthmcd, False); 12310: } 12311: XtSetSensitive(toggleButtonAgeDepthmbsf, True); 12312: XtSetSensitive(formAgeDepthControls, True); 12313: 12314: for(i=0; i<strat_file_cnt; ++i) { 12315: agedepth_use_type[i] = YES; 12316: } 12317: } 12318: else { 12319: XtSetSensitive(formAgeDepthControls, False); 12320: } 12321: 12322: top_age_agedepth = 0.0; 12323: top_meter_agedepth = 0.0; 12324: 12325: AgeDepthConstructAgeModel((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 12326: 12327: (void)sprintf(string, ""); 12328: } 12329: 12330: /* ARGSUSED */ 12331: void 12332: AgeDepthDismiss(w, client, call) 12333: Widget w; 12334: XtPointer client; 12335: XtPointer call; 12336: { 12337: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12338: 12339: are_agemodelling = NO; 12340: 12341: XtUnmanageChild(formAgeDepth); 12342: } 12343: 12344: /* ARGSUSED */ 12345: void 12346: AgeDepthHelp(w, client, call) 12347: Widget w; 12348: XtPointer client; 12349: XtPointer call; 12350: { 12351: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12352: } 12353: 12354: /* ARGSUSED */ 12355: void 12356: AgeDepthmbsf(w, client, call) 12357: Widget w; 12358: XtPointer client; 12359: XtPointer call; 12360: { 12361: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12362: 12363: void DrawDrawingAreaAgeDepth(); 12364: 12365: agemodelling_depth_type = MBSF; 12366: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 12367: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 12368: } 12369: } 12370: 12371: /* ARGSUSED */ 12372: void 12373: AgeDepthmcd(w, client, call) 12374: Widget w; 12375: XtPointer client; 12376: XtPointer call; 12377: { 12378: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12379: 12380: void DrawDrawingAreaAgeDepth(); 12381: 12382: agemodelling_depth_type = MCD; 12383: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 12384: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 12385: } 12386: } 12387: 12388: /* ARGSUSED */ 12389: void 12390: AgeDepthSave(w, client, call) 12391: Widget w; 12392: XtPointer client; 12393: XtPointer call; 12394: { 12395: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12396: 12397: if((message.label=(char*)calloc(100,CHAR_SIZE))==NULL) 12398: SpBadMemAlloc("Sp"); 12399: (void)sprintf(message.label,"This Option is incomplete."); 12400: SpManageMessage(message); 12401: } 12402: 12403: /* ARGSUSED */ 12404: void 12405: DrawAgeDepthCreate(w, client, call) 12406: Widget w; 12407: XtPointer client; 12408: XtPointer call; 12409: { 12410: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12411: } 12412: 12413: /* ARGSUSED */ 12414: void 12415: DrawDrawingAreaAgeDepth(w, client, call) 12416: Widget w; 12417: XtPointer client; 12418: XtPointer call; 12419: { 12420: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12421: 12422: int i, j, k, sx, sdx, sy, sdy, axispixlen, ticpixlen, annot, label, pixpermeter, pixperage, core, array, 12423: zoom, topoff, botoff, left; 12424: char s[50]; 12425: float max, maxmeter, maxage, maxoffset, unitinc, depticlen, sect, sect_dep, 12426: dep, percentdepchange, ageticlen, adj1, adj2; 12427: double check, fract, ip; 12428: String str; 12429: Dimension win_width, win_height; 12430: XGCValues gcValues; 12431: void HardwireAxis(), AxisDep(), AxisAge(); 12432: 12433: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 12434: 12435: /*clear the drawing area 12436: */ 12437: XClearWindow(XtDisplay(w), XtWindow(w)); 12438: 12439: if(have_strat == DONT) { 12440: return; 12441: } 12442: 12443: /* get the zoom factor 12444: */ 12445: str = XmTextGetString(textAgeDepthZoomFactor); 12446: zoom = atoi(str); 12447: XtFree(str); 12448: 12449: if(agemodelling_depth_type == MBSF) { 12450: label = MBSF; 12451: } 12452: else if(agemodelling_depth_type == MCD) { 12453: label = MCD; 12454: } 12455: else { 12456: return; 12457: } 12458: 12459: top_off_agedepth_depth = OFF; 12460: maxmeter = maxagedepdepth; 12461: depticlen = 10.0; 12462: annot = 5; 12463: top_off_agedepth_depth = OFF; 12464: botoff = SPACE; 12465: 12466: /* get the axis scales and such 12467: */ 12468: AgeDepthPlotValues((int)win_height, &maxmeter, top_meter_agedepth, &unitinc, top_off_agedepth_depth, botoff, &left, 12469: &ticpixlen, depticlen, &pixpermeter); 12470: 12471: /*test 12472: */ 12473: depperpixagemodel = 1.0/pixpermeter; 12474: depperpixagemodel = depperpixagemodel/zoom; 12475: left = left * zoom; 12476: ticpixlen = ticpixlen * zoom; 12477: pixpermeter = pixpermeter * zoom; 12478: 12479: /* set color for axis and labels 12480: */ 12481: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[LABEL_COLOR]); 12482: AxisDep(w, XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, 12483: maxmeter, top_off_agedepth_depth, left, ticpixlen, depticlen, unitinc, depperpixagemodel, annot, label); 12484: 12485: /*calc. the length of the age axis in pixels 12486: */ 12487: top_off_agedepth_age = OFF; 12488: botoff = SPACE; 12489: axispixlen = (int)win_width - OFF - SPACE; 12490: ticpixlen = axispixlen; 12491: ageticlen = 1.0; 12492: maxage = maxagedepage; 12493: unitinc = 0.0; 12494: ageperpix = maxagedepage/axispixlen; 12495: annot = 1; 12496: 12497: AgeDepthPlotValues((int)win_width, &maxage, top_age_agedepth, &unitinc, top_off_agedepth_age, botoff, &left, 12498: &ticpixlen, ageticlen, &pixperage); 12499: 12500: /*test 12501: */ 12502: ageperpix = 1.0/pixperage; 12503: ageperpix = ageperpix/zoom; 12504: pixperage = pixperage * zoom; 12505: left = left * zoom; 12506: ticpixlen = ticpixlen * zoom; 12507: 12508: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[LABEL_COLOR]); 12509: AxisAge(w, XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, 12510: maxage, top_off_agedepth_age, left, ticpixlen, ageticlen, unitinc, ageperpix, annot); 12511: 12512: /* draw the datums. use their codes as symbols 12513: */ 12514: for(i=0; i<strat_file_cnt; ++i){ 12515: if(agedepth_use_type[i] == YES) { 12516: if(strat[i]->type == PALEOMAG) { 12517: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[PALEOMAG_COLOR]); 12518: } 12519: else if(strat[i]->type == DIATOMS){ 12520: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[DIATOM_COLOR]); 12521: } 12522: else if(strat[i]->type == RADIOLARIA){ 12523: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[RAD_COLOR]); 12524: } 12525: else if(strat[i]->type == FORAMINIFERA){ 12526: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[FORAM_COLOR]); 12527: } 12528: else if(strat[i]->type == NANNOFOSSILS){ 12529: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[NANNO_COLOR]); 12530: } 12531: 12532: for(j=0; j<strat[i]->data_cnt; ++j){ 12533: 12534: if(strat[i]->data[j].hole_is_in_dataset == YES && 12535: (strat[i]->data[j].top.in_affine == YES || strat[i]->data[j].bot.in_affine == YES)) { 12536: sx = (strat[i]->data[j].top_age - top_age_agedepth)/ageperpix + top_off_agedepth_age; 12537: sdx = (strat[i]->data[j].bot_age - top_age_agedepth)/ageperpix + top_off_agedepth_age; 12538: if(agemodelling_depth_type == MBSF) { 12539: sy = (strat[i]->data[j].top.sb_depth - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12540: sdy = (strat[i]->data[j].bot.sb_depth - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12541: } 12542: else if(agemodelling_depth_type == MCD) { 12543: sy = (strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12544: sdy = (strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12545: } 12546: 12547: if((sy > (int)win_height) || (sx > (int)win_width) || 12548: (sy < 0 && sdy < 0) || (sx < 0 && sdx < 0)){ 12549: strat[i]->data[j].x_pix_loc_agedepth = -100; 12550: strat[i]->data[j].y_pix_loc_agedepth = -100; 12551: } 12552: else { 12553: gcValues.line_width = 2; 12554: XChangeGC(XtDisplay(w), gc_drawingAreaAgeDepth, GCLineWidth, &gcValues); 12555: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, 12556: sx, sy, sdx, sy); 12557: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, 12558: sx, sdy, sdx, sdy); 12559: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, 12560: sx + (sdx - sx), sy, sx + (sdx - sx), sdy); 12561: strat[i]->data[j].x_pix_loc_agedepth = sx - 5; 12562: strat[i]->data[j].y_pix_loc_agedepth = sy - 5; 12563: gcValues.line_width = 0; 12564: XChangeGC(XtDisplay(w), gc_drawingAreaAgeDepth, GCLineWidth, &gcValues); 12565: (void)sprintf(s, "%s", strat[i]->data[j].code); 12566: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, sx-5, sy-5, s, (int)strlen(s)); 12567: } 12568: } 12569: else { 12570: strat[i]->data[j].x_pix_loc_agedepth = -100; 12571: strat[i]->data[j].y_pix_loc_agedepth = -100; 12572: } 12573: } 12574: } 12575: else { 12576: for(j=0; j<strat[i]->data_cnt; ++j){ 12577: strat[i]->data[j].x_pix_loc_agedepth = -100; 12578: strat[i]->data[j].y_pix_loc_agedepth = -100; 12579: } 12580: } 12581: } 12582: 12583: if(agemodel_cnt > 1 && are_agemodelling == YES) { 12584: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[AGEDEPLINE_COLOR]); 12585: for(i=0; i<agemodel_cnt-1; ++i) { 12586: if(agemodelling_depth_type == MBSF) { 12587: sy = (agemodel[i].avembsf - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12588: sdy = (agemodel[i+1].avembsf - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12589: } 12590: else if(agemodelling_depth_type == MCD) { 12591: sy = (agemodel[i].avemcd - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12592: sdy = (agemodel[i+1].avemcd - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12593: } 12594: sx = (agemodel[i].aveage - top_age_agedepth)/ageperpix + top_off_agedepth_age; 12595: sdx = (agemodel[i+1].aveage - top_age_agedepth)/ageperpix + top_off_agedepth_age; 12596: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, sx, sy, sdx, sdy); 12597: } 12598: } 12599: 12600: if(agemodel_cnt >= 1 && are_agemodelling == YES) { 12601: XSetForeground(XtDisplay(w), gc_drawingAreaAgeDepth, fgPixel[AGEDEPHANDPICK_COLOR]); 12602: for(i=0; i<agemodel_cnt; ++i) { 12603: if(agemodelling_depth_type == MBSF) { 12604: sy = (agemodel[i].avembsf - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12605: } 12606: else if(agemodelling_depth_type == MCD) { 12607: sy = (agemodel[i].avemcd - top_meter_agedepth)/depperpixagemodel + top_off_agedepth_depth; 12608: } 12609: sx = (agemodel[i].aveage - top_age_agedepth)/ageperpix + top_off_agedepth_age; 12610: agemodel[i].x_pix_loc_agedepth = sx; 12611: agemodel[i].y_pix_loc_agedepth = sy; 12612: if(strcmp(agemodel[i].code, "X") == 0) { 12613: (void)sprintf(s, "X"); 12614: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, sx-5, sy, s, (int)strlen(s)); 12615: } 12616: else if(strcmp(agemodel[i].code, "T") == 0) { 12617: /* 12618: (void)sprintf(s, "T"); 12619: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaAgeDepth, sx-5, sy, s, (int)strlen(s)); 12620: */ 12621: } 12622: XFillArc(XtDisplay(drawingAreaAgeDepth), XtWindow(drawingAreaAgeDepth), 12623: gc_drawingAreaAgeDepth, 12624: sx-(POINTSIZE/2), sy-(POINTSIZE/2), 12625: POINTSIZE, POINTSIZE, 0, 360*64); 12626: } 12627: } 12628: 12629: (void)sprintf(s, ""); 12630: } 12631: 12632: /* ARGSUSED */ 12633: void 12634: AgeDepthStratListMultSelect(w, client, call) 12635: Widget w; 12636: XtPointer client; 12637: XtPointer call; 12638: { 12639: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12640: 12641: int i, j, count, *position; 12642: Boolean XmListGetSelectedPos(); 12643: 12644: if(!XmListGetSelectedPos(listAgeDepthStrat, &position, &count)) { 12645: return; 12646: } 12647: 12648: if(count > 0) { 12649: for(j=0; j<strat_file_cnt; ++j) { 12650: agedepth_use_type[j] = NO; 12651: for(i=0; i<count; ++i) { 12652: if(j == position[i]-1) { 12653: agedepth_use_type[j] = YES; 12654: } 12655: } 12656: } 12657: } 12658: XtFree((char *)position); 12659: 12660: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 12661: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 12662: } 12663: } 12664: 12665: /* ARGSUSED */ 12666: void 12667: AgeDepthListMultSelect(w, client, call) 12668: Widget w; 12669: XtPointer client; 12670: XtPointer call; 12671: { 12672: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12673: } 12674: 12675: /* ARGSUSED */ 12676: void 12677: AgeDepthConstructAgeModel(w, client, call) 12678: Widget w; 12679: XtPointer client; 12680: XtPointer call; 12681: { 12682: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12683: 12684: int i; 12685: char string[200]; 12686: XmString xmstring; 12687: void PlotSpliceVsAge(), DrawDrawingAreaAgeDepth(); 12688: 12689: if(have_strat == DONT) { 12690: return; 12691: } 12692: 12693: XtVaSetValues(XtParent(formAgeDepth), XmNwidth, 990, NULL); 12694: XtManageChild(formConstructAgeModel); 12695: are_agemodelling = YES; 12696: top_age_splicetoage = 0.0; 12697: lastagescaleval = 0; 12698: 12699: /* set the age and depth text fields to 0.0, 0.0 12700: */ 12701: (void)sprintf(string, "0.0"); 12702: XtVaSetValues(textFieldAgeDepthHandPickDepth, XmNvalue, string, NULL); 12703: XtVaSetValues(textFieldAgeDepthHandPickAge, XmNvalue, string, NULL); 12704: 12705: /* put a hand pick of 0.0, 0.0 in age model and list 12706: */ 12707: if(agemodel_cnt < 1) { 12708: agemodel_cnt = 1; 12709: agemodel[0].avembsf = 0.0; 12710: agemodel[0].avemcd = 0.0; 12711: agemodel[0].aveage = 0.0; 12712: agemodel[0].type = HANDPICK; 12713: (void)sprintf(agemodel[0].name, "handpick"); 12714: (void)sprintf(agemodel[0].code, "X"); 12715: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", agemodel[0].avembsf, agemodel[0].avemcd, 12716: agemodel[0].aveage, agemodel[0].name, agemodel[0].code); 12717: xmstring = XmStringCreateSimple(string); 12718: XmListAddItemUnselected(listConstructAgeModel, xmstring, 0); 12719: XmStringFree(xmstring); 12720: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 12721: XtSetSensitive(pushButtonSaveAgeMode, False); 12722: XtSetSensitive(pushButtonSaveSpliceToAge, False); 12723: XtSetSensitive(pushButtonOpenAgeSignal, False); 12724: XtSetSensitive(pushButtonOpenTimeSeries, False); 12725: have_splicetoage = DONT; 12726: } 12727: else if(agemodel_cnt == 1) { 12728: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 12729: XtSetSensitive(pushButtonSaveAgeMode, False); 12730: XtSetSensitive(pushButtonSaveSpliceToAge, False); 12731: XtSetSensitive(pushButtonOpenAgeSignal, False); 12732: XtSetSensitive(pushButtonOpenTimeSeries, False); 12733: have_splicetoage = DONT; 12734: } 12735: else { 12736: XtSetSensitive(pushButtonSaveAgeMode, True); 12737: if(have_splice == DONT) { 12738: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 12739: XtSetSensitive(pushButtonSaveSpliceToAge, False); 12740: XtSetSensitive(pushButtonOpenAgeSignal, False); 12741: XtSetSensitive(pushButtonOpenTimeSeries, False); 12742: } 12743: else if(have_splice == DO) { 12744: XtSetSensitive(pushButtonPlotSpliceVsAge, True); 12745: XtSetSensitive(pushButtonSaveSpliceToAge, True); 12746: if(have_time_series == DONT) { 12747: XtSetSensitive(pushButtonOpenAgeSignal, True); 12748: XtSetSensitive(pushButtonOpenTimeSeries, True); 12749: } 12750: else if(have_time_series == DO) { 12751: XtSetSensitive(pushButtonOpenAgeSignal, False); 12752: XtSetSensitive(pushButtonOpenTimeSeries, False); 12753: } 12754: have_splicetoage = DO; 12755: } 12756: } 12757: 12758: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 12759: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 12760: } 12761: PlotSpliceVsAge(NO); 12762: } 12763: 12764: /* ARGSUSED */ 12765: void 12766: ConstructAgeModelDismiss(w, client, call) 12767: Widget w; 12768: XtPointer client; 12769: XtPointer call; 12770: { 12771: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12772: 12773: void DrawDrawingAreaAgeDepth(); 12774: 12775: XtUnmanageChild(formConstructAgeModel); 12776: XtVaSetValues(XtParent(formAgeDepth), XmNwidth, 600, NULL); 12777: are_agemodelling = NO; 12778: 12779: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 12780: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 12781: } 12782: } 12783: 12784: /* ARGSUSED */ 12785: void 12786: RemoveSelectDatum(w, client, call) 12787: Widget w; 12788: XtPointer client; 12789: XtPointer call; 12790: { 12791: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12792: 12793: int i, j, count, *position; 12794: char *string; 12795: XmString xmstring; 12796: Boolean XmListGetSelectedPos(); 12797: void XmListDeletePos(), RecalcDatumAges(), DrawDrawingAreaAgeDepth(), PlotSpliceVsAge(); 12798: 12799: if(!XmListGetSelectedPos(listConstructAgeModel, &position, &count)) { 12800: return; 12801: } 12802: if(count == agemodel_cnt) { 12803: XmListDeleteAllItems(listConstructAgeModel); 12804: agemodel_cnt = 0; 12805: have_splicetoage = DONT; 12806: did_agemodel = NO; 12807: saved_agemodel = NO; 12808: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 12809: XtSetSensitive(pushButtonSaveAgeMode, False); 12810: XtSetSensitive(pushButtonSaveSpliceToAge, False); 12811: XtSetSensitive(pushButtonRemoveSelectDatum, False); 12812: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, False); 12813: XtSetSensitive(pushButtonOpenAgeSignal, False); 12814: XtSetSensitive(pushButtonOpenTimeSeries, False); 12815: } 12816: else if(count > 0) { 12817: for(i=count-1; i>=0; --i) { 12818: for(j=position[i]-1; j<agemodel_cnt-1; ++j) { 12819: if(strcmp(agemodel[j+1].code, "X") == 0) { 12820: agemodel[j].aveage = agemodel[j+1].aveage; 12821: agemodel[j].avembsf = agemodel[j+1].avembsf; 12822: agemodel[j].avemcd = agemodel[j+1].avemcd; 12823: (void)sprintf(agemodel[j].code, "X"); 12824: } 12825: else { 12826: agemodel[j] = agemodel[j+1]; 12827: } 12828: } 12829: --agemodel_cnt; 12830: } 12831: if(agemodel_cnt == 1) { 12832: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 12833: XtSetSensitive(pushButtonSaveAgeMode, False); 12834: XtSetSensitive(pushButtonSaveSpliceToAge, False); 12835: XtSetSensitive(pushButtonOpenAgeSignal, False); 12836: XtSetSensitive(pushButtonOpenTimeSeries, False); 12837: have_splicetoage = DONT; 12838: did_agemodel = NO; 12839: saved_agemodel = NO; 12840: } 12841: else { 12842: XtSetSensitive(pushButtonPlotSpliceVsAge, True); 12843: XtSetSensitive(pushButtonSaveAgeMode, True); 12844: XtSetSensitive(pushButtonSaveSpliceToAge, True); 12845: if(have_time_series == DONT) { 12846: XtSetSensitive(pushButtonOpenAgeSignal, True); 12847: XtSetSensitive(pushButtonOpenTimeSeries, True); 12848: } 12849: else if(have_time_series == DO) { 12850: XtSetSensitive(pushButtonOpenAgeSignal, False); 12851: XtSetSensitive(pushButtonOpenTimeSeries, False); 12852: } 12853: have_splicetoage = DO; 12854: } 12855: RecalcDatumAges(); 12856: XmListDeleteAllItems(listConstructAgeModel); 12857: for(i=0; i<agemodel_cnt; ++i) { 12858: if((string=(char*)calloc((int)strlen(agemodel[i].name)+(int)strlen(agemodel[i].code)+100,CHAR_SIZE))==NULL) 12859: SpBadMemAlloc("SpliceToAgeAddTiedDatum"); 12860: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", agemodel[i].avembsf, agemodel[i].avemcd, 12861: agemodel[i].aveage, agemodel[i].name, agemodel[i].code); 12862: xmstring = XmStringCreateSimple(string); 12863: XmListAddItemUnselected(listConstructAgeModel, xmstring, i + 1); 12864: XmStringFree(xmstring); 12865: free(string); 12866: } 12867: } 12868: XtFree((char *)position); 12869: 12870: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 12871: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 12872: } 12873: PlotSpliceVsAge(NO); 12874: } 12875: 12876: /* ARGSUSED */ 12877: void 12878: AgeDepthBothmbsfAndmcd(w, client, call) 12879: Widget w; 12880: XtPointer client; 12881: XtPointer call; 12882: { 12883: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12884: } 12885: 12886: /* ARGSUSED */ 12887: void 12888: ConstructAgeModelHelp(w, client, call) 12889: Widget w; 12890: XtPointer client; 12891: XtPointer call; 12892: { 12893: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12894: } 12895: 12896: /* ARGSUSED */ 12897: void 12898: ClearComposite(w, client, call) 12899: { 12900: /*SUPPRESS 594*/XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call; 12901: 12902: if((message.label=(char*)calloc(100,CHAR_SIZE))==NULL) 12903: SpBadMemAlloc("Sp"); 12904: (void)sprintf(message.label,"This Option is incomplete."); 12905: SpManageMessage(message); 12906: } 12907: 12908: void 12909: ClearStrat(w, client_data, call_data) 12910: Widget w; 12911: XtPointer client_data; 12912: XtPointer call_data; 12913: { 12914: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 12915: 12916: if((message.label=(char*)calloc(100,CHAR_SIZE))==NULL) 12917: SpBadMemAlloc("Sp"); 12918: (void)sprintf(message.label,"This Option is incomplete."); 12919: SpManageMessage(message); 12920: } 12921: 12922: void 12923: AgeDepthClearAgeModelList(w, client_data, call_data) 12924: Widget w; 12925: XtPointer client_data; 12926: XtPointer call_data; 12927: { 12928: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 12929: 12930: void DrawDrawingAreaAgeDepth(); 12931: 12932: XmListDeleteAllItems(listConstructAgeModel); 12933: 12934: /* clear agemodel 12935: */ 12936: agemodel_cnt = 0; 12937: have_splicetoage = DONT; 12938: did_agemodel = NO; 12939: saved_agemodel = NO; 12940: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 12941: XtSetSensitive(pushButtonSaveAgeMode, False); 12942: XtSetSensitive(pushButtonSaveSpliceToAge, False); 12943: XtSetSensitive(pushButtonRemoveSelectDatum, False); 12944: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, False); 12945: XtSetSensitive(pushButtonOpenAgeSignal, False); 12946: XtSetSensitive(pushButtonOpenTimeSeries, False); 12947: 12948: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 12949: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 12950: } 12951: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 12952: XClearWindow(XtDisplay(drawingAreaSpliceToAge), XtWindow(drawingAreaSpliceToAge)); 12953: } 12954: } 12955: 12956: void 12957: AgeDepthAddHandPickToList(w, client_data, call_data) 12958: Widget w; 12959: XtPointer client_data; 12960: XtPointer call_data; 12961: { 12962: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 12963: 12964: int i, k, found, pos, array; 12965: char string[50]; 12966: float age, depth; 12967: String str; 12968: XmString xmstring; 12969: void DrawDrawingAreaAgeDepth(), PlotSpliceVsAge(); 12970: 12971: /* check that have not reached array limit 12972: */ 12973: if(agemodel_cnt + 1 > MAXAGE) { 12974: (void)sprintf(buffer, "You have exceeded the limit on the number of values in age model."); 12975: SpManageWarningBox(buffer); 12976: return; 12977: } 12978: 12979: if(are_agemodelling == YES) { 12980: 12981: str = XmTextGetString(textFieldAgeDepthHandPickAge); 12982: age = atof(str); 12983: XtFree(str); 12984: str = XmTextGetString(textFieldAgeDepthHandPickDepth); 12985: depth = atof(str); 12986: XtFree(str); 12987: 12988: /* check to see that this pick falls within a splice table core 12989: */ 12990: if(age == 0.0 && depth == 0.0) { 12991: found = 0; 12992: } 12993: else if(have_splice == DONT && agemodelling_depth_type == MBSF) { 12994: (void)sprintf(buffer, "You cannot do a hand pick unless you have a splice. Because without\n"); 12995: (void)strcat(buffer, "a splice record there is no way to convert depth from mbsf to mcd."); 12996: SpManageWarningBox(buffer); 12997: return; 12998: } 12999: else if(have_splice == DONT && agemodelling_depth_type == MCD) { 13000: (void)sprintf(buffer, "You cannot do a hand pick unless you have a splice. Because without\n"); 13001: (void)strcat(buffer, "a splice record there is no way to convert depth from mcd to mbsf."); 13002: SpManageWarningBox(buffer); 13003: return; 13004: } 13005: else { 13006: found = -1; 13007: k=0; 13008: while(k<splicertable.data_cnt-1) { 13009: if(agemodelling_depth_type == MBSF) { 13010: if(depth >= splicertable.data[k].mbsf && depth <= splicertable.data[k+1].mbsf) { 13011: found = k; 13012: break; 13013: } 13014: } 13015: else if(agemodelling_depth_type == MCD) { 13016: if(depth >= splicertable.data[k].mcd && depth <= splicertable.data[k+1].mcd) { 13017: found = k; 13018: break; 13019: } 13020: } 13021: k = k+2; 13022: } 13023: if(found == -1) { 13024: (void)sprintf(buffer, "The hand picked date does not fall within the splice. It must Because without\n"); 13025: (void)strcat(buffer, "a splice record there is no way to convert depth between mcd and mbsf."); 13026: SpManageWarningBox(buffer); 13027: return; 13028: } 13029: } 13030: 13031: /* put this hand picked datum in age model struct in order by both age and depth 13032: there must not be conflicts with age and depth 13033: */ 13034: if(agemodel_cnt >= 1) { 13035: pos = -1; 13036: for(k=0; k<agemodel_cnt; ++k) { 13037: if(agemodelling_depth_type == MBSF) { 13038: if(k == 0 && age < agemodel[k].aveage && depth < agemodel[k].avembsf) { 13039: pos = k; 13040: } 13041: else if(k == agemodel_cnt-1 && 13042: age > agemodel[k].aveage && depth > agemodel[k].avembsf) { 13043: pos = k + 1; 13044: } 13045: else if(k < agemodel_cnt-1 && 13046: age > agemodel[k].aveage && depth > agemodel[k].avembsf && 13047: age < agemodel[k+1].aveage && depth < agemodel[k+1].avembsf) { 13048: pos = k + 1; 13049: } 13050: } 13051: else if(agemodelling_depth_type == MCD) { 13052: if(k == 0 && age < agemodel[k].aveage && depth < agemodel[k].avemcd) { 13053: pos = k; 13054: } 13055: else if(k == agemodel_cnt-1 && 13056: age > agemodel[k].aveage && depth > agemodel[k].avemcd) { 13057: pos = k + 1; 13058: } 13059: else if(k < agemodel_cnt-1 && 13060: age > agemodel[k].aveage && depth > agemodel[k].avemcd && 13061: age < agemodel[k+1].aveage && depth < agemodel[k+1].avemcd) { 13062: pos = k + 1; 13063: } 13064: } 13065: } 13066: if(pos == -1) { 13067: (void)sprintf(buffer, "The age datum picked conflicts with one's already in the list."); 13068: SpManageWarningBox(buffer); 13069: return; 13070: } 13071: else { 13072: ++agemodel_cnt; 13073: if(pos == agemodel_cnt-1) { 13074: array = agemodel_cnt-1; 13075: } 13076: else { 13077: for(k=agemodel_cnt-1; k>pos; --k) { 13078: agemodel[k] = agemodel[k-1]; 13079: } 13080: array = pos; 13081: } 13082: } 13083: } 13084: else if(agemodel_cnt == 0) { 13085: agemodel_cnt = 1; 13086: array = 0; 13087: } 13088: 13089: agemodel[array].aveage = age; 13090: agemodel[array].type = HANDPICK; 13091: (void)sprintf(agemodel[array].code, "X"); 13092: (void)sprintf(agemodel[array].name, "handpick"); 13093: 13094: if(age == 0.0 && depth == 0.0) { 13095: agemodel[array].avembsf = 0.0; 13096: agemodel[array].avemcd = 0.0; 13097: } 13098: else if(agemodelling_depth_type == MBSF) { 13099: agemodel[array].avembsf = depth; 13100: agemodel[array].avemcd = depth + (splicertable.data[found].mcd - splicertable.data[found].mbsf); 13101: } 13102: else if(agemodelling_depth_type == MCD) { 13103: agemodel[array].avemcd = depth; 13104: agemodel[array].avembsf = depth + (splicertable.data[found].mbsf - splicertable.data[found].mcd); 13105: } 13106: 13107: 13108: (void)sprintf(string, "%7.2f %7.2f %7.3f handpick", agemodel[array].avembsf, agemodel[array].avemcd, agemodel[array].aveage); 13109: xmstring = XmStringCreateSimple(string); 13110: XmListAddItemUnselected(listConstructAgeModel, xmstring, pos + 1); 13111: XmStringFree(xmstring); 13112: } 13113: 13114: if(agemodel_cnt > 1) { 13115: XtSetSensitive(pushButtonSaveAgeMode, True); 13116: XtSetSensitive(pushButtonRemoveSelectDatum, True); 13117: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, True); 13118: if(have_splice == DO) { 13119: XtSetSensitive(pushButtonPlotSpliceVsAge, True); 13120: XtSetSensitive(pushButtonSaveSpliceToAge, True); 13121: if(have_time_series == DONT) { 13122: XtSetSensitive(pushButtonOpenAgeSignal, True); 13123: XtSetSensitive(pushButtonOpenTimeSeries, True); 13124: } 13125: else if(have_time_series == DO) { 13126: XtSetSensitive(pushButtonOpenAgeSignal, False); 13127: XtSetSensitive(pushButtonOpenTimeSeries, False); 13128: } 13129: have_splicetoage = DO; 13130: } 13131: else { 13132: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 13133: XtSetSensitive(pushButtonSaveSpliceToAge, False); 13134: XtSetSensitive(pushButtonOpenAgeSignal, False); 13135: XtSetSensitive(pushButtonOpenTimeSeries, False); 13136: have_splicetoage = DONT; 13137: } 13138: did_agemodel = YES; 13139: saved_agemodel = NO; 13140: } 13141: else { 13142: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 13143: XtSetSensitive(pushButtonSaveAgeMode, False); 13144: XtSetSensitive(pushButtonSaveSpliceToAge, False); 13145: XtSetSensitive(pushButtonRemoveSelectDatum, False); 13146: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, False); 13147: XtSetSensitive(pushButtonOpenAgeSignal, False); 13148: XtSetSensitive(pushButtonOpenTimeSeries, False); 13149: have_splicetoage = DONT; 13150: } 13151: if(agemodel_cnt > 0) { 13152: XtSetSensitive(pushButtonRemoveSelectDatum, True); 13153: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, True); 13154: } 13155: else { 13156: XtSetSensitive(pushButtonRemoveSelectDatum, False); 13157: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, False); 13158: } 13159: 13160: 13161: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13162: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13163: } 13164: if(have_splicetoage == DO) { 13165: PlotSpliceVsAge(NO); 13166: } 13167: 13168: (void)sprintf(string, ""); 13169: } 13170: 13171: void 13172: ScaleAgeDepthDrag(w, client_data, call_data) 13173: Widget w; 13174: XtPointer client_data; 13175: XtPointer call_data; 13176: { 13177: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13178: } 13179: 13180: void 13181: ScaleAgeDepthChange(w, client_data, call_data) 13182: Widget w; 13183: XtPointer client_data; 13184: XtPointer call_data; 13185: { 13186: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13187: } 13188: 13189: void 13190: AgeDepthReplot(w, client_data, call_data) 13191: Widget w; 13192: XtPointer client_data; 13193: XtPointer call_data; 13194: { 13195: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13196: } 13197: 13198: void 13199: DrawDrawingAreaAgeModel(w, client_data, call_data) 13200: Widget w; 13201: XtPointer client_data; 13202: XtPointer call_data; 13203: { 13204: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13205: } 13206: 13207: void 13208: ScaleAgeDepthAgeDrag(w, client_data, call_data) 13209: Widget w; 13210: XtPointer client_data; 13211: XtPointer call_data; 13212: { 13213: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13214: 13215: void DrawDrawingAreaAgeDepth(); 13216: 13217: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13218: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13219: } 13220: } 13221: 13222: void 13223: AgeDepthTextZoomActivate(w, client_data, call_data) 13224: Widget w; 13225: XtPointer client_data; 13226: XtPointer call_data; 13227: { 13228: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13229: 13230: char string[20]; 13231: int zoomfactor; 13232: float zfactor; 13233: String str; 13234: 13235: str = XmTextGetString(textAgeDepthZoomFactor); 13236: zfactor = atof(str); 13237: XtFree(str); 13238: 13239: if(zfactor < 1.0) { 13240: zoomfactor = 1; 13241: (void)sprintf(string, "%d", zoomfactor); 13242: XtVaSetValues(textAgeDepthZoomFactor, XmNvalue, string, NULL); 13243: (void)sprintf(string, ""); 13244: } 13245: 13246: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13247: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13248: } 13249: } 13250: 13251: void 13252: AgeDepthZoomDown(w, client_data, call_data) 13253: Widget w; 13254: XtPointer client_data; 13255: XtPointer call_data; 13256: { 13257: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13258: 13259: char string[20]; 13260: int zoomfactor; 13261: String str; 13262: void DrawDrawingAreaAgeDepth(); 13263: 13264: str = XmTextGetString(textAgeDepthZoomFactor); 13265: zoomfactor = atoi(str); 13266: XtFree(str); 13267: 13268: if(zoomfactor > 1) { 13269: --zoomfactor; 13270: } 13271: (void)sprintf(string, "%d", zoomfactor); 13272: XtVaSetValues(textAgeDepthZoomFactor, XmNvalue, string, NULL); 13273: (void)sprintf(string, ""); 13274: 13275: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13276: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13277: } 13278: } 13279: 13280: void 13281: DepthOffsetArrowUp(w, client_data, call_data) 13282: Widget w; 13283: XtPointer client_data; 13284: XtPointer call_data; 13285: { 13286: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13287: 13288: char string[20]; 13289: float depthchange; 13290: String str; 13291: void DrawDrawingAreaDepthOffset(); 13292: 13293: str = XmTextGetString(textDepthChange); 13294: depthchange = atof(str); 13295: XtFree(str); 13296: 13297: if(depthchange <= 99.9) { 13298: depthchange = depthchange + 1.0; 13299: } 13300: (void)sprintf(string, "%.2f", depthchange); 13301: XtVaSetValues(textDepthChange, XmNvalue, string, NULL); 13302: (void)sprintf(string, ""); 13303: 13304: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 13305: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 13306: } 13307: } 13308: 13309: void 13310: ScaleAgeDepthDepthChange(w, client_data, call_data) 13311: Widget w; 13312: XtPointer client_data; 13313: XtPointer call_data; 13314: { 13315: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13316: 13317: void DrawDrawingAreaAgeDepth(); 13318: 13319: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13320: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13321: } 13322: } 13323: 13324: void 13325: ScaleAgeDepthDepthDrag(w, client_data, call_data) 13326: Widget w; 13327: XtPointer client_data; 13328: XtPointer call_data; 13329: { 13330: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13331: 13332: void DrawDrawingAreaAgeDepth(); 13333: 13334: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13335: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13336: } 13337: } 13338: 13339: void 13340: ScaleAgeDepthAgeChange(w, client_data, call_data) 13341: Widget w; 13342: XtPointer client_data; 13343: XtPointer call_data; 13344: { 13345: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13346: 13347: void DrawDrawingAreaAgeDepth(); 13348: 13349: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13350: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13351: } 13352: } 13353: 13354: void 13355: AgeDepthZoomUp(w, client_data, call_data) 13356: Widget w; 13357: XtPointer client_data; 13358: XtPointer call_data; 13359: { 13360: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13361: 13362: char string[20]; 13363: int zoomfactor; 13364: String str; 13365: void DrawDrawingAreaAgeDepth(); 13366: 13367: str = XmTextGetString(textAgeDepthZoomFactor); 13368: zoomfactor = atoi(str); 13369: XtFree(str); 13370: 13371: if(zoomfactor < 10) { 13372: ++zoomfactor; 13373: } 13374: (void)sprintf(string, "%d", zoomfactor); 13375: XtVaSetValues(textAgeDepthZoomFactor, XmNvalue, string, NULL); 13376: (void)sprintf(string, ""); 13377: 13378: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 13379: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 13380: } 13381: } 13382: 13383: void 13384: DepthOffsetArrowDown(w, client_data, call_data) 13385: Widget w; 13386: XtPointer client_data; 13387: XtPointer call_data; 13388: { 13389: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13390: 13391: char string[20]; 13392: float depthchange; 13393: String str; 13394: void DrawDrawingAreaDepthOffset(); 13395: 13396: str = XmTextGetString(textDepthChange); 13397: depthchange = atof(str); 13398: XtFree(str); 13399: 13400: if(depthchange >= 1.0) { 13401: depthchange = depthchange - 1.0; 13402: } 13403: (void)sprintf(string, "%.2f", depthchange); 13404: XtVaSetValues(textDepthChange, XmNvalue, string, NULL); 13405: (void)sprintf(string, ""); 13406: 13407: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 13408: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 13409: } 13410: } 13411: 13412: void 13413: ColorAgeDepthHandPick(w, client_data, call_data) 13414: Widget w; 13415: XtPointer client_data; 13416: XtPointer call_data; 13417: { 13418: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13419: 13420: int item_count; 13421: char *rgbcolor; 13422: XmString *pcolor; 13423: Pixel sampPixel; 13424: int GetColorPixelValue(); 13425: 13426: /* get the selected color name from the list 13427: */ 13428: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 13429: XmNselectedItems,&pcolor, NULL); 13430: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 13431: 13432: /* and change the color of the core label button 13433: */ 13434: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 13435: XtVaSetValues(pushButtonColorAgeDepthHandPick, XmNbackground, sampPixel, NULL); 13436: 13437: XtVaSetValues(pushButtonColorAgeDepthHandPick, XmNlabelString, pcolor[0], NULL); 13438: (void)sprintf(tempcolor[AGEDEPHANDPICK_COLOR], "%s", rgbcolor); 13439: tempfgPixel[AGEDEPHANDPICK_COLOR] = sampPixel; 13440: XtFree(rgbcolor); 13441: } 13442: 13443: void 13444: ColorAgeDepthLine(w, client_data, call_data) 13445: Widget w; 13446: XtPointer client_data; 13447: XtPointer call_data; 13448: { 13449: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13450: 13451: int item_count; 13452: char *rgbcolor; 13453: XmString *pcolor; 13454: Pixel sampPixel; 13455: int GetColorPixelValue(); 13456: 13457: /* get the selected color name from the list 13458: */ 13459: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 13460: XmNselectedItems,&pcolor, NULL); 13461: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 13462: 13463: /* and change the color of the core label button 13464: */ 13465: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 13466: XtVaSetValues(pushButtonColorAgeDepthLine, XmNbackground, sampPixel, NULL); 13467: 13468: XtVaSetValues(pushButtonColorAgeDepthLine, XmNlabelString, pcolor[0], NULL); 13469: (void)sprintf(tempcolor[AGEDEPLINE_COLOR], "%s", rgbcolor); 13470: tempfgPixel[AGEDEPLINE_COLOR] = sampPixel; 13471: XtFree(rgbcolor); 13472: } 13473: 13474: void 13475: SaveAgeModel(w, client_data, call_data) 13476: Widget w; 13477: XtPointer client_data; 13478: XtPointer call_data; 13479: { 13480: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13481: 13482: char *str, *path; 13483: int len; 13484: XmString xmstring; 13485: 13486: void SpUpdateFileSelection(); 13487: 13488: XtManageChild(formFileSelection); 13489: XtPopup(XtParent(formFileSelection),XtGrabNone); 13490: xmstring=XmCvtCTToXmString("Save"); 13491: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 13492: XmStringFree(xmstring); 13493: 13494: fileselection = SAVEAGEMODEL; 13495: 13496: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Save Age Model", NULL); 13497: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 13498: 13499: if((path=(char*)calloc((int)strlen(outagemodel_dirname)+1000,CHAR_SIZE))==NULL) 13500: SpBadMemAlloc("OpenSplicerTable"); 13501: (void)sprintf(path, "%s", outagemodel_dirname); 13502: 13503: len = (int)strlen(path); 13504: if(strcmp(&path[len-1], "/") == 0) { 13505: *strrchr(path,'/')= '\0'; 13506: } 13507: 13508: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 13509: SpBadMemAlloc("OpenSplicerTable"); 13510: } 13511: (void)sprintf(str,"%s/*", path); 13512: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 13513: free(str); 13514: 13515: XtVaSetValues(textFileSelectionSelected, XmNvalue, outagemodel_filename, NULL); 13516: 13517: SpUpdateFileSelection(FILE_FILTER, SAVEAGEMODEL, path); 13518: (void)sprintf(preview_input_path,"%s",path); 13519: 13520: free(path); 13521: if(path) 13522: path = NULL; 13523: } 13524: 13525: void 13526: ScaleSpliceToAgeChange(w, client_data, call_data) 13527: Widget w; 13528: XtPointer client_data; 13529: XtPointer call_data; 13530: { 13531: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13532: 13533: void DrawDrawingAreaSpliceToAge(); 13534: 13535: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 13536: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 13537: } 13538: } 13539: 13540: void 13541: DrawDrawingAreaSpliceToAge(w, client_data, call_data) 13542: Widget w; 13543: XtPointer client_data; 13544: XtPointer call_data; 13545: { 13546: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 13547: 13548: int i, j, k, kk, sm, sx, sy, sdx, sdy, xoff, yoff, pixperspliceage, scaleval, scalemax, 13549: dummy, diff, left, ticpixlen, annot, label; 13550: char s[10], *string; 13551: float current_agedisplayed, maxsedrate, maxage, zoom, scaleinc, agediff, agetic, unitinc, 13552: timeseries_age, splice_age, ageoffset, flip_adj, flip_off; 13553: double check, fract, ip; 13554: Dimension win_height, win_width; 13555: String str; 13556: XmString xmstring; 13557: void AxisSpliceAge(); 13558: 13559: XClearWindow(XtDisplay(w), XtWindow(w)); 13560: 13561: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 13562: XmScaleGetValue(scaleSpliceToAge, &scaleval); 13563: 13564: scaleinc = AGESCALEBARINC; /* increment scale bar at 1 20th of age displayed */ 13565: 13566: 13567: /* get the zoom factor 13568: */ 13569: str = XmTextGetString(textSpliceToAgeZoomFactor); 13570: zoom = atof(str); 13571: XtFree(str); 13572: if(zoom <= 0.0) { 13573: zoom = 1.0; 13574: } 13575: 13576: if(have_splicetoage == DONT) { 13577: top_off_splicetoage = 0; 13578: top_age_splicetoage = 0.0; 13579: spliceageperpix = 1.0; 13580: sedrateperpix = 1.0; 13581: if(have_data == DONT) { 13582: varperpix = 1.0; 13583: } 13584: } 13585: else if(have_splicetoage == DO) { 13586: 13587: xoff = OFF + SPACE; 13588: if(scaleval == 0) { 13589: top_off_splicetoage = OFF; 13590: } 13591: else { 13592: top_off_splicetoage = 0; 13593: } 13594: 13595: if(spcomp.age[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1] >= agemodel[agemodel_cnt-1].aveage) { 13596: maxage = spcomp.age[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1]; 13597: } 13598: else { 13599: maxage = agemodel[agemodel_cnt-1].aveage; 13600: } 13601: 13602: current_agedisplayed = agedisplayed; 13603: 13604: agetic = 0.1; 13605: dummy = current_agedisplayed * 10.0; 13606: /* cannot display less than 0.1Ma at zoom fact 1 13607: */ 13608: if(dummy < 1) { 13609: dummy = 1; 13610: } 13611: current_agedisplayed = dummy/10.0; 13612: check = ((int)win_height - top_off_splicetoage)/current_agedisplayed; 13613: fract = modf(check, &ip); 13614: pixperspliceage = ip; 13615: 13616: pixperspliceage = pixperspliceage * zoom; 13617: spliceageperpix = 1.0/pixperspliceage; 13618: agetic = agetic/zoom; 13619: 13620: /* recalc age displayed 13621: */ 13622: current_agedisplayed = ((int)win_height - top_off_splicetoage) * spliceageperpix; 13623: 13624: /* find out what the top age should be 13625: */ 13626: if(scaleval == 0) { /* top age is 0.0 */ 13627: top_age_splicetoage = 0.0; 13628: lastagescaleval = 0; 13629: } 13630: else if(lastagescaleval == scaleval) { /* top age has not changed */ 13631: } 13632: else if(lastagescaleval < scaleval) { /* top age is deeper */ 13633: diff = scaleval - lastagescaleval; 13634: agediff = (current_agedisplayed * scaleinc) * diff; 13635: top_age_splicetoage = top_age_splicetoage + agediff; 13636: } 13637: else if(lastagescaleval > scaleval) { /* top age is shallower */ 13638: diff = lastagescaleval - scaleval; 13639: agediff = (current_agedisplayed * scaleinc) * diff; 13640: top_age_splicetoage = top_age_splicetoage - agediff; 13641: } 13642: 13643: scaleval = top_age_splicetoage/(current_agedisplayed*scaleinc) + 0.1; 13644: XtVaSetValues(scaleSpliceToAge, XmNvalue, scaleval, NULL); 13645: lastagescaleval = scaleval; 13646: 13647: /* find out what the scale bar max value should be 13648: */ 13649: XtVaGetValues(scaleSpliceToAge, XmNmaximum, &scalemax, NULL); 13650: dummy = (maxage/current_agedisplayed) * 1.0/scaleinc; 13651: if(scalemax != dummy) { 13652: scalemax = dummy; 13653: XtVaSetValues(scaleSpliceToAge, XmNmaximum, scalemax, NULL); 13654: } 13655: 13656: /* stuff for age axis 13657: */ 13658: 13659: check = top_age_splicetoage/agetic; 13660: fract = modf(check, &ip); /* is the top value divisable by tic or is there a remainder*/ 13661: 13662: if(fract == 0.0) { /*if no remainder than y axis starts at a tic*/ 13663: unitinc = top_age_splicetoage; 13664: } 13665: else { /*there is a remainder so axis does not start at a tic*/ 13666: unitinc = agetic * ip + agetic; /*so the first tic is the next one down*/ 13667: } 13668: 13669: ticpixlen = pixperspliceage * agetic; 13670: 13671: if(unitinc == top_age_splicetoage){ /*if axis does not start at a tic calculate the distance*/ 13672: left = 0; /*in pixels from top of axis to first tic*/ 13673: } 13674: else { 13675: left = (unitinc - top_age_splicetoage) * pixperspliceage; 13676: } 13677: 13678: annot = 1; 13679: label = YES; 13680: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[LABEL_COLOR]); 13681: AxisSpliceAge(w, XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 13682: maxage, top_off_splicetoage, left, ticpixlen, agetic, unitinc, spliceageperpix, annot, label); 13683: 13684: minvar = data[dset]->min; 13685: maxvar = data[dset]->max; 13686: 13687: for(j=0; j<spcomp.numcores; ++j){ 13688: 13689: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 13690: smooth.plot == SMOOTHEDBOTH){ 13691: 13692: /* if are drawing both smoothed and unsmoothed 13693: draw the smoothed 13694: */ 13695: if(spcomp.numpercore[j] < 2) { 13696: } 13697: else if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 13698: } 13699: else { 13700: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[SMOOTH_COLOR]); 13701: if(j < 1){ 13702: if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK){ 13703: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 13704: } 13705: else { 13706: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 13707: } 13708: sy = (spcomp.age[j][0] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13709: kk = 1; 13710: } 13711: else if(j > 0 && (spcomp.splice_how[j] == REAL || spcomp.splice_how[j] == INTERPOLATED) && 13712: spcomp.map_to_table[j-1] == spcomp.map_to_table[j] - 2){ 13713: if(data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->smooth_ok >= SMOK){ 13714: sx = (data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->sm_data - 13715: minvar)/varperpix + xoff; 13716: } 13717: else { 13718: sx = (spcomp.var[j-1][spcomp.numpercore[j-1]-1] - minvar)/varperpix + xoff; 13719: } 13720: sy = (spcomp.age[j-1][spcomp.numpercore[j-1]-1] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13721: kk = 0; 13722: } 13723: else if(j > 0){ 13724: if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK){ 13725: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 13726: } 13727: else { 13728: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 13729: } 13730: sy = (spcomp.age[j][0] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13731: kk = 1; 13732: } 13733: 13734: for(k=kk; k<spcomp.numpercore[j]; ++k) { 13735: if(data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->smooth_ok >= SMOK){ 13736: sdx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->sm_data - minvar)/varperpix + xoff; 13737: } 13738: else { 13739: sdx = (spcomp.var[j][k] - minvar)/varperpix + xoff; 13740: } 13741: sdy = (spcomp.age[j][k] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13742: if(sy > (int)win_height) { 13743: break; 13744: } 13745: if(sy <= 0 && sdy <= 0) { 13746: } 13747: else { 13748: if(sy < 0 && sdy > 0) { 13749: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 13750: sy = 0; 13751: } 13752: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 13753: sx, sy, sdx, sdy); 13754: } 13755: sx = sdx; 13756: sy = sdy; 13757: } 13758: } 13759: } 13760: 13761: /* depending on plot choice draw the smoothed or unsmoothed 13762: */ 13763: if(smooth.method == NONE || smooth.plot == UNSMOOTHED){ 13764: sm = NO; 13765: } 13766: else if(smooth.plot == SMOOTHEDBOTH){ 13767: sm = NO; 13768: } 13769: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 13770: smooth.plot == SMOOTHED){ 13771: sm = YES; 13772: } 13773: else { 13774: sm = NO; 13775: } 13776: 13777: if(spcomp.numpercore[j] < 2) { 13778: } 13779: else if(sm == YES && data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->smooth_status != SMOK) { 13780: } 13781: else { 13782: if(sm == NO) { 13783: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[SPLICE_COLOR]); 13784: } 13785: else if(sm == YES) { 13786: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[SMOOTH_COLOR]); 13787: } 13788: 13789: if(j < 1){ 13790: if(sm == YES && (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK)){ 13791: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 13792: } 13793: else { 13794: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 13795: } 13796: sy = (spcomp.age[j][0] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13797: kk = 1; 13798: } 13799: else if(j > 0 && (spcomp.splice_how[j] == REAL || spcomp.splice_how[j] == INTERPOLATED) && 13800: spcomp.map_to_table[j-1] == spcomp.map_to_table[j] - 2){ 13801: if(sm == YES && 13802: (data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->smooth_ok >= SMOK)){ 13803: sx = (data[dset]->holes[spcomp.hole[j-1]]->core[spcomp.core[j-1]]->value[spcomp.MapToOrig[j-1][spcomp.numpercore[j-1]-1]]->sm_data - 13804: minvar)/varperpix + xoff; 13805: } 13806: else { 13807: sx = (spcomp.var[j-1][spcomp.numpercore[j-1]-1] - minvar)/varperpix + xoff; 13808: } 13809: sy = (spcomp.age[j-1][spcomp.numpercore[j-1]-1] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13810: kk = 0; 13811: } 13812: else if(j > 0){ 13813: if(sm == YES && (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->smooth_ok >= SMOK)){ 13814: sx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][0]]->sm_data - minvar)/varperpix + xoff; 13815: } 13816: else { 13817: sx = (spcomp.var[j][0] - minvar)/varperpix + xoff; 13818: } 13819: sy = (spcomp.age[j][0] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13820: kk = 1; 13821: } 13822: for(k=kk; k<spcomp.numpercore[j]; ++k) { 13823: if(sm == YES && (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->smooth_ok >= SMOK)){ 13824: sdx = (data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->value[spcomp.MapToOrig[j][k]]->sm_data - minvar)/varperpix + xoff; 13825: } 13826: else { 13827: sdx = (spcomp.var[j][k] - minvar)/varperpix + xoff; 13828: } 13829: sdy = (spcomp.age[j][k] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13830: if(sy > (int)win_height) { 13831: break; 13832: } 13833: if(sy <= 0 && sdy <= 0) { 13834: } 13835: else { 13836: if(sy < 0 && sdy > 0) { 13837: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 13838: sy = 0; 13839: } 13840: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 13841: sx, sy, sdx, sdy); 13842: } 13843: sx = sdx; 13844: sy = sdy; 13845: } 13846: 13847: /* label the core 13848: */ 13849: sx = xoff - SPACE/2.0; 13850: sy = sy - 5; 13851: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[LABEL_COLOR]); 13852: (void)sprintf(s, "%c%d", data[dset]->holes[spcomp.hole[j]]->name, 13853: data[dset]->holes[spcomp.hole[j]]->core[spcomp.core[j]]->num); 13854: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 13855: sx, sy, s, (int)strlen(s)); 13856: } 13857: } 13858: 13859: /* draw the datums 13860: */ 13861: for(i=0; i<agemodel_cnt; ++i) { 13862: if(agemodel[i].type == PALEOMAG) { 13863: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[PALEOMAG_COLOR]); 13864: } 13865: else if(agemodel[i].type == DIATOMS){ 13866: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[DIATOM_COLOR]); 13867: } 13868: else if(agemodel[i].type == RADIOLARIA){ 13869: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[RAD_COLOR]); 13870: } 13871: else if(agemodel[i].type == FORAMINIFERA){ 13872: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[FORAM_COLOR]); 13873: } 13874: else if(agemodel[i].type == NANNOFOSSILS){ 13875: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[NANNO_COLOR]); 13876: } 13877: else if(agemodel[i].type == HANDPICK || agemodel[i].type == TIME){ 13878: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[AGEDEPHANDPICK_COLOR]); 13879: } 13880: else { 13881: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[LABEL_COLOR]); 13882: } 13883: sy = (agemodel[i].aveage - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13884: (void)sprintf(s, "%s", agemodel[i].code); 13885: agemodel[i].x_pix_loc_splicetoage = varaxislen + xoff + SPACE/2; 13886: agemodel[i].y_pix_loc_splicetoage = sy; 13887: XDrawString(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 13888: agemodel[i].x_pix_loc_splicetoage, agemodel[i].y_pix_loc_splicetoage, s, (int)strlen(s)); 13889: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[DATUMLOC_COLOR]); 13890: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, OFF+SPACE+20, sy, OFF+SPACE+varaxislen-20, sy); 13891: 13892: } 13893: 13894: /* if have time series draw it 13895: */ 13896: if(have_time_series == DO && timeseries.n >= 2) { 13897: if(XmToggleButtonGetState(toggleButtonTimeSeriesInvertNo) == True) { 13898: flip_adj = 1.0; 13899: flip_off = 0.0; 13900: } 13901: else if(XmToggleButtonGetState(toggleButtonTimeSeriesInvertYes) == True) { 13902: flip_adj = -1.0; 13903: flip_off = timeseries.maxval - timeseries.minval; 13904: } 13905: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[TIMESERIES_COLOR]); 13906: xoff = OFF + SPACE + varaxislen + SPACE; 13907: timeseries.valperpix = (timeseries.maxval-timeseries.minval)/varaxislen; 13908: sx = (flip_adj * (timeseries.val[0] - timeseries.minval) + flip_off)/timeseries.valperpix + xoff; 13909: sy = (timeseries.age[0] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13910: for(i=1; i<timeseries.n; ++i) { 13911: sdx = (flip_adj * (timeseries.val[i] - timeseries.minval) + flip_off)/timeseries.valperpix + xoff; 13912: sdy = (timeseries.age[i] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13913: if(sy > (int)win_height) { 13914: break; 13915: } 13916: if(sy <= 0 && sdy <= 0) { 13917: } 13918: else { 13919: if(sy < 0 && sdy > 0) { 13920: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 13921: sy = 0; 13922: } 13923: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 13924: sx, sy, sdx, sdy); 13925: } 13926: sx = sdx; 13927: sy = sdy; 13928: } 13929: 13930: if(have_splicetoage_tie == DO && have_timeseries_tie == DO){ 13931: 13932: /* get the ages at tie and draw the time series over the splice 13933: */ 13934: XtVaGetValues(labelSpliceToAgeTimeSeriesAge, XmNlabelString, &xmstring, NULL); 13935: XmStringGetLtoR(xmstring, XmFONTLIST_DEFAULT_TAG, &string); 13936: timeseries_age = atof(string); 13937: XtFree(string); 13938: XtVaGetValues(labelSpliceToAgeTieSpliceAge, XmNlabelString, &xmstring, NULL); 13939: XmStringGetLtoR(xmstring, XmFONTLIST_DEFAULT_TAG, &string); 13940: splice_age = atof(string); 13941: XtFree(string); 13942: ageoffset = splice_age - timeseries_age; 13943: 13944: xoff= OFF + SPACE; 13945: sx = (flip_adj * (timeseries.val[0] - timeseries.minval) + flip_off)/timeseries.valperpix + xoff; 13946: sy = (timeseries.age[0] - top_age_splicetoage + ageoffset)/spliceageperpix + top_off_splicetoage; 13947: for(i=1; i<timeseries.n; ++i) { 13948: sdx = (flip_adj * (timeseries.val[i] - timeseries.minval) + flip_off)/timeseries.valperpix + xoff; 13949: sdy = (timeseries.age[i] - top_age_splicetoage + ageoffset)/spliceageperpix + top_off_splicetoage; 13950: if(sy > (int)win_height) { 13951: break; 13952: } 13953: if(sy <= 0 && sdy <= 0) { 13954: } 13955: else { 13956: if(timeseries.age[i] >= timeseries.age[timeseriesarraynum] - winlen && 13957: timeseries.age[i] <= timeseries.age[timeseriesarraynum] + winlen){ 13958: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[OVERLAYINCORR_COLOR]); 13959: } 13960: else { 13961: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[OVERLAYOUTCORR_COLOR]); 13962: } 13963: if(sy < 0 && sdy > 0) { 13964: sx = sx + ((sdx - sx)/(sdy - sy)) * sdy; 13965: sy = 0; 13966: } 13967: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 13968: sx, sy, sdx, sdy); 13969: } 13970: sx = sdx; 13971: sy = sdy; 13972: } 13973: } 13974: } 13975: 13976: /* if have tie point(s) draw 13977: */ 13978: if(have_splicetoage_tie == DO){ 13979: if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 13980: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH) && 13981: (data[dset]->holes[spcomp.hole[splicetoagecorenum]]->core[spcomp.core[splicetoagecorenum]]->smooth_status == SMOK) ){ 13982: 13983: if(data[dset]->holes[spcomp.hole[splicetoagecorenum]]->core[spcomp.core[splicetoagecorenum]]->value[spcomp.MapToOrig[splicetoagecorenum][splicetoagearraynum]]->smooth_ok >= SMOK){ 13984: sx = (data[dset]->holes[spcomp.hole[splicetoagecorenum]]->core[spcomp.core[splicetoagecorenum]]->value[spcomp.MapToOrig[splicetoagecorenum][splicetoagearraynum]]->sm_data - minvar)/varperpix + OFF + SPACE; 13985: } 13986: else { 13987: sx = (spcomp.var[splicetoagecorenum][splicetoagearraynum] - minvar)/varperpix + OFF + SPACE; 13988: } 13989: } 13990: else if(smooth.plot != SMOOTHED) { 13991: sx = (spcomp.var[splicetoagecorenum][splicetoagearraynum] - minvar)/varperpix + OFF + SPACE; 13992: } 13993: if((data[dset]->holes[spcomp.hole[splicetoagecorenum]]->core[spcomp.core[splicetoagecorenum]]->smooth_status != SMOK) && 13994: smooth.plot == SMOOTHED) { 13995: } 13996: else { 13997: sy = (spcomp.age[splicetoagecorenum][splicetoagearraynum] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 13998: XSetForeground(XtDisplay(drawingAreaSpliceToAge), gc_drawingAreaSpliceToAge, 13999: fgPixel[TIEPTSHIFT_COLOR]); 14000: XFillArc(XtDisplay(drawingAreaSpliceToAge), XtWindow(drawingAreaSpliceToAge), 14001: gc_drawingAreaSpliceToAge, 14002: sx-(POINTSIZE/2), sy-(POINTSIZE/2), 14003: POINTSIZE, POINTSIZE, 0, 360*64); 14004: } 14005: } 14006: if(have_timeseries_tie == DO) { 14007: xoff = OFF + SPACE + varaxislen + SPACE; 14008: sdx = (flip_adj * (timeseries.val[timeseriesarraynum] - timeseries.minval) + flip_off)/timeseries.valperpix + xoff; 14009: sdy = (timeseries.age[timeseriesarraynum] - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 14010: XSetForeground(XtDisplay(drawingAreaSpliceToAge), gc_drawingAreaSpliceToAge, 14011: fgPixel[TIEPTFIXED_COLOR]); 14012: XFillArc(XtDisplay(drawingAreaSpliceToAge), XtWindow(drawingAreaSpliceToAge), 14013: gc_drawingAreaSpliceToAge, 14014: sdx-(POINTSIZE/2), sdy-(POINTSIZE/2), 14015: POINTSIZE, POINTSIZE, 0, 360*64); 14016: } 14017: if(have_splicetoage_tie == DO && have_timeseries_tie == DO) { 14018: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[TIELINE_COLOR]); 14019: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, sx, sy, sdx, sdy); 14020: } 14021: 14022: /* draw the sed rate 14023: */ 14024: XSetForeground(XtDisplay(w), gc_drawingAreaSpliceToAge, fgPixel[SEDRATE_COLOR]); 14025: maxsedrate = 0.0; 14026: for(i=0; i<agemodel_cnt; ++i) { 14027: if(agemodel[i].sedrate > maxsedrate) { 14028: maxsedrate = agemodel[i].sedrate; 14029: } 14030: } 14031: sedrateperpix = maxsedrate/varaxislen; 14032: if(have_time_series == DONT) { 14033: xoff = OFF + SPACE + varaxislen + SPACE; 14034: } 14035: else if(have_time_series == DO) { 14036: xoff = OFF + SPACE + varaxislen + SPACE + varaxislen + SPACE; 14037: } 14038: else { 14039: xoff = OFF + SPACE + varaxislen + SPACE; 14040: } 14041: 14042: for(i=0; i<agemodel_cnt - 1; ++i) { 14043: sx = agemodel[i].sedrate/sedrateperpix + xoff; 14044: sdx = agemodel[i+1].sedrate/sedrateperpix + xoff; 14045: sy = (agemodel[i].aveage - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 14046: sdy = (agemodel[i+1].aveage - top_age_splicetoage)/spliceageperpix + top_off_splicetoage; 14047: 14048: if(sy > (int)win_height) { 14049: break; 14050: } 14051: else if(sdy < top_off_splicetoage) { 14052: } 14053: else { 14054: 14055: if(sdy > (int)win_height) { 14056: sdy = (int)win_height; 14057: } 14058: 14059: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 14060: sx, sy, sx, sdy); 14061: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaSpliceToAge, 14062: sx, sdy, sdx, sdy); 14063: } 14064: } 14065: } 14066: } 14067: 14068: void 14069: SpliceToAgeDismiss(w, client_data, call_data) 14070: Widget w; 14071: XtPointer client_data; 14072: XtPointer call_data; 14073: { 14074: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14075: 14076: have_splicetoage_corr = DONT; 14077: have_splicetoage_tie = DONT; 14078: have_timeseries_tie = DONT; 14079: XtUnmanageChild(formSpliceToAge); 14080: } 14081: 14082: void 14083: ScaleSpliceToAgeDrag(w, client_data, call_data) 14084: Widget w; 14085: XtPointer client_data; 14086: XtPointer call_data; 14087: { 14088: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14089: 14090: void DrawDrawingAreaSpliceToAge(); 14091: 14092: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 14093: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 14094: } 14095: } 14096: 14097: void 14098: PlotSpliceVsAge(from_view_splicetoage) 14099: int from_view_splicetoage; 14100: { 14101: int err; 14102: int CalcAge(); 14103: void DrawDrawingAreaSpliceToAge(); 14104: 14105: if(have_splice == DO && have_strat == DO) { 14106: if(agemodel_cnt > 1) { 14107: err = CalcAge(); 14108: if(err == NO) { 14109: /* call came from ViewSpliceVsAge; calculate the age displayed 14110: in the drawing area 14111: */ 14112: if(from_view_splicetoage == YES) { 14113: agedisplayed = depmeterdisplayed/agemodel_avesedrate; 14114: } 14115: have_splicetoage = DO; 14116: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 14117: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 14118: } 14119: } 14120: else { 14121: have_splicetoage = DONT; 14122: } 14123: } 14124: else { 14125: have_splicetoage = DONT; 14126: } 14127: } 14128: } 14129: 14130: void 14131: SaveAgeModelOK(w, client_data, call_data) 14132: Widget w; 14133: XtPointer client_data; 14134: XtPointer call_data; 14135: { 14136: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14137: } 14138: 14139: void 14140: SpliceToAgeZoomDown(w, client_data, call_data) 14141: Widget w; 14142: XtPointer client_data; 14143: XtPointer call_data; 14144: { 14145: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14146: 14147: char string[20]; 14148: int zoomfact; 14149: float zfact; 14150: String str; 14151: void DrawDrawingAreaSpliceToAge(); 14152: 14153: str = XmTextGetString(textSpliceToAgeZoomFactor); 14154: zfact = atof(str); 14155: XtFree(str); 14156: 14157: if(zfact > 1.0) { 14158: zoomfact = zfact + .1; 14159: --zoomfact; 14160: } 14161: else { 14162: if(zfact == 1) { 14163: zfact = 0.50; 14164: } 14165: else if(zfact == 0.50) { 14166: zfact = 0.25; 14167: } 14168: else if(zfact == 0.25) { 14169: zfact = 0.10; 14170: } 14171: else { 14172: zfact = 0.10; 14173: } 14174: } 14175: if(zfact >= 1.0) { 14176: (void)sprintf(string, "%d", zoomfact); 14177: } 14178: else { 14179: (void)sprintf(string, "%4.2f", zfact); 14180: } 14181: XtVaSetValues(textSpliceToAgeZoomFactor, XmNvalue, string, NULL); 14182: (void)sprintf(string, ""); 14183: 14184: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 14185: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 14186: } 14187: } 14188: 14189: void 14190: SpliceToAgeZoomUp(w, client_data, call_data) 14191: Widget w; 14192: XtPointer client_data; 14193: XtPointer call_data; 14194: { 14195: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14196: 14197: char string[20]; 14198: int zoomfact; 14199: float zfact; 14200: String str; 14201: void DrawDrawingAreaSpliceToAge(); 14202: 14203: str = XmTextGetString(textSpliceToAgeZoomFactor); 14204: zfact = atof(str); 14205: XtFree(str); 14206: 14207: zoomfact = zfact * 100.0; 14208: zfact = zoomfact/100.0; 14209: zoomfact = 1; 14210: 14211: if(zfact >= 20.0) { 14212: zoomfact = 20; 14213: } 14214: else if(zfact >= 1.0) { 14215: zoomfact = zfact + .1; 14216: ++zoomfact; 14217: } 14218: else { 14219: if(zfact == 0.5) { 14220: zfact = 1.0; 14221: zoomfact = 1; 14222: } 14223: else if(zfact == 0.25) { 14224: zfact = 0.50; 14225: } 14226: else if(zfact == 0.1) { 14227: zfact = 0.25; 14228: } 14229: else { 14230: zfact = 1.0; 14231: } 14232: } 14233: 14234: if(zfact >= 1.0) { 14235: (void)sprintf(string, "%d", zoomfact); 14236: } 14237: else { 14238: (void)sprintf(string, "%4.2f", zfact); 14239: } 14240: XtVaSetValues(textSpliceToAgeZoomFactor, XmNvalue, string, NULL); 14241: (void)sprintf(string, ""); 14242: 14243: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 14244: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 14245: } 14246: } 14247: 14248: void 14249: SpliceToAgeTextZoomActivate(w, client_data, call_data) 14250: Widget w; 14251: XtPointer client_data; 14252: XtPointer call_data; 14253: { 14254: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14255: 14256: char string[20]; 14257: int zoomfact; 14258: float zfact; 14259: String str; 14260: void DrawDrawingAreaSpliceToAge(); 14261: 14262: str = XmTextGetString(textSpliceToAgeZoomFactor); 14263: zfact = atof(str); 14264: XtFree(str); 14265: 14266: if(zfact <= .1) { 14267: (void)sprintf(string, "0.1"); 14268: XtVaSetValues(textSpliceToAgeZoomFactor, XmNvalue, string, NULL); 14269: (void)sprintf(string, ""); 14270: } 14271: else if(zfact > 20.0) { 14272: (void)sprintf(string, "20"); 14273: XtVaSetValues(textSpliceToAgeZoomFactor, XmNvalue, string, NULL); 14274: (void)sprintf(string, ""); 14275: } 14276: else if(zfact > 1.0) { 14277: zoomfact = zfact; 14278: (void)sprintf(string, "%d", zoomfact); 14279: XtVaSetValues(textSpliceToAgeZoomFactor, XmNvalue, string, NULL); 14280: (void)sprintf(string, ""); 14281: } 14282: else if(zfact < 1.0 && zfact != 0.1 && zfact != 0.25 && zfact != 0.5) { 14283: (void)sprintf(string, "1"); 14284: XtVaSetValues(textSpliceToAgeZoomFactor, XmNvalue, string, NULL); 14285: (void)sprintf(string, ""); 14286: } 14287: 14288: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 14289: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 14290: } 14291: } 14292: 14293: void 14294: ViewSpliceVsAge(w, client_data, call_data) 14295: Widget w; 14296: XtPointer client_data; 14297: XtPointer call_data; 14298: { 14299: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14300: 14301: int width; 14302: char string[20]; 14303: float dt; 14304: 14305: XtManageChild(formSpliceToAge); 14306: XtPopup(XtParent(formSpliceToAge),XtGrabNone); 14307: XtVaSetValues(textSpliceToAgeZoomFactor, XmNvalue, "1", NULL); 14308: XtVaSetValues(scaleSpliceToAge, XmNvalue, 0, NULL); 14309: XtSetSensitive(pushButtonSpliceToAgeAddTiedDatum, False); 14310: XtSetSensitive(pushButtonSpliceToAgeRecorrelate, False); 14311: XtSetSensitive(pushButtonSpliceToAgeClearTie, False); 14312: 14313: if(have_time_series == DO) { 14314: have_splicetoage_corr = DONT; 14315: width = 920; 14316: XtManageChild(formSpliceToAgeTieToTimeSeries); 14317: XtManageChild(labelInvertTimeSeries); 14318: XtManageChild(radioBoxInvertTimeSeries); 14319: XtSetSensitive(pushButtonSpliceToAgeRemoveTimeSeries, True); 14320: 14321: (void)sprintf(string, "%.3f", WINLENMYR); 14322: XtVaSetValues(textFieldSpliceToAgeWinLen, XmNvalue, string, NULL); 14323: (void)sprintf(string, "%.3f", LEADLAGMYR); 14324: XtVaSetValues(textFieldSpliceToAgeLeadLag, XmNvalue, string, NULL); 14325: (void)sprintf(string, ""); 14326: if(have_splicetoage == DO) { 14327: FindSpliceAveAge(&dt); 14328: (void)sprintf(string, "%.5f", dt); 14329: XtVaSetValues(textFieldSpliceToAgeTimeStep, XmNvalue, string, NULL); 14330: } 14331: 14332: if(XmToggleButtonGetState(toggleButtonTimeSeriesInvertYes) == True) { 14333: XmToggleButtonSetState(toggleButtonInvertYes, True, False); 14334: XmToggleButtonSetState(toggleButtonInvertNo, False, False); 14335: } 14336: else if(XmToggleButtonGetState(toggleButtonTimeSeriesInvertNo) == True) { 14337: XmToggleButtonSetState(toggleButtonInvertNo, True, False); 14338: XmToggleButtonSetState(toggleButtonInvertYes, False, False); 14339: } 14340: else { 14341: XmToggleButtonSetState(toggleButtonInvertNo, True, False); 14342: XmToggleButtonSetState(toggleButtonInvertYes, False, False); 14343: } 14344: } 14345: else { 14346: width = 560; 14347: XtSetSensitive(pushButtonSpliceToAgeRemoveTimeSeries, False); 14348: XtUnmanageChild(formSpliceToAgeTieToTimeSeries); 14349: XtUnmanageChild(labelInvertTimeSeries); 14350: XtUnmanageChild(radioBoxInvertTimeSeries); 14351: } 14352: XtVaSetValues(XtParent(formSpliceToAge), XmNwidth, width, NULL); 14353: 14354: PlotSpliceVsAge(YES); 14355: } 14356: 14357: void 14358: AgeDepthDrag(w, client_data, call_data) 14359: Widget w; 14360: XtPointer client_data; 14361: XtPointer call_data; 14362: { 14363: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14364: 14365: XmString xmstring; 14366: char *string; 14367: XColor return_color, unused; 14368: 14369: XtVaGetValues(pushButtonAgeDepthDrag, XmNlabelString, &xmstring, NULL); 14370: if(!XmStringGetLtoR(xmstring,XmFONTLIST_DEFAULT_TAG,&string)) 14371: { 14372: message.error=True; 14373: message.fatal=False; 14374: message.caller=NONE; 14375: message.type=XmDIALOG_WARNING; 14376: message.default_button=XmDIALOG_OK_BUTTON; 14377: if((message.label=(char*)calloc(200,CHAR_SIZE))==NULL) 14378: SpBadMemAlloc("SpViewReportCB 1"); 14379: else 14380: (void)sprintf(message.label,"Unable to convert report label to char"); 14381: SpManageMessage(message); 14382: } 14383: if((int)strcmp(string, "Enable Drag") == 0){ 14384: 14385: drag_cursor = XCreateFontCursor(XtDisplay(drawingAreaAgeDepth), XC_hand2); 14386: if(drag_cursor != BadAlloc && drag_cursor != BadFont && drag_cursor != BadValue) { 14387: XDefineCursor(XtDisplay(drawingAreaAgeDepth), XtWindow(drawingAreaAgeDepth), drag_cursor); 14388: } 14389: are_dragging = YES; 14390: 14391: xmstring=XmCvtCTToXmString("Disable Drag"); 14392: XtVaSetValues(pushButtonAgeDepthDrag,XmNlabelString,xmstring,NULL); 14393: XmStringFree(xmstring); 14394: } 14395: else if((int)strcmp(string, "Disable Drag") == 0) { 14396: 14397: if(drag_cursor) { 14398: XUndefineCursor(XtDisplay(drawingAreaAgeDepth), XtWindow(drawingAreaAgeDepth)); 14399: XFreeCursor(XtDisplay(drawingAreaAgeDepth), drag_cursor); 14400: } 14401: are_dragging = NO; 14402: top_age_agedepth = 0.0; 14403: top_meter_agedepth = 0.0; 14404: last_x_agedepth = 0; 14405: last_y_agedepth = 0; 14406: 14407: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 14408: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 14409: } 14410: 14411: xmstring=XmCvtCTToXmString("Enable Drag"); 14412: XtVaSetValues(pushButtonAgeDepthDrag,XmNlabelString,xmstring,NULL); 14413: XmStringFree(xmstring); 14414: } 14415: XtFree(string); 14416: } 14417: 14418: void 14419: AgeDepthScaleArrowDown(w, client_data, call_data) 14420: Widget w; 14421: XtPointer client_data; 14422: XtPointer call_data; 14423: { 14424: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14425: } 14426: 14427: void 14428: SaveSpliceToAge(w, client_data, call_data) 14429: Widget w; 14430: XtPointer client_data; 14431: XtPointer call_data; 14432: { 14433: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14434: 14435: char *str, *path; 14436: int len; 14437: XmString xmstring; 14438: 14439: void SpUpdateFileSelection(); 14440: 14441: XtManageChild(formFileSelection); 14442: XtPopup(XtParent(formFileSelection),XtGrabNone); 14443: xmstring=XmCvtCTToXmString("Save"); 14444: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 14445: XmStringFree(xmstring); 14446: 14447: fileselection = SAVESPLICEVSAGE; 14448: 14449: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Save Splice vs Age", NULL); 14450: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 14451: 14452: if((path=(char*)calloc((int)strlen(outsplicetoage_dirname)+1000,CHAR_SIZE))==NULL) 14453: SpBadMemAlloc("OpenSplicerTable"); 14454: (void)sprintf(path, "%s", outsplicetoage_dirname); 14455: 14456: len = (int)strlen(path); 14457: if(strcmp(&path[len-1], "/") == 0) { 14458: *strrchr(path,'/')= '\0'; 14459: } 14460: 14461: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 14462: SpBadMemAlloc("OpenSplicerTable"); 14463: } 14464: (void)sprintf(str,"%s/*", path); 14465: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 14466: free(str); 14467: 14468: XtVaSetValues(textFileSelectionSelected, XmNvalue, outsplicetoage_filename, NULL); 14469: 14470: SpUpdateFileSelection(FILE_FILTER, SAVESPLICEVSAGE, path); 14471: (void)sprintf(preview_input_path,"%s",path); 14472: 14473: free(path); 14474: if(path) 14475: path = NULL; 14476: } 14477: 14478: void 14479: AgeDepthScaleArrowUp(w, client_data, call_data) 14480: Widget w; 14481: XtPointer client_data; 14482: XtPointer call_data; 14483: { 14484: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14485: } 14486: 14487: void 14488: ColorDatumLocation(w, client_data, call_data) 14489: Widget w; 14490: XtPointer client_data; 14491: XtPointer call_data; 14492: { 14493: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14494: 14495: int item_count; 14496: char *rgbcolor; 14497: XmString *pcolor; 14498: Pixel sampPixel; 14499: int GetColorPixelValue(); 14500: 14501: /* get the selected color name from the list 14502: */ 14503: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 14504: XmNselectedItems,&pcolor, NULL); 14505: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 14506: 14507: /* and change the color of the core label button 14508: */ 14509: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 14510: XtVaSetValues(pushButtonColorDatumLocation, XmNbackground, sampPixel, NULL); 14511: 14512: XtVaSetValues(pushButtonColorDatumLocation, XmNlabelString, pcolor[0], NULL); 14513: (void)sprintf(tempcolor[DATUMLOC_COLOR], "%s", rgbcolor); 14514: tempfgPixel[DATUMLOC_COLOR] = sampPixel; 14515: XtFree(rgbcolor); 14516: } 14517: 14518: void 14519: ColorSetCorporate(w, client_data, call_data) 14520: Widget w; 14521: XtPointer client_data; 14522: XtPointer call_data; 14523: { 14524: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14525: 14526: int i; 14527: void SetInitialColors(), SetColorSetBGandFG(); 14528: 14529: colorset = CORPORATE_COLORSET; 14530: SetInitialColors(XtDisplay(w)); 14531: (void)SetColorSetBGandFG(); 14532: 14533: /* set the temp colors to the current colors using 14534: */ 14535: tempbgPixel = bgPixel; 14536: (void)sprintf(tempcolor[BG_COLOR], "%s", color[BG_COLOR]); 14537: for(i=1; i<NCOLOR; ++i) { 14538: tempfgPixel[i] = fgPixel[i]; 14539: (void)sprintf(tempcolor[i], "%s", color[i]); 14540: } 14541: } 14542: 14543: void 14544: ColorSetSantaFe(w, client_data, call_data) 14545: Widget w; 14546: XtPointer client_data; 14547: XtPointer call_data; 14548: { 14549: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14550: 14551: int i; 14552: void SetInitialColors(), SetColorSetBGandFG(); 14553: 14554: colorset = SANTAFE_COLORSET; 14555: SetInitialColors(XtDisplay(w)); 14556: (void)SetColorSetBGandFG(); 14557: 14558: /* set the temp colors to the current colors using 14559: */ 14560: tempbgPixel = bgPixel; 14561: (void)sprintf(tempcolor[BG_COLOR], "%s", color[BG_COLOR]); 14562: for(i=1; i<NCOLOR; ++i) { 14563: tempfgPixel[i] = fgPixel[i]; 14564: (void)sprintf(tempcolor[i], "%s", color[i]); 14565: } 14566: } 14567: 14568: void 14569: ColorSetODP(w, client_data, call_data) 14570: Widget w; 14571: XtPointer client_data; 14572: XtPointer call_data; 14573: { 14574: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14575: 14576: int i; 14577: void SetInitialColors(), SetColorSetBGandFG(); 14578: 14579: colorset = ODP_COLORSET; 14580: SetInitialColors(XtDisplay(w)); 14581: (void)SetColorSetBGandFG(); 14582: 14583: /* set the temp colors to the current colors using 14584: */ 14585: tempbgPixel = bgPixel; 14586: (void)sprintf(tempcolor[BG_COLOR], "%s", color[BG_COLOR]); 14587: for(i=1; i<NCOLOR; ++i) { 14588: tempfgPixel[i] = fgPixel[i]; 14589: (void)sprintf(tempcolor[i], "%s", color[i]); 14590: } 14591: } 14592: 14593: void 14594: ColorSetEarth(w, client_data, call_data) 14595: Widget w; 14596: XtPointer client_data; 14597: XtPointer call_data; 14598: { 14599: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14600: 14601: int i; 14602: void SetInitialColors(), SetColorSetBGandFG(); 14603: 14604: colorset = EARTH_COLORSET; 14605: SetInitialColors(XtDisplay(w)); 14606: (void)SetColorSetBGandFG(); 14607: 14608: /* set the temp colors to the current colors using 14609: */ 14610: tempbgPixel = bgPixel; 14611: (void)sprintf(tempcolor[BG_COLOR], "%s", color[BG_COLOR]); 14612: for(i=1; i<NCOLOR; ++i) { 14613: tempfgPixel[i] = fgPixel[i]; 14614: (void)sprintf(tempcolor[i], "%s", color[i]); 14615: } 14616: } 14617: 14618: void 14619: ColorSetOther(w, client_data, call_data) 14620: Widget w; 14621: XtPointer client_data; 14622: XtPointer call_data; 14623: { 14624: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14625: } 14626: 14627: void 14628: ColorSedRate(w, client_data, call_data) 14629: Widget w; 14630: XtPointer client_data; 14631: XtPointer call_data; 14632: { 14633: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14634: 14635: int item_count; 14636: char *rgbcolor; 14637: XmString *pcolor; 14638: Pixel sampPixel; 14639: int GetColorPixelValue(); 14640: 14641: /* get the selected color name from the list 14642: */ 14643: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 14644: XmNselectedItems,&pcolor, NULL); 14645: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 14646: 14647: /* and change the color of the core label button 14648: */ 14649: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 14650: XtVaSetValues(pushButtonColorSedRate, XmNbackground, sampPixel, NULL); 14651: 14652: XtVaSetValues(pushButtonColorSedRate, XmNlabelString, pcolor[0], NULL); 14653: (void)sprintf(tempcolor[SEDRATE_COLOR], "%s", rgbcolor); 14654: tempfgPixel[SEDRATE_COLOR] = sampPixel; 14655: XtFree(rgbcolor); 14656: } 14657: 14658: void 14659: ColorSetMaritime(w, client_data, call_data) 14660: Widget w; 14661: XtPointer client_data; 14662: XtPointer call_data; 14663: { 14664: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14665: 14666: int i; 14667: void SetInitialColors(), SetColorSetBGandFG(); 14668: 14669: colorset = MARITIME_COLORSET; 14670: SetInitialColors(XtDisplay(w)); 14671: (void)SetColorSetBGandFG(); 14672: 14673: /* set the temp colors to the current colors using 14674: */ 14675: tempbgPixel = bgPixel; 14676: (void)sprintf(tempcolor[BG_COLOR], "%s", color[BG_COLOR]); 14677: for(i=1; i<NCOLOR; ++i) { 14678: tempfgPixel[i] = fgPixel[i]; 14679: (void)sprintf(tempcolor[i], "%s", color[i]); 14680: } 14681: } 14682: 14683: void 14684: SaveAgeModelCancel(w, client_data, call_data) 14685: Widget w; 14686: XtPointer client_data; 14687: XtPointer call_data; 14688: { 14689: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14690: } 14691: 14692: void 14693: ColorSetCustome(w, client_data, call_data) 14694: Widget w; 14695: XtPointer client_data; 14696: XtPointer call_data; 14697: { 14698: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14699: 14700: int i; 14701: void SetInitialColors(), SetColorSetBGandFG(); 14702: 14703: colorset = CUSTOME_COLORSET; 14704: SetInitialColors(XtDisplay(w)); 14705: (void)SetColorSetBGandFG(); 14706: 14707: /* set the temp colors to the current colors using 14708: */ 14709: tempbgPixel = bgPixel; 14710: (void)sprintf(tempcolor[BG_COLOR], "%s", color[BG_COLOR]); 14711: for(i=1; i<NCOLOR; ++i) { 14712: tempfgPixel[i] = fgPixel[i]; 14713: (void)sprintf(tempcolor[i], "%s", color[i]); 14714: } 14715: } 14716: 14717: void 14718: SaveColorSettingsAsCustome(w, client_data, call_data) 14719: Widget w; 14720: XtPointer client_data; 14721: XtPointer call_data; 14722: { 14723: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14724: 14725: int i; 14726: void SetInitialColors(), SetColorSetBGandFG(); 14727: 14728: (void)sprintf(cust_color[BG_COLOR], "%s", tempcolor[BG_COLOR]); 14729: bgPixel = tempbgPixel; 14730: for(i=1; i<NCOLOR; ++i) { 14731: fgPixel[i] = tempfgPixel[i]; 14732: (void)sprintf(cust_color[i], "%s", tempcolor[i]); 14733: } 14734: 14735: colorset = CUSTOME_COLORSET; 14736: SetInitialColors(XtDisplay(w)); 14737: 14738: (void)SetColorSetBGandFG(); 14739: } 14740: 14741: void 14742: OpenAgeModel(w, client_data, call_data) 14743: Widget w; 14744: XtPointer client_data; 14745: XtPointer call_data; 14746: { 14747: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14748: 14749: char *str, *path; 14750: int len; 14751: XmString xmstring; 14752: 14753: void SpUpdateFileSelection(); 14754: 14755: XtManageChild(formFileSelection); 14756: XtPopup(XtParent(formFileSelection),XtGrabNone); 14757: xmstring=XmCvtCTToXmString("Read"); 14758: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 14759: XmStringFree(xmstring); 14760: 14761: fileselection = OPENAGEMODEL; 14762: 14763: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Open Age Model", NULL); 14764: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 14765: 14766: if((path=(char*)calloc((int)strlen(inagemodel_dirname)+1000,CHAR_SIZE))==NULL) 14767: SpBadMemAlloc("OpenSplicerTable"); 14768: (void)sprintf(path, "%s", inagemodel_dirname); 14769: 14770: len = (int)strlen(path); 14771: if(strcmp(&path[len-1], "/") == 0) { 14772: *strrchr(path,'/')= '\0'; 14773: } 14774: 14775: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 14776: SpBadMemAlloc("OpenSplicerTable"); 14777: } 14778: (void)sprintf(str,"%s/*", path); 14779: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 14780: free(str); 14781: 14782: XtVaSetValues(textFileSelectionSelected, XmNvalue, inagemodel_filename, NULL); 14783: 14784: SpUpdateFileSelection(FILE_FILTER, OPENAGEMODEL, path); 14785: (void)sprintf(preview_input_path,"%s",path); 14786: 14787: free(path); 14788: if(path) 14789: path = NULL; 14790: } 14791: 14792: void 14793: OpenStratDismiss(w, client_data, call_data) 14794: Widget w; 14795: XtPointer client_data; 14796: XtPointer call_data; 14797: { 14798: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14799: } 14800: 14801: void 14802: TopLevelDestroy(w, client_data, call_data) 14803: Widget w; 14804: XtPointer client_data; 14805: XtPointer call_data; 14806: { 14807: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14808: 14809: void exit(); 14810: 14811: printf("\nSplicer's windowed environment was destroyed by the main window's menu close option.\n"); 14812: printf("At present there is no way to recover. Must exit the program\n\n"); 14813: 14814: SpExit(); 14815: exit(0); 14816: } 14817: 14818: void 14819: SpSaveReportCB(w, client_data, call_data) 14820: Widget w; 14821: XtPointer client_data; 14822: XtPointer call_data; 14823: { 14824: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14825: } 14826: 14827: void 14828: Clear(w, client_data, call_data) 14829: Widget w; 14830: XtPointer client_data; 14831: XtPointer call_data; 14832: { 14833: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14834: 14835: char *pclient = (char*) client_data; 14836: XmTextPosition last_pos; 14837: 14838: if(have_data == DONT) { 14839: return; 14840: } 14841: 14842: if(*pclient == 'A') { 14843: 14844: if((did_affine == YES && saved_affine == NO) || (did_splicing == YES && saved_splice == NO) || 14845: (did_agemodel == YES && saved_agemodel == NO)) { 14846: last_pos=XmTextGetLastPosition(textWarnClear); 14847: XmTextInsert(textWarnClear,last_pos, "\n"); 14848: if(did_affine == YES && saved_affine == NO) { 14849: last_pos=XmTextGetLastPosition(textWarnClear); 14850: XmTextInsert(textWarnClear,last_pos," You have done compositing but you have not saved your work.\n"); 14851: } 14852: if(did_splicing == YES && saved_splice == NO) { 14853: last_pos=XmTextGetLastPosition(textWarnClear); 14854: XmTextInsert(textWarnClear,last_pos," You have done splicing but you have not saved your work.\n"); 14855: } 14856: if(did_agemodel == YES && saved_agemodel == NO) { 14857: last_pos=XmTextGetLastPosition(textWarnClear); 14858: XmTextInsert(textWarnClear,last_pos," You have done agemodelling but you have not saved your work.\n"); 14859: } 14860: 14861: last_pos=XmTextGetLastPosition(textWarnClear); 14862: XmTextInsert(textWarnClear,last_pos,"\n Your work will be lost if you clear.\n"); 14863: last_pos=XmTextGetLastPosition(textWarnClear); 14864: XmTextInsert(textWarnClear,last_pos," Please verify that you want to clear all data.\n"); 14865: XtManageChild(formWarnClear); 14866: clear_what = ALL; 14867: } 14868: else { 14869: XtManageChild(messageBoxClearWorkspace); 14870: } 14871: } 14872: 14873: else if(*pclient == 'C') { 14874: clear_what = INPUTDATA; 14875: } 14876: 14877: else if(*pclient == 'S' && have_splice == DO) { 14878: 14879: /* check if have been splicing but have not saved the work 14880: */ 14881: if(did_splicing == YES && saved_splice == NO) { 14882: last_pos=XmTextGetLastPosition(textWarnClear); 14883: XmTextInsert(textWarnClear,last_pos, "\n"); 14884: last_pos=XmTextGetLastPosition(textWarnClear); 14885: XmTextInsert(textWarnClear,last_pos," You have done splicing but you have not saved your work.\n"); 14886: last_pos=XmTextGetLastPosition(textWarnClear); 14887: XmTextInsert(textWarnClear,last_pos,"\n Your work will be lost if you clear.\n"); 14888: last_pos=XmTextGetLastPosition(textWarnClear); 14889: XmTextInsert(textWarnClear,last_pos," Please verify that you want to clear all data.\n"); 14890: XtManageChild(formWarnClear); 14891: clear_what = INPUTSPLICERTABLE; 14892: } 14893: else { 14894: SpCleanUp(INPUTSPLICERTABLE); 14895: } 14896: } 14897: 14898: else if(*pclient == 'D' && have_strat == DO) { 14899: clear_what = INPUTSTRAT; 14900: } 14901: 14902: else { 14903: clear_what = CANCEL; 14904: } 14905: } 14906: 14907: void 14908: VerifyExitCB(w, client_data, call_data) 14909: Widget w; 14910: XtPointer client_data; 14911: XtPointer call_data; 14912: { 14913: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14914: 14915: XmTextPosition last_pos; 14916: 14917: if(have_data == DO) { 14918: 14919: if((did_affine == YES && saved_affine == NO) || 14920: (have_splice == DO && did_splicing == YES && saved_splice == NO) || 14921: (have_strat == DO && did_agemodel == YES && saved_agemodel == NO)) { 14922: last_pos=XmTextGetLastPosition(textWarnExit); 14923: XmTextInsert(textWarnExit,last_pos,"\n"); 14924: if(did_affine == YES && saved_affine == NO) { 14925: last_pos=XmTextGetLastPosition(textWarnExit); 14926: XmTextInsert(textWarnExit,last_pos," You have done compositing but you have not saved your work.\n"); 14927: } 14928: if(have_splice == DO && did_splicing == YES && saved_splice == NO) { 14929: last_pos=XmTextGetLastPosition(textWarnExit); 14930: XmTextInsert(textWarnExit,last_pos," You have done splicing but you have not saved your work.\n"); 14931: } 14932: if(have_strat == DO && did_agemodel == YES && saved_agemodel == NO) { 14933: last_pos=XmTextGetLastPosition(textWarnExit); 14934: XmTextInsert(textWarnExit,last_pos," You have done agemodelling but you have not saved your work.\n"); 14935: } 14936: 14937: last_pos=XmTextGetLastPosition(textWarnExit); 14938: XmTextInsert(textWarnExit,last_pos,"\n Your work will be lost if you exit.\n"); 14939: last_pos=XmTextGetLastPosition(textWarnExit); 14940: XmTextInsert(textWarnExit,last_pos," Please verify that you want to exit the program.\n"); 14941: XtManageChild(formWarnExit); 14942: } 14943: else { 14944: XtManageChild(messageBoxExit); 14945: } 14946: } 14947: else { 14948: XtManageChild(messageBoxExit); 14949: } 14950: } 14951: 14952: void 14953: WarnExitOK(w, client_data, call_data) 14954: Widget w; 14955: XtPointer client_data; 14956: XtPointer call_data; 14957: { 14958: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14959: 14960: XmTextPosition last_pos; 14961: 14962: last_pos=XmTextGetLastPosition(textWarnExit); 14963: 14964: XmTextReplace(textWarnExit, 0, last_pos, ""); 14965: 14966: XtUnmanageChild(formWarnExit); 14967: 14968: SpExitCB((Widget)NULL, 0, (XtPointer)NULL); 14969: } 14970: 14971: void 14972: WarnClearCancel(w, client_data, call_data) 14973: Widget w; 14974: XtPointer client_data; 14975: XtPointer call_data; 14976: { 14977: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14978: 14979: XmTextPosition last_pos; 14980: 14981: last_pos=XmTextGetLastPosition(textWarnClear); 14982: 14983: XmTextReplace(textWarnClear, 0, last_pos, ""); 14984: 14985: XtUnmanageChild(formWarnClear); 14986: } 14987: 14988: void 14989: WarnExitCancel(w, client_data, call_data) 14990: Widget w; 14991: XtPointer client_data; 14992: XtPointer call_data; 14993: { 14994: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 14995: 14996: XmTextPosition last_pos; 14997: 14998: last_pos=XmTextGetLastPosition(textWarnExit); 14999: 15000: XmTextReplace(textWarnExit, 0, last_pos, ""); 15001: 15002: XtUnmanageChild(formWarnExit); 15003: } 15004: 15005: void 15006: WarnClearOK(w, client_data, call_data) 15007: Widget w; 15008: XtPointer client_data; 15009: XtPointer call_data; 15010: { 15011: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15012: 15013: XmTextPosition last_pos; 15014: 15015: last_pos=XmTextGetLastPosition(textWarnClear); 15016: 15017: XmTextReplace(textWarnClear, 0, last_pos, ""); 15018: 15019: XtUnmanageChild(formWarnClear); 15020: 15021: /* clear all the data 15022: */ 15023: SpCleanUp(clear_what); 15024: } 15025: 15026: void 15027: ExitCB(w, client_data, call_data) 15028: Widget w; 15029: XtPointer client_data; 15030: XtPointer call_data; 15031: { 15032: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15033: } 15034: 15035: void 15036: OpenFormatsOtherCancel(w, client_data, call_data) 15037: Widget w; 15038: XtPointer client_data; 15039: XtPointer call_data; 15040: { 15041: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15042: 15043: XtUnmanageChild(formOpenFormatsOther); 15044: } 15045: 15046: void 15047: OpenFormatsOtherOK(w, client_data, call_data) 15048: Widget w; 15049: XtPointer client_data; 15050: XtPointer call_data; 15051: { 15052: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15053: 15054: XtUnmanageChild(formOpenFormatsOther); 15055: } 15056: 15057: void 15058: CullActivate(w, client_data, call_data) 15059: Widget w; 15060: XtPointer client_data; 15061: XtPointer call_data; 15062: { 15063: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15064: } 15065: 15066: void 15067: DecimateActivate(w, client_data, call_data) 15068: Widget w; 15069: XtPointer client_data; 15070: XtPointer call_data; 15071: { 15072: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15073: } 15074: 15075: void 15076: DetrendActivate(w, client_data, call_data) 15077: Widget w; 15078: XtPointer client_data; 15079: XtPointer call_data; 15080: { 15081: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15082: } 15083: 15084: void 15085: DataSetActivate(w, client_data, call_data) 15086: Widget w; 15087: XtPointer client_data; 15088: XtPointer call_data; 15089: { 15090: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15091: 15092: int i, k, sm, olddset, oldsplhole, oldsplcore, oldsplarray, newtiehole, newtiecore, newtiearray, 15093: err, err2, top, bot, hole, core, num, 15094: spltiecore, spl_last_core_exist; 15095: char *pclient = (char*) client_data; 15096: char idstring[100], string[20], *str; 15097: char spltiename; 15098: float depth, diff, checkdepth, chlow, chhigh, raw_val, sm_val, *var_val, var, 15099: avedep, avedep1, avedep2, spltiedepth; 15100: XmString xmstring; 15101: int MakeSplice(), FindValueInCoreToSplice(), FindAveDepth(); 15102: void SetMinMax(), DrawDrawingAreaEdit(), DrawDrawingAreaView(), DrawDrawingAreaDepthOffset(), PlotSpliceVsAge(), 15103: WaitCursor(), TieCorrelate(), SpliceCorrelate(); 15104: 15105: WaitCursor(DEFINEWAITCURSOR); 15106: 15107: olddset = dset; 15108: 15109: if(*pclient == '1') { 15110: dset = 0; 15111: } 15112: else if(*pclient == '2') { 15113: dset = 1; 15114: } 15115: else if(*pclient == '3') { 15116: dset = 2; 15117: } 15118: else if(*pclient == '4') { 15119: dset = 3; 15120: } 15121: else if(*pclient == '5') { 15122: dset = 4; 15123: } 15124: else if(*pclient == '6') { 15125: dset = 5; 15126: } 15127: else if(*pclient == '7') { 15128: dset = 6; 15129: } 15130: else if(*pclient == '8') { 15131: dset = 7; 15132: } 15133: else if(*pclient == '9') { 15134: dset = 8; 15135: } 15136: else { 15137: } 15138: 15139: /* if are composing and have a tie find the nearest 15140: sample for tie in new dataset 15141: */ 15142: if(are_compositing == YES) { 15143: if(have_tie1 == YES) { 15144: /* check that tie1 hole and core exists in new datset 15145: */ 15146: newtiehole = -1; 15147: for(i=0; i<data[dset]->numholes; ++i) { 15148: if(data[dset]->holes[i]->name == data[olddset]->holes[tie1holenum]->name) { 15149: newtiehole = i; 15150: } 15151: } 15152: if(newtiehole == -1) { 15153: have_tie1 = DONT; 15154: } 15155: else { 15156: newtiecore = -1; 15157: for(i=0; i<data[dset]->holes[newtiehole]->numcores; ++i) { 15158: if(data[dset]->holes[newtiehole]->core[i]->num == data[olddset]->holes[tie1holenum]->core[tie1corenum]->num) { 15159: newtiecore = i; 15160: } 15161: } 15162: if(newtiecore == -1) { 15163: have_tie1 = DONT; 15164: } 15165: else { 15166: newtiearray = -1; 15167: depth = data[olddset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth; 15168: diff = 99999.0; 15169: for(i=0; i<data[dset]->holes[newtiehole]->core[newtiecore]->numvalues; ++i) { 15170: if(data[dset]->holes[newtiehole]->core[newtiecore]->value[i]->quality != GOOD) { 15171: } 15172: else { 15173: checkdepth = depth - data[dset]->holes[newtiehole]->core[newtiecore]->value[i]->sb_depth; 15174: if(fabs(checkdepth) < diff) { 15175: diff = fabs(checkdepth); 15176: newtiearray = i; 15177: } 15178: } 15179: } 15180: if(newtiearray == -1) { 15181: have_tie1 = DONT; 15182: } 15183: else { 15184: tie1holenum = newtiehole; 15185: tie1corenum = newtiecore; 15186: tie1arraynum = newtiearray; 15187: } 15188: } 15189: } 15190: if(have_tie1 == DO) { 15191: var_val = data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->data; 15192: depth = data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth + 15193: data[dset]->holes[tie1holenum]->core[tie1corenum]->cum_dep_offset; 15194: (void)sprintf(idstring,"%d %c %d %c %s %.1f %.2f", 15195: data[dset]->site, 15196: data[dset]->holes[tie1holenum]->name, 15197: data[dset]->holes[tie1holenum]->core[tie1corenum]->num, 15198: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->type, 15199: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->section, 15200: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->top_int, 15201: data[dset]->holes[tie1holenum]->core[tie1corenum]->value[tie1arraynum]->sb_depth); 15202: xmstring = XmStringCreateSimple(idstring); 15203: XtVaSetValues(labelTie1ID, XmNlabelString, xmstring, NULL); 15204: XmStringFree(xmstring); 15205: (void)sprintf(string, "%.2f", *var_val); 15206: xmstring = XmStringCreateSimple(string); 15207: XtVaSetValues(labelTie1var, XmNlabelString, xmstring, NULL); 15208: XmStringFree(xmstring); 15209: (void)sprintf(string, "%.2f", depth); 15210: xmstring = XmStringCreateSimple(string); 15211: XtVaSetValues(labelTie1sbd, XmNlabelString, xmstring, NULL); 15212: XmStringFree(xmstring); 15213: } 15214: else { 15215: xmstring = XmStringCreateSimple(""); 15216: XtVaSetValues(labelTie1ID, XmNlabelString, xmstring, NULL); 15217: XtVaSetValues(labelTie1var, XmNlabelString, xmstring, NULL); 15218: XtVaSetValues(labelTie1sbd, XmNlabelString, xmstring, NULL); 15219: XmStringFree(xmstring); 15220: } 15221: } 15222: if(have_tie2 == YES) { 15223: /* check that tie1 hole and core exists in new datset 15224: */ 15225: newtiehole = -1; 15226: for(i=0; i<data[dset]->numholes; ++i) { 15227: if(data[dset]->holes[i]->name == data[olddset]->holes[tie2holenum]->name) { 15228: newtiehole = i; 15229: } 15230: } 15231: if(newtiehole == -1) { 15232: have_tie2 = DONT; 15233: } 15234: else { 15235: newtiecore = -1; 15236: for(i=0; i<data[dset]->holes[newtiehole]->numcores; ++i) { 15237: if(data[dset]->holes[newtiehole]->core[i]->num == data[olddset]->holes[tie2holenum]->core[tie2corenum]->num) { 15238: newtiecore = i; 15239: } 15240: } 15241: if(newtiecore == -1) { 15242: have_tie2 = DONT; 15243: } 15244: else { 15245: newtiearray = -1; 15246: depth = data[olddset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth; 15247: diff = 99999.0; 15248: for(i=0; i<data[dset]->holes[newtiehole]->core[newtiecore]->numvalues; ++i) { 15249: if(data[dset]->holes[newtiehole]->core[newtiecore]->value[i]->quality != GOOD) { 15250: } 15251: else { 15252: checkdepth = depth - data[dset]->holes[newtiehole]->core[newtiecore]->value[i]->sb_depth; 15253: if(fabs(checkdepth) < diff) { 15254: diff = fabs(checkdepth); 15255: newtiearray = i; 15256: } 15257: } 15258: } 15259: if(newtiearray == -1) { 15260: have_tie2 = DONT; 15261: } 15262: else { 15263: tie2holenum = newtiehole; 15264: tie2corenum = newtiecore; 15265: tie2arraynum = newtiearray; 15266: } 15267: } 15268: } 15269: if(have_tie2 == DO) { 15270: var_val = data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->data; 15271: depth = data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth + 15272: data[dset]->holes[tie2holenum]->core[tie2corenum]->cum_dep_offset; 15273: (void)sprintf(idstring,"%d %c %d %c %s %.1f %.2f", 15274: data[dset]->site, 15275: data[dset]->holes[tie2holenum]->name, 15276: data[dset]->holes[tie2holenum]->core[tie2corenum]->num, 15277: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->type, 15278: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->section, 15279: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->top_int, 15280: data[dset]->holes[tie2holenum]->core[tie2corenum]->value[tie2arraynum]->sb_depth); 15281: xmstring = XmStringCreateSimple(idstring); 15282: XtVaSetValues(labelTie2ID, XmNlabelString, xmstring, NULL); 15283: XmStringFree(xmstring); 15284: (void)sprintf(string, "%.2f", *var_val); 15285: xmstring = XmStringCreateSimple(string); 15286: XtVaSetValues(labelTie2var, XmNlabelString, xmstring, NULL); 15287: XmStringFree(xmstring); 15288: (void)sprintf(string, "%.2f", depth); 15289: xmstring = XmStringCreateSimple(string); 15290: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 15291: XmStringFree(xmstring); 15292: } 15293: else { 15294: xmstring = XmStringCreateSimple(""); 15295: XtVaSetValues(labelTie2ID, XmNlabelString, xmstring, NULL); 15296: XtVaSetValues(labelTie2var, XmNlabelString, xmstring, NULL); 15297: XtVaSetValues(labelTie2sbd, XmNlabelString, xmstring, NULL); 15298: XmStringFree(xmstring); 15299: } 15300: } 15301: if(have_tie1 == DO && have_tie2 == DO) { 15302: have_shift = DO; 15303: /* calculate the average depth step for current 15304: 'tied' cores. and set the text fields with 15305: ave depth step, default window length 15306: and lead,lag 15307: */ 15308: err = FindAveDepth(tie1holenum, tie1corenum, &avedep1); 15309: err2 = FindAveDepth(tie2holenum, tie2corenum, &avedep2); 15310: if(err > 1 || err2 > 1) { 15311: avedep = 0.05; 15312: } 15313: else { 15314: avedep = (avedep1 + avedep2)/2.0; 15315: } 15316: 15317: /* set the text field with ave depth 15318: */ 15319: str = XmTextGetString(textFieldTieDepthStep); 15320: (void)sprintf(string, "%.2f", avedep); 15321: if((int)strcmp(str, string) != 0) { 15322: XtVaSetValues(textFieldTieDepthStep, XmNvalue, string, NULL); 15323: } 15324: XtFree(str); 15325: 15326: /* make clear and correlate buttons sensitive 15327: */ 15328: XtSetSensitive(pushButtonTieClear, True); 15329: XtSetSensitive(pushButtonTieCorrelation, True); 15330: XtSetSensitive(pushButtonTieShift, True); 15331: XtVaSetValues(pushButtonTieShift, XmNborderWidth, 1, NULL); 15332: XtSetSensitive(textFieldTieAdjustDepth, True); 15333: XtSetSensitive(toggleButtonTieShiftBestCorr, True); 15334: XtSetSensitive(toggleButtonTieShiftTie, True); 15335: XtSetSensitive(toggleButtonTieShiftGiven, True); 15336: XtSetSensitive(toggleButtonTieShiftAll, True); 15337: XtSetSensitive(toggleButtonTieShiftCore, True); 15338: XtSetSensitive(pushButtonTieShiftUndo, False); 15339: XtSetSensitive(toggleButtonTieUndoLast, False); 15340: XtSetSensitive(toggleButtonTieUndoAll, False); 15341: 15342: /* set the toggles back to defaults 15343: */ 15344: XmToggleButtonSetState(toggleButtonTieShiftBestCorr, True, NULL); 15345: XmToggleButtonSetState(toggleButtonTieShiftTie, False, NULL); 15346: XmToggleButtonSetState(toggleButtonTieShiftGiven, False, NULL); 15347: XmToggleButtonSetState(toggleButtonTieShiftAll, True, NULL); 15348: XmToggleButtonSetState(toggleButtonTieShiftCore, False, NULL); 15349: 15350: TieCorrelate((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 15351: } 15352: else { 15353: have_shift = DONT; 15354: 15355: XtSetSensitive(pushButtonTieClear, FALSE); 15356: XtSetSensitive(pushButtonTieCorrelation, FALSE); 15357: XtSetSensitive(pushButtonTieShift, FALSE); 15358: XtVaSetValues(pushButtonTieShift, XmNborderWidth, 1, NULL); 15359: XtSetSensitive(textFieldTieAdjustDepth, False); 15360: XtSetSensitive(toggleButtonTieShiftBestCorr, False); 15361: XtSetSensitive(toggleButtonTieShiftTie, False); 15362: XtSetSensitive(toggleButtonTieShiftGiven, False); 15363: XtSetSensitive(toggleButtonTieShiftAll, False); 15364: XtSetSensitive(toggleButtonTieShiftCore, False); 15365: if(have_tie1 == DO || have_tie2 == DO) { 15366: XtSetSensitive(pushButtonTieShiftUndo, False); 15367: XtSetSensitive(toggleButtonTieUndoLast, False); 15368: XtSetSensitive(toggleButtonTieUndoAll, False); 15369: } 15370: } 15371: } 15372: 15373: /* if have the splice table make the splice for new data set 15374: and if have a tie point in the splice save its hole name, 15375: core number and depth 15376: */ 15377: if(have_splice == DO) { 15378: if(are_splicing > NO && spcomp.numcores > 0) { 15379: spltiename = data[olddset]->holes[spcomp.hole[spcomp.numcores-1]]->name; 15380: spltiecore = data[olddset]->holes[spcomp.hole[spcomp.numcores-1]]->core[spcomp.core[spcomp.numcores-1]]->num; 15381: if(have_sp_tie1 == DO) { 15382: spltiedepth = spcomp.sb_depth[spcomp.numcores-1][spcomparraynum]; 15383: } 15384: if(have_sp_tie2 == DO) { 15385: oldsplhole = spliceholenum; 15386: oldsplcore = splicecorenum; 15387: oldsplarray = splicearraynum; 15388: } 15389: } 15390: MakeSplice(dset, &spcomp); 15391: } 15392: 15393: 15394: /* if are splicing and have a core to splice 15395: */ 15396: if(have_splice == DO && are_splicing > NO && have_core_to_splice == DO) { 15397: 15398: /* for current data set does the last core of splice exist 15399: */ 15400: if(spcomp.numcores > 0) { 15401: hole = spcomp.hole[spcomp.numcores-1]; 15402: core = spcomp.core[spcomp.numcores-1]; 15403: if(data[dset]->holes[hole]->name == spltiename && 15404: data[dset]->holes[hole]->core[core]->num == spltiecore) { 15405: spcompcorenum = spcomp.numcores-1; 15406: spl_last_core_exist = YES; 15407: } 15408: else { 15409: spl_last_core_exist = NO; 15410: } 15411: } 15412: else { 15413: spl_last_core_exist = NO; 15414: } 15415: 15416: /* for current data set does core to splice exist 15417: */ 15418: if(have_core_to_splice == DO) { 15419: newtiehole = -1; 15420: for(i=0; i<data[dset]->numholes; ++i) { 15421: if(data[dset]->holes[i]->name == data[olddset]->holes[spliceholenum]->name) { 15422: newtiehole = i; 15423: break; 15424: } 15425: } 15426: if(newtiehole == -1) { 15427: have_core_to_splice = DONT; 15428: } 15429: else { 15430: spliceholenum = newtiehole; 15431: newtiecore = -1; 15432: for(i=0; i<data[dset]->holes[newtiehole]->numcores; ++i) { 15433: if(data[dset]->holes[newtiehole]->core[i]->num == 15434: data[olddset]->holes[spliceholenum]->core[splicecorenum]->num) { 15435: newtiecore = i; 15436: break; 15437: } 15438: } 15439: if(newtiecore == -1) { 15440: have_core_to_splice = DONT; 15441: } 15442: else { 15443: splicecorenum = newtiecore; 15444: } 15445: } 15446: } 15447: else { 15448: } 15449: 15450: /* check for overlap, if none allow append 15451: */ 15452: if(have_core_to_splice == DO && spl_last_core_exist == YES) { 15453: i = 0; 15454: while(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->quality != GOOD && 15455: i < data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues-1) { 15456: ++i; 15457: } 15458: depth = data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->sb_depth + 15459: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 15460: if(depth <= spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1]) { 15461: if(ALLOWAPPENDOVERLAP + depth >= spcomp.sb_depth[spcomp.numcores-1][spcomp.numpercore[spcomp.numcores-1]-1]) { 15462: XtSetSensitive(pushButtonAppendSplice, True); 15463: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 1, NULL); 15464: splice_overlap = OVERLAPAPPEND; 15465: } 15466: else { 15467: XtSetSensitive(pushButtonAppendSplice, False); 15468: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 15469: splice_overlap = YES; 15470: } 15471: } 15472: else { 15473: XtSetSensitive(pushButtonAppendSplice, True); 15474: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 1, NULL); 15475: splice_overlap = NO; 15476: have_sp_tie1 = DONT; 15477: have_sp_tie2 = DONT; 15478: } 15479: } 15480: else if(have_core_to_splice == DONT || spl_last_core_exist == NO) { 15481: have_sp_tie1 = DONT; 15482: have_sp_tie2 = DONT; 15483: XtSetSensitive(pushButtonAppendSplice, False); 15484: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 15485: } 15486: 15487: if(have_sp_tie1 == DO && spl_last_core_exist == YES) { 15488: newtiearray = -1; 15489: diff = 99999.0; 15490: for(i=0; i<spcomp.numpercore[spcompcorenum]; ++i) { 15491: checkdepth = spltiedepth - spcomp.sb_depth[spcompcorenum][i]; 15492: if(fabs(checkdepth) < diff) { 15493: diff = fabs(checkdepth); 15494: newtiearray = i; 15495: } 15496: } 15497: if(newtiearray == -1) { 15498: have_sp_tie1 = DONT; 15499: } 15500: else { 15501: spcomparraynum = newtiearray; 15502: spltiedepth = spcomp.sb_depth[spcompcorenum][spcomparraynum]; 15503: } 15504: } 15505: else { 15506: have_sp_tie1 = DONT; 15507: } 15508: 15509: if(are_splicing == CONSTRAINED && have_sp_tie1 == DONT) { 15510: have_sp_tie2 == DONT; 15511: } 15512: else if(have_sp_tie2 == DO && have_core_to_splice == DO) { 15513: 15514: newtiearray = -1; 15515: if(are_splicing == CONSTRAINED) { 15516: top = -1; 15517: bot = -1; 15518: for(k=0; k<data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues; ++k){ 15519: if(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->quality == GOOD) { 15520: top = k; 15521: break; 15522: } 15523: } 15524: for(k=data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues-1; k>=0; --k){ 15525: if(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[k]->quality == GOOD) { 15526: bot = k; 15527: break; 15528: } 15529: } 15530: if(top != -1 && bot != -1) { 15531: chlow=data[dset]->holes[spliceholenum]->core[splicecorenum]->value[top]->sb_depth + 15532: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 15533: chhigh= data[dset]->holes[spliceholenum]->core[splicecorenum]->value[bot]->sb_depth + 15534: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset; 15535: } 15536: 15537: if(top == -1 || bot == -1) { 15538: have_sp_tie1 = DONT; 15539: have_sp_tie2 = DONT; 15540: } 15541: else if(chlow >= chhigh) { 15542: have_sp_tie1 = DONT; 15543: have_sp_tie2 = DONT; 15544: } 15545: else if(spltiedepth < chlow || spltiedepth > chhigh){ 15546: have_sp_tie1 = DONT; 15547: have_sp_tie2 = DONT; 15548: (void)sprintf(buffer,"Warning: For current data set the tie in the splice no longer overlaps the core to splice."); 15549: SpManageWarningBox(buffer); 15550: } 15551: else { 15552: 15553: if(smooth.plot == NONE || smooth.plot == UNSMOOTHED){ 15554: sm = NO; 15555: } 15556: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 15557: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 15558: sm = YES; 15559: } 15560: else { 15561: sm = NO; 15562: } 15563: 15564: /* note that if find real value at 'depth' then splicearraynum comes back 15565: with indicy of real point. but if interpolated a point then splicearraynum 15566: is the indicy of next real point. 15567: */ 15568: err = FindValueInCoreToSplice(dset, sm, spltiedepth, spliceholenum, splicecorenum, 15569: &newtiearray, &splice_how, &raw_val, &sm_val); 15570: if(err != 0 || newtiearray == -1) { 15571: have_sp_tie1 = DONT; 15572: have_sp_tie2 = DONT; 15573: } 15574: else if(err == 0) { 15575: splicearraynum = newtiearray; 15576: have_sp_tie2 = YES; 15577: interpsplice_val = raw_val; 15578: interpsplice_sm_val = sm_val; 15579: interpsplice_spl_depth = spltiedepth; 15580: } 15581: } 15582: } 15583: else if(are_splicing == UNCONSTRAINED && have_core_to_splice == DO) { 15584: diff = 99999.0; 15585: depth = data[olddset]->holes[oldsplhole]->core[oldsplcore]->value[oldsplarray]->sb_depth + 15586: data[olddset]->holes[oldsplhole]->core[oldsplcore]->cum_dep_offset; 15587: for(i=0; i<data[dset]->holes[spliceholenum]->core[splicecorenum]->numvalues; ++i){ 15588: if(data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->quality != GOOD){ 15589: } 15590: else { 15591: checkdepth = depth - (data[dset]->holes[spliceholenum]->core[splicecorenum]->value[i]->sb_depth + 15592: data[dset]->holes[spliceholenum]->core[splicecorenum]->cum_dep_offset); 15593: if(fabs(checkdepth) < diff) { 15594: diff = fabs(checkdepth); 15595: newtiearray= i; 15596: } 15597: } 15598: } 15599: if(newtiearray == 0) { 15600: have_sp_tie1 = DONT; 15601: have_sp_tie2 = DONT; 15602: } 15603: else { 15604: splicearraynum = newtiearray; 15605: have_sp_tie2 = YES; 15606: splice_how = REAL; 15607: } 15608: } 15609: } 15610: else { 15611: have_sp_tie2 = DONT; 15612: } 15613: 15614: if(have_sp_tie1 == DO) { 15615: hole = spcomp.hole[spcompcorenum]; 15616: core = spcomp.core[spcompcorenum]; 15617: num = spcomp.MapToOrig[spcompcorenum][spcomparraynum]; 15618: depth = spcomp.sb_depth[spcompcorenum][spcomparraynum]; 15619: var = spcomp.var[spcompcorenum][spcomparraynum]; 15620: (void)sprintf(idstring,"%d %c %d %c %s %.1f %.2f", 15621: data[dset]->site, 15622: data[dset]->holes[hole]->name, 15623: data[dset]->holes[hole]->core[core]->num, 15624: data[dset]->holes[hole]->core[core]->value[num]->type, 15625: data[dset]->holes[hole]->core[core]->value[num]->section, 15626: data[dset]->holes[hole]->core[core]->value[num]->top_int, 15627: data[dset]->holes[hole]->core[core]->value[num]->sb_depth); 15628: xmstring = XmStringCreateSimple(idstring); 15629: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 15630: XmStringFree(xmstring); 15631: (void)sprintf(string, "%.2f", var); 15632: xmstring = XmStringCreateSimple(string); 15633: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 15634: XmStringFree(xmstring); 15635: (void)sprintf(string, "%.2f", depth); 15636: xmstring = XmStringCreateSimple(string); 15637: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 15638: XmStringFree(xmstring); 15639: } 15640: else { 15641: xmstring = XmStringCreateSimple(""); 15642: XtVaSetValues(labelSpliceTie1ID, XmNlabelString, xmstring, NULL); 15643: XtVaSetValues(labelSpliceTie1var, XmNlabelString, xmstring, NULL); 15644: XtVaSetValues(labelSpliceTie1sbd, XmNlabelString, xmstring, NULL); 15645: XmStringFree(xmstring); 15646: } 15647: if(have_sp_tie2 == DO) { 15648: hole = spliceholenum; 15649: core = splicecorenum; 15650: num = splicearraynum; 15651: if(splice_how == INTERPOLATED){ 15652: (void)sprintf(idstring,"%d %c %d %c interpolated", 15653: data[dset]->site, 15654: data[dset]->holes[hole]->name, 15655: data[dset]->holes[hole]->core[core]->num, 15656: data[dset]->holes[hole]->core[core]->value[num]->type); 15657: depth = interpsplice_spl_depth; 15658: var = interpsplice_val; 15659: } 15660: else if(splice_how == REAL) { 15661: depth = (data[dset]->holes[hole]->core[core]->value[num]->sb_depth + 15662: data[dset]->holes[hole]->core[core]->cum_dep_offset); 15663: var = *data[dset]->holes[hole]->core[core]->value[num]->data; 15664: (void)sprintf(idstring,"%d %c %d %c %s %.1f %.2f", 15665: data[dset]->site, 15666: data[dset]->holes[hole]->name, 15667: data[dset]->holes[hole]->core[core]->num, 15668: data[dset]->holes[hole]->core[core]->value[num]->type, 15669: data[dset]->holes[hole]->core[core]->value[num]->section, 15670: data[dset]->holes[hole]->core[core]->value[num]->top_int, 15671: data[dset]->holes[hole]->core[core]->value[num]->sb_depth); 15672: } 15673: xmstring = XmStringCreateSimple(idstring); 15674: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 15675: XmStringFree(xmstring); 15676: (void)sprintf(string, "%.2f", var); 15677: xmstring = XmStringCreateSimple(string); 15678: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 15679: XmStringFree(xmstring); 15680: (void)sprintf(string, "%.2f", depth); 15681: xmstring = XmStringCreateSimple(string); 15682: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 15683: XmStringFree(xmstring); 15684: } 15685: else { 15686: xmstring = XmStringCreateSimple(""); 15687: XtVaSetValues(labelSpliceTie2ID, XmNlabelString, xmstring, NULL); 15688: XtVaSetValues(labelSpliceTie2var, XmNlabelString, xmstring, NULL); 15689: XtVaSetValues(labelSpliceTie2sbd, XmNlabelString, xmstring, NULL); 15690: XmStringFree(xmstring); 15691: } 15692: 15693: if(have_sp_tie1 == DO && have_sp_tie2 == DO) { 15694: 15695: have_splice_tie = DO; 15696: have_splice_shift = DO; 15697: 15698: /* calculate the average depth step for current 15699: 'tied' cores. and set the text fields with 15700: ave depth step, default window length 15701: and lead,lag 15702: */ 15703: err = FindAveDepth(spcomp.hole[spcompcorenum], spcomp.core[spcompcorenum], &avedep1); 15704: err2 = FindAveDepth(spliceholenum, splicecorenum, &avedep2); 15705: if(err > 1 || err2 > 1) { 15706: avedep = 0.05; 15707: } 15708: else { 15709: avedep = (avedep1 + avedep2)/2.0; 15710: } 15711: 15712: /* set the text field with ave depth 15713: */ 15714: str = XmTextGetString(textCompDepthStep); 15715: (void)sprintf(string, "%.2f", avedep); 15716: if((int)strcmp(str, string) != 0) { 15717: XtVaSetValues(textCompDepthStep, XmNvalue, string, NULL); 15718: } 15719: XtFree(str); 15720: 15721: /* calculate the difference in value at the tie (tie1 - tie2) and write it to text 15722: */ 15723: diff = spcomp.var[spcompcorenum][spcomparraynum] - interpsplice_val; 15724: (void)sprintf(string, "%.2f", diff); 15725: xmstring = XmStringCreateSimple(string); 15726: XtVaSetValues(labelSpliceDifferenceInValue, XmNlabelString, xmstring, NULL); 15727: XmStringFree(xmstring); 15728: 15729: /* make the clear tie and correlate buttons sensitive 15730: and the grab core insensitive. should not be able 15731: to grab another core until clear tie or splice 15732: */ 15733: XtSetSensitive(pushButtonClearGrab, False); 15734: XtSetSensitive(pushButtonSpliceClearTie, True); 15735: XtSetSensitive(pushButtonSpliceCorrelate, True); 15736: XtSetSensitive(pushButtonGetSelectCore, False); 15737: XtSetSensitive(pushButtonSuggestTies, False); 15738: XtSetSensitive(pushButtonSpliceToTie, True); 15739: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 1, NULL); 15740: XtSetSensitive(pushButtonSpliceUndoLast, False); 15741: 15742: SpliceCorrelate((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 15743: } 15744: else { 15745: have_splice_tie = DONT; 15746: have_splice_shift = DONT; 15747: have_spcorr = DONT; 15748: 15749: XtSetSensitive(pushButtonSpliceClearTie, False); 15750: XtSetSensitive(pushButtonSpliceCorrelate, False); 15751: XtSetSensitive(pushButtonGetSelectCore, True); 15752: XtSetSensitive(pushButtonSuggestTies, False); 15753: XtSetSensitive(pushButtonSpliceToTie, False); 15754: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 15755: if(have_core_to_splice == DO) { 15756: XtSetSensitive(pushButtonClearGrab, True); 15757: XtSetSensitive(pushButtonSpliceUndoLast, False); 15758: } 15759: else if(have_core_to_splice == DONT) { 15760: XtSetSensitive(pushButtonClearGrab, False); 15761: XtSetSensitive(pushButtonSpliceUndoLast, True); 15762: } 15763: 15764: /* and clear the correlation window 15765: */ 15766: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 15767: XClearWindow(XtDisplay(drawingAreaCompCorrelation), 15768: XtWindow(drawingAreaCompCorrelation)); 15769: } 15770: } 15771: } 15772: 15773: else if(have_splice == DO && are_splicing > NO && have_core_to_splice == DONT) { 15774: have_sp_tie1 = DONT; 15775: have_sp_tie2 = DONT; 15776: have_splice_tie = DONT; 15777: have_splice_shift = DONT; 15778: have_spcorr = DONT; 15779: 15780: XtSetSensitive(pushButtonClearGrab, False); 15781: XtSetSensitive(pushButtonSpliceClearTie, False); 15782: XtSetSensitive(pushButtonSpliceCorrelate, False); 15783: XtSetSensitive(pushButtonGetSelectCore, True); 15784: XtSetSensitive(pushButtonAppendSplice, False); 15785: XtVaSetValues(pushButtonAppendSplice, XmNborderWidth, 0, NULL); 15786: XtSetSensitive(pushButtonSuggestTies, False); 15787: XtSetSensitive(pushButtonSpliceToTie, False); 15788: XtVaSetValues(pushButtonSpliceToTie, XmNborderWidth, 0, NULL); 15789: XtSetSensitive(pushButtonSpliceUndoLast, True); 15790: 15791: /* and clear the correlation window 15792: */ 15793: if(XtIsManaged(XtParent(drawingAreaCompCorrelation))) { 15794: XClearWindow(XtDisplay(drawingAreaCompCorrelation), 15795: XtWindow(drawingAreaCompCorrelation)); 15796: } 15797: } 15798: 15799: SetMinMax(dset); 15800: 15801: if(data[dset]->numholes > 1) { 15802: XtSetSensitive(pushButtonComposite,True); 15803: XtSetSensitive(cascadeButtonSplice,True); 15804: } 15805: else { 15806: XtSetSensitive(pushButtonComposite, False); 15807: XtSetSensitive(cascadeButtonSplice, False); 15808: } 15809: 15810: if(XtIsManaged(XtParent(drawingAreaEdit))) { 15811: reason_for_redraw = DRAW_EVERYTHING; 15812: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 15813: } 15814: 15815: if(have_splice == DO) { 15816: if(XtIsManaged(XtParent(drawingAreaView))) { 15817: reason_for_redraw = DRAW_EVERYTHING; 15818: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 15819: } 15820: } 15821: 15822: /* draw the depth offsets 15823: */ 15824: if(draw_offsets == YES){ 15825: if(XtIsManaged(XtParent(drawingAreaDepthOffset))) { 15826: DrawDrawingAreaDepthOffset(drawingAreaDepthOffset, (XtPointer)NULL, (XtPointer)NULL); 15827: } 15828: } 15829: 15830: if(are_agemodelling == YES) { 15831: if(have_time_series == DO) { 15832: have_splicetoage_tie = DONT; 15833: have_timeseries_tie = DONT; 15834: } 15835: PlotSpliceVsAge(NO); 15836: } 15837: 15838: WaitCursor(FREEWAITCURSOR); 15839: } 15840: 15841: void 15842: SmoothActivate(w, client_data, call_data) 15843: Widget w; 15844: XtPointer client_data; 15845: XtPointer call_data; 15846: { 15847: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15848: } 15849: 15850: void 15851: OpenAgeSignal(w, client_data, call_data) 15852: Widget w; 15853: XtPointer client_data; 15854: XtPointer call_data; 15855: { 15856: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15857: 15858: int len; 15859: char *str, *path; 15860: XmString xmstring; 15861: 15862: void SpUpdateFileSelection(); 15863: 15864: XtManageChild(formFileSelection); 15865: XtPopup(XtParent(formFileSelection),XtGrabNone); 15866: xmstring=XmCvtCTToXmString("Read"); 15867: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 15868: XmStringFree(xmstring); 15869: 15870: fileselection = OPENTIMESERIES; 15871: 15872: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Open Time Series", NULL); 15873: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 15874: XtManageChild(formFileSelectionTimeSeries); 15875: XtVaSetValues(formFileSelectionTimeSeries, XmNmappedWhenManaged, True, NULL); 15876: XtVaSetValues(XtParent(formFileSelection), XmNheight, 720, NULL); 15877: 15878: XmToggleButtonSetState(toggleButtonTimeSeriesAgeMa,False,False); 15879: XmToggleButtonSetState(toggleButtonTimeSeriesAgeKyr,True,False); 15880: XmToggleButtonSetState(toggleButtonTimeSeriesAgeYrs,False,False); 15881: XmToggleButtonSetState(toggleButtonTimeSeriesInvertNo,True,False); 15882: XmToggleButtonSetState(toggleButtonTimeSeriesInvertYes,False,False); 15883: XtVaSetValues(textFieldTimeSeriesToAge, XmNvalue, "", NULL); 15884: XtVaSetValues(textFieldTimeSeriesFromAge, XmNvalue, "0.0", NULL); 15885: XtVaSetValues(textFieldTimeSeriesAgeCol, XmNvalue, "1", NULL); 15886: XtVaSetValues(textFieldTimeSeriesValCol, XmNvalue, "2", NULL); 15887: 15888: if((path=(char*)calloc((int)strlen(timeseries.dirname)+1000,CHAR_SIZE))==NULL) 15889: SpBadMemAlloc("SelectTimeSeriesFileName"); 15890: (void)sprintf(path, "%s", timeseries.dirname); 15891: 15892: len = (int)strlen(path); 15893: if(strcmp(&path[len-1], "/") == 0) { 15894: *strrchr(path,'/')= '\0'; 15895: } 15896: 15897: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 15898: SpBadMemAlloc("SelectTimeSeriesFileName"); 15899: } 15900: (void)sprintf(str,"%s/*", path); 15901: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 15902: XtVaSetValues(textFileSelectionSelected, XmNvalue, timeseries.filename, NULL); 15903: free(str); 15904: 15905: SpUpdateFileSelection(FILE_FILTER, OPENTIMESERIES, path); 15906: (void)sprintf(preview_input_path,"%s",path); 15907: 15908: free(path); 15909: if(path) 15910: path = NULL; 15911: } 15912: 15913: void 15914: PreviewInput(w, client_data, call_data) 15915: Widget w; 15916: XtPointer client_data; 15917: XtPointer call_data; 15918: { 15919: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15920: 15921: char *str; 15922: XmString xmstring; 15923: 15924: void SpUpdateFileSelection(); 15925: 15926: XtManageChild(formFileSelectionPreviewInput); 15927: XtPopup(XtParent(formFileSelectionPreviewInput),XtGrabNone); 15928: 15929: XtVaSetValues(textFileSelectionSelectedPreviewInput, XmNvalue, "", NULL); 15930: 15931: if((str=(char*)calloc((int)strlen(preview_input_path)+10, CHAR_SIZE)) == NULL) { 15932: SpBadMemAlloc("PreviewInput"); 15933: } 15934: (void)sprintf(str, "%s", preview_input_path); 15935: XtVaSetValues(textFileSelectionSelectedPreviewInput, XmNvalue, str, NULL); 15936: (void)strncat(str,"/*",2); 15937: XtVaSetValues(textFileSelectionFilterPreviewInput, XmNvalue, str, NULL); 15938: free(str); 15939: 15940: SpUpdateFileSelection(FILE_FILTER, PREVIEWINPUT, preview_input_path); 15941: } 15942: 15943: void 15944: PreviewInputDismiss(w, client_data, call_data) 15945: Widget w; 15946: XtPointer client_data; 15947: XtPointer call_data; 15948: { 15949: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15950: 15951: XmTextPosition last_pos; 15952: 15953: last_pos=XmTextGetLastPosition(textPreviewInput); 15954: 15955: XmTextReplace(textPreviewInput, 0, last_pos, ""); 15956: 15957: XtUnmanageChild(formPreviewInput); 15958: } 15959: 15960: void 15961: FileSelectionCancel(w, client_data, call_data) 15962: Widget w; 15963: XtPointer client_data; 15964: XtPointer call_data; 15965: { 15966: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15967: 15968: XtUnmanageChild(formFileSelection); 15969: 15970: if(fileselection == OPENTIMESERIES) { 15971: XtUnmanageChild(formFileSelectionTimeSeries); 15972: XtVaSetValues(XtParent(formFileSelection), XmNheight, 640, NULL); 15973: } 15974: else if(fileselection == OPENSTRAT) { 15975: XtUnmanageChild(optionMenuStratType1); 15976: XtUnmanageChild(labelStratType1); 15977: XtVaSetValues(XtParent(formFileSelection), XmNheight, 640, NULL); 15978: } 15979: else if(fileselection == OPENAFFINE) { 15980: XtManageChild(formUseAffine); 15981: } 15982: else if(fileselection == OPENCULLTABLE) { 15983: XtManageChild(formCull); 15984: } 15985: } 15986: 15987: void 15988: DirectToHelp(w, client_data, call_data) 15989: Widget w; 15990: XtPointer client_data; 15991: XtPointer call_data; 15992: { 15993: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 15994: 15995: char *helpname; 15996: int ishelp; 15997: 15998: if((helpname=(char*)calloc(100, CHAR_SIZE)) == NULL) { 15999: SpBadMemAlloc("FileSelectionOK1"); 16000: } 16001: 16002: if(fileselection == OPENSTRAT) { 16003: (void)sprintf(helpname, "SpOpenStrat.help"); 16004: ishelp = YES; 16005: } 16006: else if(fileselection == SAVESTRAT) { 16007: (void)sprintf(helpname, "SpSaveStrat.help"); 16008: ishelp = YES; 16009: } 16010: else if(fileselection == OPENSPLICETABLE) { 16011: (void)sprintf(helpname, "SpOpenSplicerTable.help"); 16012: ishelp = YES; 16013: } 16014: else if(fileselection == SAVESPLICETABLE) { 16015: (void)sprintf(helpname, "SpSaveSplicerTable.help"); 16016: ishelp = YES; 16017: } 16018: else if(fileselection == OPENAFFINE) { 16019: (void)sprintf(helpname, "SpAffineOpen.help"); 16020: ishelp = YES; 16021: } 16022: else if(fileselection == SAVEAFFINE) { 16023: (void)sprintf(helpname, "SpAffineSave.help"); 16024: ishelp = YES; 16025: } 16026: else if(fileselection == OPENTIMESERIES) { 16027: (void)sprintf(helpname, "SpOpenTimeSeries.help"); 16028: ishelp = YES; 16029: } 16030: else if(fileselection == OPENCULLTABLE) { 16031: (void)sprintf(helpname, "SpCullOpen.help"); 16032: ishelp = YES; 16033: } 16034: else if(fileselection == OPENAGEMODEL) { 16035: (void)sprintf(helpname, "SpOpenAgeModel.help"); 16036: ishelp = YES; 16037: } 16038: else if(fileselection == SAVECULLTABLE) { 16039: (void)sprintf(helpname, "SpCullSave.help"); 16040: ishelp = YES; 16041: } 16042: else if(fileselection == SAVESPLICEDATA) { 16043: (void)sprintf(helpname, "SpSaveSplicerData.help"); 16044: ishelp = YES; 16045: } 16046: else if(fileselection == SAVEAGEMODEL) { 16047: (void)sprintf(helpname, "SpSaveAgeModel.help"); 16048: ishelp = YES; 16049: } 16050: else if(fileselection == SAVESPLICEVSAGE) { 16051: (void)sprintf(helpname, "SpSaveSpliceVsAge.help"); 16052: ishelp = YES; 16053: } 16054: else { 16055: ishelp = NO; 16056: } 16057: 16058: if(ishelp == YES) { 16059: SplicerHelpCB((Widget)NULL, helpname, (XtPointer)NULL); 16060: } 16061: free(helpname); 16062: } 16063: 16064: void 16065: FileSelectionOK(w, client_data, call_data) 16066: Widget w; 16067: XtPointer client_data; 16068: XtPointer call_data; 16069: { 16070: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16071: 16072: int nfile, i, readable, age, err; 16073: char *selectfile, *path; 16074: XmString str, xmstring; 16075: int SpInputStrat(),SpOutputStrat(),SpInputSplicerTable(), 16076: SpOutputData(), SpOutputAgeModel(), SpInputAgeModel(), 16077: SpWriteSplicerData(), VerifyFileReadable(), ReadTimeSeries(); 16078: Widget tmp_widget; 16079: 16080: selectfile = XmTextGetString(textFileSelectionSelected); 16081: path = XmTextGetString(textFileSelectionFilter); 16082: *strrchr(path,'*')= '\0'; 16083: 16084: if(strlen(selectfile) == 0) { 16085: return; 16086: } 16087: 16088: if(fileselection == OPENTIMESERIES) { 16089: 16090: /* check that filename is a valid name 16091: */ 16092: readable = VerifyFileReadable(selectfile, OPEN, OPENTIMESERIES); 16093: if(readable == NO) { 16094: (void)sprintf(buffer,"Error opening time series. %s is not a readable file.",selectfile); 16095: SpManageWarningBox(buffer); 16096: } 16097: else { 16098: io_wait_cursor = XCreateFontCursor(XtDisplay(formFileSelection), XC_watch); 16099: if(io_wait_cursor != BadAlloc && io_wait_cursor != BadFont && io_wait_cursor != BadValue) { 16100: XDefineCursor(XtDisplay(formFileSelection), XtWindow(formFileSelection), io_wait_cursor); 16101: } 16102: 16103: XtFree(timeseries.filename); 16104: if((timeseries.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16105: SpBadMemAlloc("FileSelectionOK1"); 16106: } 16107: (void)sprintf(timeseries.filename, "%s", selectfile); 16108: XtFree(timeseries.dirname); 16109: if((timeseries.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16110: SpBadMemAlloc("FileSelectionOK2"); 16111: } 16112: (void)sprintf(timeseries.dirname, "%s", path); 16113: 16114: /* check if there is already a time series allocated. if so, free it 16115: */ 16116: if(have_time_series == DO) { 16117: SpCleanUp(TIMESERIES); 16118: } 16119: if((err = ReadTimeSeries(selectfile)) > 0) { 16120: } 16121: else { 16122: 16123: have_timeseries_tie = DONT; 16124: have_splicetoage_tie = DONT; 16125: last_splicetoage_tie = NONE; 16126: 16127: XtUnmanageChild(formFileSelectionTimeSeries); 16128: XtVaSetValues(XtParent(formFileSelection), XmNheight, 640, NULL); 16129: XtSetSensitive(pushButtonSpliceToAgeRemoveTimeSeries, True); 16130: XtUnmanageChild(formFileSelection); 16131: 16132: xmstring=XmCvtCTToXmString("Have Time Series"); 16133: XtVaSetValues(pushButtonOpenTimeSeries,XmNlabelString,xmstring,NULL); 16134: XtVaSetValues(pushButtonOpenAgeSignal,XmNlabelString,xmstring,NULL); 16135: XmStringFree(xmstring); 16136: } 16137: 16138: if(io_wait_cursor) { 16139: XUndefineCursor(XtDisplay(formFileSelection), XtWindow(formFileSelection)); 16140: XFreeCursor(XtDisplay(formFileSelection), io_wait_cursor); 16141: } 16142: } 16143: } 16144: else if(fileselection == OPENSPLICETABLE) { 16145: 16146: /* check that filename is a valid name 16147: */ 16148: readable = VerifyFileReadable(selectfile, OPEN, OPENSPLICETABLE); 16149: if(readable == NO) { 16150: (void)sprintf(buffer,"Error opening splicer table. %s is not a readable file.",selectfile); 16151: SpManageWarningBox(buffer); 16152: } 16153: else { 16154: XtUnmanageChild(formFileSelection); 16155: XtFree(splicertable.filename); 16156: if((splicertable.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16157: SpBadMemAlloc("FileSelectionOK1"); 16158: } 16159: (void)sprintf(splicertable.filename, "%s", selectfile); 16160: XtFree(splicertable.dirname); 16161: if((splicertable.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16162: SpBadMemAlloc("FileSelectionOK2"); 16163: } 16164: (void)sprintf(splicertable.dirname, "%s", path); 16165: 16166: work_id=XtAppAddWorkProc(app,(XtWorkProc)SpInputSplicerTable(),messageBoxWorking); 16167: /* display working box */ 16168: if((charptr=(char*)calloc(100+(int)strlen(splicertable.filename),CHAR_SIZE))==NULL) 16169: SpBadMemAlloc("FileSelectionOK 3"); 16170: (void)sprintf(charptr,"Splicer : Reading splicer table %s.",splicertable.filename); 16171: str=XmStringCreateLocalized(charptr); 16172: XtVaSetValues(messageBoxWorking,XmNmessageString,str, NULL); 16173: XmStringFree(str); 16174: free(charptr); 16175: XtManageChild(messageBoxWorking); 16176: XtPopup(XtParent(messageBoxWorking),XtGrabNone); 16177: } 16178: } 16179: else if(fileselection == SAVESPLICETABLE) { 16180: /* check that filename is a valid name 16181: */ 16182: readable = VerifyFileReadable(selectfile, SAVE, SAVESPLICETABLE); 16183: if(readable == NO) { 16184: (void)sprintf(buffer,"Error saving splice table. %s is not a writable file.",selectfile); 16185: SpManageWarningBox(buffer); 16186: } 16187: else { 16188: XtUnmanageChild(formFileSelection); 16189: /* get new file and directory name */ 16190: XtFree(splicertable.filename); 16191: if((splicertable.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16192: SpBadMemAlloc("FileSelectionOK1"); 16193: } 16194: (void)sprintf(splicertable.filename, "%s", selectfile); 16195: XtFree(splicertable.dirname); 16196: if((splicertable.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16197: SpBadMemAlloc("FileSelectionOK2"); 16198: } 16199: (void)sprintf(splicertable.dirname, "%s", path); 16200: 16201: SpWriteSplicerTable(selectfile); 16202: saved_splice = YES; 16203: write_report = YES; 16204: if((charptr=(char*)calloc(50+(int)strlen(splicertable.filename),CHAR_SIZE))==NULL) 16205: SpBadMemAlloc("FileSelectionOK"); 16206: (void)sprintf(charptr,"\nSplicer table written to %s.",splicertable.filename); 16207: SpUpdateReport(charptr); 16208: free(charptr); 16209: } 16210: } 16211: else if(fileselection == OPENAFFINE) { 16212: /* check that filename is a valid name 16213: */ 16214: readable = VerifyFileReadable(selectfile, OPEN, OPENAFFINE); 16215: if(readable == NO) { 16216: (void)sprintf(buffer,"Error opening affine table. %s is not a readable file.",selectfile); 16217: XmToggleButtonSetState(toggleButtonUseAffine, False, False); 16218: XmToggleButtonSetState(toggleButtonNotUseAffine, True, False); 16219: affine.usetable = False; 16220: XmTextSetString(textFieldAffineFileName,""); 16221: SpManageWarningBox(buffer); 16222: } 16223: else { 16224: XtUnmanageChild(formFileSelection); 16225: XtFree(affine.filename); 16226: if((affine.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16227: SpBadMemAlloc("FileSelectionOK4"); 16228: } 16229: (void)sprintf(affine.filename, "%s", selectfile); 16230: XtFree(affine.dirname); 16231: if((affine.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16232: SpBadMemAlloc("FileSelectionOK5"); 16233: } 16234: (void)sprintf(affine.dirname, "%s", path); 16235: if((charptr=(char*)calloc((int)strlen(affine.filename)+5,CHAR_SIZE))==NULL) 16236: SpBadMemAlloc("FileSelectionOK6"); 16237: (void)sprintf(charptr,"%s",affine.filename); 16238: XmTextSetString(textFieldAffineFileName,charptr); 16239: free(charptr); 16240: XmToggleButtonSetState(toggleButtonUseAffine, True, False); 16241: XmToggleButtonSetState(toggleButtonNotUseAffine, False, False); 16242: affine.usetable = TRUE; 16243: xmstring=XmCvtCTToXmString("Use Affine..."); 16244: XtVaSetValues(pushButtonOpenAffine,XmNlabelString,xmstring,NULL); 16245: XmStringFree(xmstring); 16246: } 16247: } 16248: else if(fileselection == SAVEAFFINE) { 16249: 16250: /* check that filename is a valid name 16251: */ 16252: readable = VerifyFileReadable(selectfile, SAVE, SAVEAFFINE); 16253: if(readable == NO) { 16254: (void)sprintf(buffer,"Error saving affine table. %s is not a writable file.",selectfile); 16255: SpManageWarningBox(buffer); 16256: } 16257: else { 16258: XtUnmanageChild(formFileSelection); 16259: XtFree(affine.filename); 16260: if((affine.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16261: SpBadMemAlloc("FileSelectionOK4"); 16262: } 16263: (void)sprintf(affine.filename, "%s", selectfile); 16264: XtFree(affine.dirname); 16265: if((affine.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16266: SpBadMemAlloc("FileSelectionOK5"); 16267: } 16268: (void)sprintf(affine.dirname, "%s", path); 16269: 16270: if(!SpWriteAffineTable(&affinetable,affine.filename)) 16271: { 16272: if((message.label=(char*)calloc(100+(int)strlen(affine.filename),CHAR_SIZE))==NULL) 16273: SpBadMemAlloc("FileSelectionOK"); 16274: (void)sprintf(buffer,"Error writing output affine table %s",affine.filename); 16275: SpManageWarningBox(buffer); 16276: } 16277: else 16278: { 16279: saved_affine = YES; 16280: write_report = YES; 16281: 16282: /* write affine table */ 16283: if((charptr=(char*)calloc(50+(int)strlen(affine.filename),CHAR_SIZE))==NULL) 16284: SpBadMemAlloc("FileSelectionOK"); 16285: (void)sprintf(charptr,"\nAffine table written to %s.",affine.filename); 16286: SpUpdateReport(charptr); 16287: free(charptr); 16288: } 16289: } 16290: } 16291: else if(fileselection == OPENSTRAT) { 16292: 16293: /* check that filename is a valid name 16294: */ 16295: readable = VerifyFileReadable(selectfile, OPEN, OPENSTRAT); 16296: if(readable == NO) { 16297: (void)sprintf(buffer,"Error opening stratigraphy. %s is not a readable file.",selectfile); 16298: SpManageWarningBox(buffer); 16299: } 16300: else { 16301: 16302: if(strat_file_cnt > 1) { 16303: for(i=0; i<strat_file_cnt-1; ++i) { 16304: if(strcmp(strat[i]->filename, selectfile) == 0) { 16305: (void)sprintf(buffer,"You have already read this stratigraphy file."); 16306: SpManageWarningBox(buffer); 16307: return; 16308: } 16309: } 16310: } 16311: 16312: if(strat_file_cnt<=0) 16313: { 16314: if((strat=(StratFile**)calloc(1,sizeof(StratFile*)))==NULL) 16315: SpBadMemAlloc("FileSelectionOK7"); 16316: } 16317: else 16318: { 16319: if((charptr=(char*)realloc((char*)strat,(strat_file_cnt+1)*sizeof(StratFile*)))==NULL) 16320: SpBadMemAlloc("FileSelectionOK8"); 16321: else 16322: strat=(StratFile**)charptr; 16323: } 16324: if((strat[strat_file_cnt]=(StratFile*)calloc(1,sizeof(StratFile)))==NULL) 16325: SpBadMemAlloc("FileSelectionOK9"); 16326: strat_file_cnt++; 16327: strat[strat_file_cnt-1]->alloc_cnt=strat[strat_file_cnt-1]->data_cnt=0; 16328: 16329: strat[strat_file_cnt-1]->filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE); 16330: (void)sprintf(strat[strat_file_cnt-1]->filename, "%s", selectfile); 16331: if((strat[strat_file_cnt-1]->dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16332: SpBadMemAlloc("FileSelectionOK10"); 16333: } 16334: (void)sprintf(strat[strat_file_cnt-1]->dirname, "%s", path); 16335: XtFree(default_strat_dirname); 16336: default_strat_dirname=NULL; 16337: if((default_strat_dirname=(char*)calloc((int)strlen(path)+5,CHAR_SIZE))==NULL) 16338: SpBadMemAlloc("OpenSplicerTable"); 16339: (void)sprintf(default_strat_dirname, "%s", path); 16340: 16341: /* get strat type set */ 16342: XtVaGetValues(optionMenuStratType1,XmNmenuHistory,&tmp_widget,NULL); 16343: if(tmp_widget==pushButtonDiatoms1) 16344: strat[strat_file_cnt-1]->type=DIATOMS; 16345: else if(tmp_widget==pushButtonRadiolaria1) 16346: strat[strat_file_cnt-1]->type=RADIOLARIA; 16347: else if(tmp_widget==pushButtonForaminifera1) 16348: strat[strat_file_cnt-1]->type=FORAMINIFERA; 16349: else if(tmp_widget==pushButtonNannofossils1) 16350: strat[strat_file_cnt-1]->type=NANNOFOSSILS; 16351: else if(tmp_widget==pushButtonPaleomag1) 16352: strat[strat_file_cnt-1]->type=PALEOMAG; 16353: 16354: /* start working procedure for reading strat file */ 16355: if((charptr=(char*)calloc(50+(int)strlen(strat[strat_file_cnt-1]->filename),CHAR_SIZE))==NULL) 16356: SpBadMemAlloc("FileSelectionOK11"); 16357: (void)sprintf(charptr,"Strat: Reading stratigraphy file %s.",strat[strat_file_cnt-1]->filename); 16358: str=XmStringCreateLocalized(charptr); 16359: XtVaSetValues(messageBoxWorking,XmNmessageString,str, NULL); 16360: XmStringFree(str); 16361: free(charptr); 16362: work_id=XtAppAddWorkProc(app,(XtWorkProc)SpInputStrat(),messageBoxWorking); 16363: XtManageChild(messageBoxWorking); 16364: XtPopup(XtParent(messageBoxWorking),XtGrabNone); 16365: } 16366: } 16367: else if(fileselection == SAVESTRAT) { 16368: readable = VerifyFileReadable(selectfile, SAVE, SAVESTRAT); 16369: if(readable == NO) { 16370: (void)sprintf(buffer,"Error saving stratigraphy. %s is not a writable file.",selectfile); 16371: SpManageWarningBox(buffer); 16372: } 16373: else { 16374: XtUnmanageChild(formFileSelection); 16375: XtFree(outstrat.filename); 16376: if((outstrat.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16377: SpBadMemAlloc("FileSelectionOK4"); 16378: } 16379: (void)sprintf(outstrat.filename, "%s", selectfile); 16380: XtFree(outstrat.dirname); 16381: if((outstrat.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16382: SpBadMemAlloc("FileSelectionOK5"); 16383: } 16384: (void)sprintf(outstrat.dirname, "%s", path); 16385: 16386: if((charptr=(char*)calloc(100+(int)strlen(outstrat.filename),CHAR_SIZE))==NULL) 16387: SpBadMemAlloc("SpFileSelectionBoxOKCB 18"); 16388: (void)sprintf(charptr,"Strat: Writing stratigraphy file %s.",outstrat.filename); 16389: str=XmStringCreateLocalized(charptr); 16390: XtVaSetValues(messageBoxWorking,XmNmessageString,str, NULL); 16391: XmStringFree(str); 16392: free(charptr); 16393: work_id=XtAppAddWorkProc(app,(XtWorkProc)SpOutputStrat(),messageBoxWorking); 16394: XtManageChild(messageBoxWorking); 16395: XtPopup(XtParent(messageBoxWorking),XtGrabNone); 16396: } 16397: } 16398: else if(fileselection == OPENCULLTABLE) { 16399: /* check that filename is a valid name 16400: */ 16401: readable = VerifyFileReadable(selectfile, OPEN, OPENCULLTABLE); 16402: if(readable == NO) { 16403: (void)sprintf(buffer,"Error opening cull table. %s is not a readable file.",selectfile); 16404: XmToggleButtonSetState(toggleButtonUseCullTable, False, False); 16405: XmToggleButtonSetState(toggleButtonDontUseCullTable, True, False); 16406: XmTextSetString(textFieldCullTableFilename,""); 16407: SpManageWarningBox(buffer); 16408: } 16409: else { 16410: XtUnmanageChild(formFileSelection); 16411: XtManageChild(formCull); 16412: XtFree(cull.filename); 16413: if((cull.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16414: SpBadMemAlloc("FileSelectionOK4"); 16415: } 16416: (void)sprintf(cull.filename, "%s", selectfile); 16417: XtFree(cull.dirname); 16418: if((cull.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16419: SpBadMemAlloc("FileSelectionOK5"); 16420: } 16421: (void)sprintf(cull.dirname, "%s", path); 16422: if((charptr=(char*)calloc((int)strlen(cull.filename)+5,CHAR_SIZE))==NULL) 16423: SpBadMemAlloc("FileSelectionOK6"); 16424: (void)sprintf(charptr,"%s",cull.filename); 16425: XmTextSetString(textFieldCullTableFilename,charptr); 16426: free(charptr); 16427: XmToggleButtonSetState(toggleButtonUseCullTable, True, False); 16428: XmToggleButtonSetState(toggleButtonDontUseCullTable, False, False); 16429: } 16430: } 16431: else if(fileselection == SAVECULLTABLE) { 16432: /* check that filename is a valid name 16433: */ 16434: readable = VerifyFileReadable(selectfile, SAVE, SAVECULLTABLE); 16435: if(readable == NO) { 16436: (void)sprintf(buffer,"Error saving cull table. %s is not a writable file.",selectfile); 16437: SpManageWarningBox(buffer); 16438: } 16439: else { 16440: XtUnmanageChild(formFileSelection); 16441: XtFree(cull.filename); 16442: if((cull.filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16443: SpBadMemAlloc("FileSelectionOK4"); 16444: } 16445: (void)sprintf(cull.filename, "%s", selectfile); 16446: XtFree(cull.dirname); 16447: if((cull.dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16448: SpBadMemAlloc("FileSelectionOK5"); 16449: } 16450: (void)sprintf(cull.dirname, "%s", path); 16451: 16452: if(!SpWriteCullTable(data[dset], cull.filename)) 16453: { 16454: if((charptr=(char*)calloc(100+(int)strlen(cull.filename),CHAR_SIZE))==NULL) 16455: SpBadMemAlloc("SpFileSelectionBoxOKCB 3"); 16456: (void)sprintf(charptr,"Error writing output cull table %s",cull.filename); 16457: SpManageWarningBox(charptr); 16458: free(charptr); 16459: } 16460: else 16461: { 16462: if((charptr=(char*)calloc(50+(int)strlen(cull.filename),CHAR_SIZE))==NULL) 16463: SpBadMemAlloc("SpFileSelectionBoxOKCB 3"); 16464: (void)sprintf(charptr,"\nCull table written to %s.",cull.filename); 16465: SpUpdateReport(charptr); 16466: free(charptr); 16467: } 16468: } 16469: } 16470: else if(fileselection == OPENAGEMODEL) { 16471: /* check that filename is a valid name 16472: */ 16473: readable = VerifyFileReadable(selectfile, OPEN, OPENAGEMODEL); 16474: if(readable == NO) { 16475: (void)sprintf(buffer,"Error opening age model. %s is not a readable file.",selectfile); 16476: SpManageWarningBox(buffer); 16477: } 16478: else { 16479: XtUnmanageChild(formFileSelection); 16480: XtFree(inagemodel_filename); 16481: if((inagemodel_filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16482: SpBadMemAlloc("FileSelectionOK4"); 16483: } 16484: (void)sprintf(inagemodel_filename, "%s", selectfile); 16485: XtFree(inagemodel_dirname); 16486: if((inagemodel_dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16487: SpBadMemAlloc("FileSelectionOK5"); 16488: } 16489: (void)sprintf(inagemodel_dirname, "%s", path); 16490: 16491: if((charptr=(char*)calloc(100+(int)strlen(inagemodel_filename),CHAR_SIZE))==NULL) 16492: SpBadMemAlloc("SpFileSelectionBoxOKCB 18"); 16493: (void)sprintf(charptr,"Age Model: Reading age model file %s.",inagemodel_filename); 16494: str=XmStringCreateLocalized(charptr); 16495: XtVaSetValues(messageBoxWorking,XmNmessageString,str, NULL); 16496: XmStringFree(str); 16497: free(charptr); 16498: work_id=XtAppAddWorkProc(app,(XtWorkProc)SpInputAgeModel(),messageBoxWorking); 16499: XtManageChild(messageBoxWorking); 16500: XtPopup(XtParent(messageBoxWorking),XtGrabNone); 16501: 16502: XtSetSensitive(pushButtonOpenAgeSignal, True); 16503: XtSetSensitive(pushButtonOpenTimeSeries, True); 16504: } 16505: } 16506: else if(fileselection == SAVEAGEMODEL) { 16507: /* check that filename is a valid name 16508: */ 16509: readable = VerifyFileReadable(selectfile, SAVE, SAVEAGEMODEL); 16510: if(readable == NO) { 16511: (void)sprintf(buffer,"Error saving age model. %s is not a writable file.",selectfile); 16512: SpManageWarningBox(buffer); 16513: } 16514: else { 16515: XtUnmanageChild(formFileSelection); 16516: XtFree(outagemodel_filename); 16517: if((outagemodel_filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16518: SpBadMemAlloc("FileSelectionOK4"); 16519: } 16520: (void)sprintf(outagemodel_filename, "%s", selectfile); 16521: XtFree(outagemodel_dirname); 16522: if((outagemodel_dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16523: SpBadMemAlloc("FileSelectionOK5"); 16524: } 16525: (void)sprintf(outagemodel_dirname, "%s", path); 16526: 16527: if((charptr=(char*)calloc(50+(int)strlen(outagemodel_filename),CHAR_SIZE))==NULL) 16528: SpBadMemAlloc("SpFileSelectionBoxOKCB 18"); 16529: (void)sprintf(charptr,"Age Model: Writing age model file %s.",outagemodel_filename); 16530: str=XmStringCreateLocalized(charptr); 16531: XtVaSetValues(messageBoxWorking,XmNmessageString,str, NULL); 16532: XmStringFree(str); 16533: free(charptr); 16534: work_id=XtAppAddWorkProc(app,(XtWorkProc)SpOutputAgeModel(),messageBoxWorking); 16535: saved_agemodel = YES; 16536: write_report = YES; 16537: XtManageChild(messageBoxWorking); 16538: XtPopup(XtParent(messageBoxWorking),XtGrabNone); 16539: } 16540: } 16541: else if(fileselection == SAVESPLICEDATA) { 16542: /* check that filename is a valid name 16543: */ 16544: readable = VerifyFileReadable(selectfile, SAVE, SAVESPLICEDATA); 16545: if(readable == NO) { 16546: (void)sprintf(buffer,"Error saving splice data. %s is not a writable file.",selectfile); 16547: SpManageWarningBox(buffer); 16548: } 16549: else { 16550: XtUnmanageChild(formFileSelection); 16551: XtFree(outspdata_filename); 16552: if((outspdata_filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16553: SpBadMemAlloc("FileSelectionOK4"); 16554: } 16555: (void)sprintf(outspdata_filename, "%s", selectfile); 16556: XtFree(outspdata_dirname); 16557: if((outspdata_dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16558: SpBadMemAlloc("FileSelectionOK5"); 16559: } 16560: (void)sprintf(outspdata_dirname, "%s", path); 16561: 16562: if((charptr=(char*)calloc(50+(int)strlen(outspdata_filename),CHAR_SIZE))==NULL) 16563: SpBadMemAlloc("FileSelectionOK"); 16564: (void)sprintf(charptr,"Spliced output data file %s.",outspdata_filename); 16565: SpUpdateReport(charptr); 16566: free(charptr); 16567: age = NO; 16568: SpWriteSplicerData(outspdata_filename, age); 16569: } 16570: } 16571: else if(fileselection == SAVESPLICEVSAGE) { 16572: /* check that filename is a valid name 16573: */ 16574: readable = VerifyFileReadable(selectfile, SAVE, SAVESPLICEVSAGE); 16575: if(readable == NO) { 16576: (void)sprintf(buffer,"Error saving splice vs age. %s is not a writable file.",selectfile); 16577: SpManageWarningBox(buffer); 16578: } 16579: else { 16580: XtUnmanageChild(formFileSelection); 16581: XtFree(outsplicetoage_filename); 16582: if((outsplicetoage_filename=(char*)calloc((int)strlen(selectfile)+10, CHAR_SIZE)) == NULL) { 16583: SpBadMemAlloc("FileSelectionOK4"); 16584: } 16585: (void)sprintf(outsplicetoage_filename, "%s", selectfile); 16586: XtFree(outsplicetoage_dirname); 16587: if((outsplicetoage_dirname=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 16588: SpBadMemAlloc("FileSelectionOK5"); 16589: } 16590: (void)sprintf(outsplicetoage_dirname, "%s", path); 16591: 16592: if((charptr=(char*)calloc(50+(int)strlen(outsplicetoage_filename),CHAR_SIZE))==NULL) 16593: SpBadMemAlloc("FileSelectionOK"); 16594: (void)sprintf(charptr,"Spliced output data file %s.",outsplicetoage_filename); 16595: SpUpdateReport(charptr); 16596: free(charptr); 16597: age = YES; 16598: SpWriteSplicerData(outsplicetoage_filename, age); 16599: } 16600: } 16601: else { 16602: } 16603: 16604: XtFree(selectfile); 16605: if(selectfile) 16606: selectfile = NULL; 16607: XtFree(path); 16608: if(path) 16609: path = NULL; 16610: } 16611: 16612: void 16613: FileSelectionFile(w, client_data, call_data) 16614: Widget w; 16615: XtPointer client_data; 16616: XtPointer call_data; 16617: { 16618: XmListCallbackStruct *acs=(XmListCallbackStruct*)call_data; 16619: 16620: int nfile, len; 16621: char *filter, *infile, *path, *filename; 16622: 16623: /* get selected file name 16624: */ 16625: filter = XmTextGetString(textFileSelectionFilter); 16626: if((path=(char*)calloc((int)strlen(filter)+10,CHAR_SIZE))==NULL) 16627: SpBadMemAlloc("FileSelectionFile"); 16628: (void)sprintf(path,"%s", filter); 16629: *strrchr(path,'*')= '\0'; 16630: len = (int)strlen(path); 16631: if(len > 0) { 16632: if(strcmp(&path[len-1], "/") != 0) { 16633: strcat(path, "/"); 16634: } 16635: } 16636: XmStringGetLtoR(acs->item,XmFONTLIST_DEFAULT_TAG,&infile); 16637: if((filename=(char*)calloc((int)strlen(path) + (int)strlen(infile)+50,CHAR_SIZE))==NULL) 16638: SpBadMemAlloc("FileSelectionFile"); 16639: 16640: (void)sprintf(filename,"%s%s",path, infile); 16641: XtVaSetValues(textFileSelectionSelected, XmNvalue, filename, NULL); 16642: 16643: free(filter); 16644: free(filename); 16645: free(infile); 16646: free(path); 16647: } 16648: 16649: void 16650: FileSelectionDirectory(w, client_data, call_data) 16651: Widget w; 16652: XtPointer client_data; 16653: XtPointer call_data; 16654: { 16655: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16656: 16657: char *filter, *path; 16658: 16659: void SpUpdateFileSelection(); 16660: 16661: filter = XmTextGetString(textFileSelectionFilter); 16662: /* allocate a lot of space for path so don't need to 16663: reallocate in SpUpdateFileSelection 16664: when reallocate there lose the pointer 16665: */ 16666: if((path=(char*)calloc((int)strlen(filter) + 1000,CHAR_SIZE))==NULL) 16667: SpBadMemAlloc("FileSelectionDirectory"); 16668: (void)sprintf(path, "%s", filter); 16669: *strrchr(path,'*')= '\0'; 16670: *strrchr(path,'/')= '\0'; 16671: 16672: SpUpdateFileSelection(DIRECTORIES,fileselection, path); 16673: (void)sprintf(preview_input_path,"%s",path); 16674: 16675: XtVaSetValues(textFileSelectionSelected, XmNvalue, path, NULL); 16676: 16677: free(path); 16678: } 16679: 16680: void 16681: FileSelectionFilter(w, client_data, call_data) 16682: Widget w; 16683: XtPointer client_data; 16684: XtPointer call_data; 16685: { 16686: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16687: 16688: char *filter, *path; 16689: void SpUpdateFileSelection(); 16690: 16691: filter = XmTextGetString(textFileSelectionFilter); 16692: /* allocate a lot of space for path so don't need to 16693: reallocate in SpUpdateFileSelection 16694: when reallocate there lose the pointer 16695: */ 16696: if((path=(char*)calloc((int)strlen(filter) + 1000,CHAR_SIZE))==NULL) 16697: SpBadMemAlloc("FileSelectionFilter"); 16698: (void)sprintf(path, "%s", filter); 16699: *strrchr(path,'*')= '\0'; 16700: 16701: SpUpdateFileSelection(FILE_FILTER, fileselection, path); 16702: (void)sprintf(preview_input_path,"%s",path); 16703: 16704: XtVaSetValues(textFileSelectionSelected, XmNvalue, path, NULL); 16705: free(path); 16706: } 16707: 16708: void 16709: OpenFormatsOtherToggleArm1(w, client_data, call_data) 16710: Widget w; 16711: XtPointer client_data; 16712: XtPointer call_data; 16713: { 16714: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16715: 16716: char string[10]; 16717: 16718: (void)sprintf(string, "10"); 16719: XtVaSetValues(textFieldOpenFormatOtherValueColumn, XmNvalue, string, NULL); 16720: 16721: (void)sprintf(string, ""); 16722: } 16723: 16724: void 16725: OpenFormatsOtherToggleArm2(w, client_data, call_data) 16726: Widget w; 16727: XtPointer client_data; 16728: XtPointer call_data; 16729: { 16730: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16731: 16732: char string[10]; 16733: 16734: (void)sprintf(string, "9"); 16735: XtVaSetValues(textFieldOpenFormatOtherValueColumn, XmNvalue, string, NULL); 16736: 16737: (void)sprintf(string, ""); 16738: } 16739: 16740: void 16741: OpenFormatsOtherToggleArm3(w, client_data, call_data) 16742: Widget w; 16743: XtPointer client_data; 16744: XtPointer call_data; 16745: { 16746: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16747: 16748: char string[10]; 16749: 16750: (void)sprintf(string, "8"); 16751: XtVaSetValues(textFieldOpenFormatOtherValueColumn, XmNvalue, string, NULL); 16752: 16753: (void)sprintf(string, ""); 16754: } 16755: 16756: void 16757: OpenFormatsOtherToggleArm4(w, client_data, call_data) 16758: Widget w; 16759: XtPointer client_data; 16760: XtPointer call_data; 16761: { 16762: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16763: 16764: char string[10]; 16765: 16766: (void)sprintf(string, "7"); 16767: XtVaSetValues(textFieldOpenFormatOtherValueColumn, XmNvalue, string, NULL); 16768: 16769: (void)sprintf(string, ""); 16770: } 16771: 16772: void 16773: OpenFormatsOtherToggleArm5(w, client_data, call_data) 16774: Widget w; 16775: XtPointer client_data; 16776: XtPointer call_data; 16777: { 16778: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16779: 16780: char string[10]; 16781: 16782: (void)sprintf(string, "9"); 16783: XtVaSetValues(textFieldOpenFormatOtherValueColumn, XmNvalue, string, NULL); 16784: 16785: (void)sprintf(string, ""); 16786: } 16787: 16788: void 16789: OpenFormatsOtherToggleArm(w, client_data, call_data) 16790: Widget w; 16791: XtPointer client_data; 16792: XtPointer call_data; 16793: { 16794: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16795: } 16796: 16797: void 16798: SpliceToAgeRecorrelate(w, client_data, call_data) 16799: Widget w; 16800: XtPointer client_data; 16801: XtPointer call_data; 16802: { 16803: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 16804: 16805: int i, j, startcore, endcore, timen, spln, timetie, spltie, num_lead_lag, lag, 16806: sploffset, timeoffset, nwin, tie_corr_num, n, ndiv; 16807: float dt, leadlagmyrs, startage, endage, timeage[MAXCORR], timeval[MAXCORR], 16808: splage[MAXCORR], splvar[MAXCORR], coef, flip, sumval; 16809: String str; 16810: int RepickDepth(); 16811: void DrawDrawingAreaTieToTimeSeriesCorr(), DrawDrawingAreaSpliceToAge(); 16812: 16813: /* get corr info 16814: */ 16815: str = XmTextGetString(textFieldSpliceToAgeTimeStep); 16816: dt = atof(str); 16817: XtFree(str); 16818: 16819: str = XmTextGetString(textFieldSpliceToAgeWinLen); 16820: winlen = atof(str); 16821: XtFree(str); 16822: 16823: str= XmTextGetString(textFieldSpliceToAgeLeadLag); 16824: leadlagmyrs = atof(str); 16825: XtFree(str); 16826: 16827: /* put data of winlen +/- lead/lag length in temp arrays 16828: and repick at dt 16829: */ 16830: startage = timeseries.age[timeseriesarraynum] - winlen/2.0 - leadlagmyrs; 16831: endage = timeseries.age[timeseriesarraynum] + winlen/2.0 + leadlagmyrs; 16832: i = timeseriesarraynum; 16833: while(i>0 && timeseries.age[i] > startage) { 16834: --i; 16835: } 16836: timetie = timeseriesarraynum - i; 16837: timen = 0; 16838: if(XmToggleButtonGetState(toggleButtonTimeSeriesInvertNo) == True) { 16839: flip = 1.0; 16840: } 16841: else if(XmToggleButtonGetState(toggleButtonTimeSeriesInvertYes) == True) { 16842: flip = -1.0; 16843: } 16844: while(i<timeseries.n && timeseries.age[i]< endage) { 16845: timeage[timen] = timeseries.age[i]; 16846: timeval[timen] = flip * timeseries.val[i]; 16847: ++timen; 16848: ++i; 16849: } 16850: 16851: startage = spcomp.age[splicetoagecorenum][splicetoagearraynum] - winlen/2.0 - leadlagmyrs; 16852: endage = spcomp.age[splicetoagecorenum][splicetoagearraynum] + winlen/2.0 + leadlagmyrs; 16853: startcore = splicetoagecorenum; 16854: while(startcore>0 && spcomp.age[startcore][0] > startage) { 16855: --startcore; 16856: } 16857: endcore = splicetoagecorenum; 16858: while(endcore<spcomp.numcores && spcomp.age[endcore][spcomp.numpercore[endcore]-1] < endage) { 16859: ++endcore; 16860: } 16861: spln = 0; 16862: spltie = -1; 16863: for(i=startcore; i<=endcore; ++i) { 16864: for(j=0; j<spcomp.numpercore[i]; ++j) { 16865: if(spcomp.age[i][j] < startage) { 16866: } 16867: else if(spcomp.age[i][j] > endage) { 16868: break; 16869: } 16870: else { 16871: splage[spln] = spcomp.age[i][j]; 16872: splvar[spln] = spcomp.var[i][j]; 16873: ++spln; 16874: } 16875: } 16876: } 16877: 16878: /* check for mult samples per level 16879: */ 16880: sumval = splvar[0]; 16881: n = 0; 16882: ndiv = 1; 16883: for(i=1; i<spln; ++i) { 16884: if(splage[i] == splage[i-1] && i < spln - 1) { 16885: sumval = sumval + splvar[i]; 16886: ++ndiv; 16887: } 16888: else if(splage[i] == splage[i-1] && i == spln - 1) { 16889: sumval = sumval + splvar[i]; 16890: ++ndiv; 16891: splage[n] = splage[i-1]; 16892: splvar[n] = sumval/ndiv; 16893: ++n; 16894: } 16895: else if(splage[i] > splage[i-1] && i < spln - 1) { 16896: splage[n] = splage[i-1]; 16897: splvar[n] = sumval/ndiv; 16898: sumval = splvar[i]; 16899: ndiv = 1; 16900: ++n; 16901: } 16902: else if(splage[i] > splage[i-1] && i == spln - 1) { 16903: splage[n] = splage[i-1]; 16904: splvar[n] = sumval/ndiv; 16905: ++n; 16906: splage[n] = splage[i]; 16907: splvar[n] = splvar[i]; 16908: ++n; 16909: } 16910: else { 16911: } 16912: } 16913: spln = n; 16914: 16915: /* find tie array location 16916: */ 16917: for(i=0; i<spln; ++i) { 16918: if(fabs(splage[i] - spcomp.age[splicetoagecorenum][splicetoagearraynum]) < 0.000005) { 16919: spltie = i; 16920: } 16921: } 16922: if(spltie == -1) { 16923: (void)sprintf(buffer, "Was unable to find the splice tie for temp correlation array."); 16924: SpManageWarningBox(buffer); 16925: return; 16926: } 16927: 16928: /* repick time and spl at dt 16929: */ 16930: RepickDepth(timeage, timeval, &timen, &timetie, dt); 16931: RepickDepth(splage, splvar, &spln, &spltie, dt); 16932: 16933: /*from lead,lag(in meters) find the lead,lag 16934: in data points 16935: */ 16936: if(leadlagmyrs > 0.0){ 16937: lead_lag = leadlagmyrs/dt; 16938: num_lead_lag = lead_lag * 2 + 1; 16939: lag = -1.0 * lead_lag; 16940: } 16941: else { 16942: lead_lag=0; 16943: lag=0; 16944: } 16945: if(num_lead_lag > MAXCORR){ 16946: (void)sprintf(buffer, "The lead/lag you have chosen exceeds the limit for number of correlations allowed."); 16947: XtSetSensitive(pushButtonSpliceCorrelate, True); 16948: SpManageWarningBox(buffer); 16949: return; 16950: } 16951: 16952: /*from window length find the first value(array member) of temp splice data array 16953: that is within the window. then count out to the last value that is in the window 16954: */ 16955: if(winlen > 0.0) { 16956: for(i=0; i<spln; ++i){ 16957: if(splage[i] >= splage[spltie] - winlen){ 16958: sploffset=i; 16959: break; 16960: } 16961: } 16962: nwin=0; 16963: for(j=i; j<spln; ++j){ 16964: if(splage[j] > splage[spltie] + winlen){ 16965: break; 16966: } 16967: else { 16968: ++nwin; 16969: } 16970: } 16971: } 16972: else { 16973: (void)sprintf(buffer, "Error: The window length is less than or equal to 0.0."); 16974: SpManageWarningBox(buffer); 16975: XtSetSensitive(pushButtonSpliceCorrelate, True); 16976: return; 16977: } 16978: 16979: /* calc. corr. coef. for each lead,lag in given window 16980: note that timeoffset causes timeseries to lag and then lead 16981: splice 16982: */ 16983: corr.num_lead_lag[dset] = 0; 16984: tie_corr_num = 0; 16985: for(i=0;i<num_lead_lag; ++i){ 16986: timeoffset = timetie - spltie - lag; 16987: Correlate(timen, nwin, timeoffset, sploffset, timeval, splvar, 16988: &coef, &n); 16989: 16990: /* cull out any lead/lag that had less than TOOFEWCORRPAIRS 16991: which includes situations where the lead/lag caused core 1 16992: to not overlay core 2; n=0 16993: */ 16994: if(n < TOOFEWCORRPAIRS){ 16995: 16996: } 16997: else { 16998: corr.coef[dset][corr.num_lead_lag[dset]] = coef; 16999: corr.n[corr.num_lead_lag[dset]] = n; 17000: corr.leadlag[dset][corr.num_lead_lag[dset]] = lag; 17001: corr.depoffset[corr.num_lead_lag[dset]] = timeage[timetie] - splage[spltie] - lag * dt; 17002: corr.depleadlag[dset][corr.num_lead_lag[dset]] = lag * dt; 17003: if(lag == 0){ 17004: tie_corr_num = corr.num_lead_lag[dset]; 17005: } 17006: ++corr.num_lead_lag[dset]; 17007: } 17008: ++lag; 17009: } 17010: 17011: best_corr = corr.coef[dset][0]; 17012: best_corr_num = 0; 17013: for(i=1; i<corr.num_lead_lag[dset]; ++i){ 17014: if(corr.coef[dset][i] > best_corr){ 17015: best_corr = corr.coef[dset][i]; 17016: best_corr_num = i; 17017: } 17018: } 17019: 17020: have_splicetoage_corr = DO; 17021: if(XtIsManaged(XtParent(drawingAreaTieToTimeSeriesCorr))) { 17022: DrawDrawingAreaTieToTimeSeriesCorr(drawingAreaTieToTimeSeriesCorr, (XtPointer)NULL, (XtPointer)NULL); 17023: } 17024: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 17025: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 17026: } 17027: } 17028: 17029: void 17030: SpliceToAgeAddTiedDatum(w, client_data, call_data) 17031: Widget w; 17032: XtPointer client_data; 17033: XtPointer call_data; 17034: { 17035: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17036: 17037: int i, k, l, found, pos, array; 17038: char *string; 17039: float timeseries_age, spl_mbsf, spl_mcd, sedrat; 17040: XmString xmstring; 17041: void RecalcDatumAges(), DrawDrawingAreaAgeDepth(), PlotSpliceVsAge(); 17042: 17043: XtSetSensitive(pushButtonSpliceToAgeAddTiedDatum, False); 17044: XtSetSensitive(pushButtonSpliceToAgeRecorrelate, False); 17045: XtSetSensitive(pushButtonSpliceToAgeClearTie, False); 17046: have_timeseries_tie = DONT; 17047: have_splicetoage_tie = DONT; 17048: have_splicetoage_corr = DONT; 17049: last_splicetoage_tie = NONE; 17050: XClearWindow(XtDisplay(drawingAreaTieToTimeSeriesCorr), XtWindow(drawingAreaTieToTimeSeriesCorr)); 17051: 17052: /* check that have not reached array limit 17053: */ 17054: if(agemodel_cnt + 1 > MAXAGE) { 17055: (void)sprintf(buffer, "You have exceeded the limit on the number of values in age model."); 17056: SpManageWarningBox(buffer); 17057: return; 17058: } 17059: 17060: if(are_agemodelling == YES) { 17061: 17062: XtVaGetValues(labelSpliceToAgeTimeSeriesAge, XmNlabelString, &xmstring, NULL); 17063: XmStringGetLtoR(xmstring, XmFONTLIST_DEFAULT_TAG, &string); 17064: timeseries_age = atof(string); 17065: XtFree(string); 17066: XtVaGetValues(labelSpliceToAgeTiembsf, XmNlabelString, &xmstring, NULL); 17067: XmStringGetLtoR(xmstring, XmFONTLIST_DEFAULT_TAG, &string); 17068: spl_mbsf = atof(string); 17069: XtFree(string); 17070: XtVaGetValues(labelSpliceToAgeTieSplicemcd, XmNlabelString, &xmstring, NULL); 17071: XmStringGetLtoR(xmstring, XmFONTLIST_DEFAULT_TAG, &string); 17072: spl_mcd = atof(string); 17073: XtFree(string); 17074: 17075: xmstring = XmStringCreateSimple(""); 17076: XtVaSetValues(labelSpliceToAgeTimeSeriesAge, XmNlabelString, xmstring, NULL); 17077: XtVaSetValues(labelSpliceToAgeTiembsf, XmNlabelString, xmstring, NULL); 17078: XtVaSetValues(labelSpliceToAgeTieID, XmNlabelString, xmstring, NULL); 17079: XtVaSetValues(labelSpliceToAgeTieVar, XmNlabelString, xmstring, NULL); 17080: XtVaSetValues(labelSpliceToAgeTieSpliceAge, XmNlabelString, xmstring, NULL); 17081: XtVaSetValues(labelSpliceToAgeTieSplicemcd, XmNlabelString, xmstring, NULL); 17082: XmStringFree(xmstring); 17083: 17084: /* put this time series tied datum in age model struct in order by both age and depth 17085: there must not be conflicts other timeseries age and depth but ignore conflicts 17086: with strat datums 17087: if needed, calculate a new age for start datums that conflict with timeseries 17088: note that pos = the array indicy of the added date 17089: */ 17090: if(agemodel_cnt >= 1) { 17091: pos = -1; 17092: for(k=0; k<agemodel_cnt; ++k) { 17093: if(k == 0 && spl_mcd < agemodel[k].avemcd) { 17094: pos = k; 17095: break; 17096: } 17097: else if(k == agemodel_cnt-1 && spl_mcd > agemodel[k].avemcd) { 17098: pos = k + 1; 17099: break; 17100: } 17101: else if(k < agemodel_cnt-1 && spl_mcd > agemodel[k].avemcd && spl_mcd < agemodel[k+1].avemcd) { 17102: pos = k + 1; 17103: break; 17104: } 17105: } 17106: 17107: /* check that have not picked a tuned age that conflicts with other 17108: tuned age(s) in age model 17109: */ 17110: if(pos != -1) { 17111: i=pos - 1; 17112: while(i>0 && timeseries_age < agemodel[i].aveage && 17113: agemodel[i].type != TIME && agemodel[i].type != HANDPICK) { 17114: --i; 17115: } 17116: if(i == 0) { 17117: } 17118: else if(timeseries_age < agemodel[i].aveage && (agemodel[i].type == TIME || agemodel[i].type == HANDPICK)) { 17119: (void)sprintf(buffer, "The time series age datum conflicts with a tuned datum above it."); 17120: SpManageWarningBox(buffer); 17121: return; 17122: } 17123: i=pos; 17124: while(i<agemodel_cnt-1 && timeseries_age > agemodel[i].aveage && 17125: agemodel[i].type != TIME && agemodel[i].type != HANDPICK) { 17126: ++i; 17127: } 17128: if(i == agemodel_cnt+1) { 17129: } 17130: else if(timeseries_age > agemodel[i].aveage && (agemodel[i].type == TIME || agemodel[i].type == HANDPICK)) { 17131: (void)sprintf(buffer, "The time series age datum conflicts with a tuned datum below it."); 17132: SpManageWarningBox(buffer); 17133: return; 17134: } 17135: } 17136: 17137: if(pos == -1) { 17138: (void)sprintf(buffer, "Could not place the time series age datum in the list."); 17139: SpManageWarningBox(buffer); 17140: return; 17141: } 17142: else { 17143: ++agemodel_cnt; 17144: if(pos == agemodel_cnt-1) { 17145: array = agemodel_cnt-1; 17146: } 17147: else { 17148: for(k=agemodel_cnt-1; k>pos; --k) { 17149: agemodel[k] = agemodel[k-1]; 17150: } 17151: array = pos; 17152: } 17153: } 17154: } 17155: else if(agemodel_cnt == 0) { 17156: agemodel_cnt = 1; 17157: array = 0; 17158: } 17159: 17160: agemodel[array].aveage = timeseries_age; 17161: agemodel[array].type = TIME; 17162: (void)sprintf(agemodel[array].code, "T"); 17163: (void)sprintf(agemodel[array].name, "timeseries"); 17164: 17165: if(timeseries_age == 0.0 && spl_mcd == 0.0) { 17166: agemodel[array].avembsf = 0.0; 17167: agemodel[array].avemcd = 0.0; 17168: } 17169: else { 17170: agemodel[array].avembsf = spl_mbsf; 17171: agemodel[array].avemcd = spl_mcd; 17172: } 17173: 17174: RecalcDatumAges(); 17175: 17176: XmListDeleteAllItems(listConstructAgeModel); 17177: for(i=0; i<agemodel_cnt; ++i) { 17178: if((string=(char*)calloc((int)strlen(agemodel[i].name)+(int)strlen(agemodel[i].code)+100,CHAR_SIZE))==NULL) 17179: SpBadMemAlloc("SpliceToAgeAddTiedDatum"); 17180: (void)sprintf(string, "%7.2f %7.2f %7.3f %s %s", agemodel[i].avembsf, agemodel[i].avemcd, 17181: agemodel[i].aveage, agemodel[i].name, agemodel[i].code); 17182: xmstring = XmStringCreateSimple(string); 17183: XmListAddItemUnselected(listConstructAgeModel, xmstring, i + 1); 17184: XmStringFree(xmstring); 17185: free(string); 17186: } 17187: 17188: } 17189: 17190: if(agemodel_cnt > 1) { 17191: XtSetSensitive(pushButtonSaveAgeMode, True); 17192: XtSetSensitive(pushButtonRemoveSelectDatum, True); 17193: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, True); 17194: if(have_splice == DO) { 17195: XtSetSensitive(pushButtonPlotSpliceVsAge, True); 17196: XtSetSensitive(pushButtonSaveSpliceToAge, True); 17197: if(have_time_series == DONT) { 17198: XtSetSensitive(pushButtonOpenAgeSignal, True); 17199: XtSetSensitive(pushButtonOpenTimeSeries, True); 17200: } 17201: else if(have_time_series == DO) { 17202: XtSetSensitive(pushButtonOpenAgeSignal, False); 17203: XtSetSensitive(pushButtonOpenTimeSeries, False); 17204: } 17205: have_splicetoage = DO; 17206: } 17207: else { 17208: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 17209: XtSetSensitive(pushButtonSaveSpliceToAge, False); 17210: XtSetSensitive(pushButtonOpenAgeSignal, False); 17211: XtSetSensitive(pushButtonOpenTimeSeries, False); 17212: have_splicetoage = DONT; 17213: } 17214: did_agemodel = YES; 17215: saved_agemodel = NO; 17216: } 17217: else { 17218: XtSetSensitive(pushButtonPlotSpliceVsAge, False); 17219: XtSetSensitive(pushButtonSaveAgeMode, False); 17220: XtSetSensitive(pushButtonSaveSpliceToAge, False); 17221: XtSetSensitive(pushButtonRemoveSelectDatum, False); 17222: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, False); 17223: XtSetSensitive(pushButtonOpenAgeSignal, False); 17224: XtSetSensitive(pushButtonOpenTimeSeries, False); 17225: have_splicetoage = DONT; 17226: } 17227: if(agemodel_cnt > 0) { 17228: XtSetSensitive(pushButtonRemoveSelectDatum, True); 17229: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, True); 17230: } 17231: else { 17232: XtSetSensitive(pushButtonRemoveSelectDatum, False); 17233: XtSetSensitive(pushButtonAgeDepthClearAgeMododelList, False); 17234: } 17235: 17236: 17237: if(XtIsManaged(XtParent(drawingAreaAgeDepth))) { 17238: DrawDrawingAreaAgeDepth(drawingAreaAgeDepth, (XtPointer)NULL, (XtPointer)NULL); 17239: } 17240: if(have_splicetoage == DO) { 17241: PlotSpliceVsAge(NO); 17242: } 17243: } 17244: 17245: /* ARGSUSED */ 17246: void 17247: DrawDrawingAreaTieToTimeSeriesCorr(w, client_data, call_data) 17248: Widget w; 17249: XtPointer client_data; 17250: XtPointer call_data; 17251: { 17252: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17253: 17254: int i, nlagtic, sx, sy, sdx, sdy, 17255: xaxispixlen, yaxispixlen, err; 17256: float lagtic, maxlag; 17257: double fract, check, ip; 17258: Dimension win_height, win_width; 17259: XGCValues gcValues; 17260: void AxisCorr(); 17261: int XAxisTimeCorrSetup(); 17262: 17263: XClearWindow(XtDisplay(w), XtWindow(w)); 17264: XtVaGetValues(w, XmNheight, &win_height, XmNwidth, &win_width, NULL); 17265: 17266: /*calc. the length of the y axis and the half length 17267: of the x axis. adjust the length of x axis if its 17268: total length is not divisable by ten 17269: */ 17270: xaxispixlen = ((int)win_width - (2 * SPACE))/2; 17271: yaxispixlen = ((int)win_height - (2 * SPACE)); 17272: 17273: if(have_splicetoage_corr == DO && lead_lag > 0){ 17274: check = yaxispixlen; 17275: fract = modf((check/10.0), &ip); 17276: if(fract == 0.0){ 17277: } 17278: else if(fract < 0.5){ 17279: yaxispixlen = ip * 10.0; 17280: } 17281: else { 17282: yaxispixlen = (ip * 10.0) + 10.0; 17283: } 17284: check = yaxispixlen; 17285: if((corrperpix = 2.0/check) <= 0) { 17286: return; 17287: } 17288: 17289: /* x=lead-lag axis 17290: */ 17291: if((err = XAxisTimeCorrSetup(lead_lag, depstep, &xaxispixlen, &lagtic, &nlagtic, &lagperpix, &maxlag)) != 0) { 17292: return; 17293: } 17294: 17295: /*set the axis and label color 17296: */ 17297: XSetForeground(XtDisplay(w), gc_drawingAreaTieToTimeSeriesCorr, 17298: fgPixel[LABEL_COLOR]); 17299: AxisCorr(XtDisplay(w), XtWindow(w), gc_drawingAreaTieToTimeSeriesCorr, 17300: lagtic, nlagtic, maxlag, yaxispixlen, xaxispixlen, 2); 17301: 17302: /*set the corr. coef. color 17303: */ 17304: XSetForeground(XtDisplay(w), gc_drawingAreaTieToTimeSeriesCorr, 17305: fgPixel[CORRCOEF_COLOR]); 17306: gcValues.line_width = 2; 17307: XChangeGC(XtDisplay(w), gc_drawingAreaTieToTimeSeriesCorr, GCLineWidth, &gcValues); 17308: for(i=0; i<corr.num_lead_lag[dset]-1; ++i){ 17309: sx=(corr.depleadlag[dset][i]/lagperpix) + SPACE + xaxispixlen; 17310: sy= -1.0 * (corr.coef[dset][i]/corrperpix) + SPACE + yaxispixlen/2; 17311: sdx=(corr.depleadlag[dset][i+1]/lagperpix) + SPACE + xaxispixlen; 17312: sdy= -1.0 * (corr.coef[dset][i+1]/corrperpix) + SPACE + yaxispixlen/2; 17313: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieToTimeSeriesCorr, 17314: sx, sy, sdx, sdy); 17315: if(i == best_corr_num || i+1 == best_corr_num){ 17316: XSetForeground(XtDisplay(w), gc_drawingAreaTieToTimeSeriesCorr, 17317: fgPixel[BESTCORR_COLOR]); 17318: if(i == best_corr_num){ 17319: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieToTimeSeriesCorr, 17320: sx, (SPACE + yaxispixlen/2) - 5, sx, (SPACE + yaxispixlen/2) + 5); 17321: } 17322: else if(i+1 == best_corr_num){ 17323: XDrawLine(XtDisplay(w), XtWindow(w), gc_drawingAreaTieToTimeSeriesCorr, 17324: sdx, (SPACE + yaxispixlen/2) - 5, sdx, (SPACE + yaxispixlen/2) + 5); 17325: } 17326: XSetForeground(XtDisplay(w), gc_drawingAreaTieToTimeSeriesCorr, 17327: fgPixel[CORRCOEF_COLOR]); 17328: } 17329: } 17330: gcValues.line_width = 0; 17331: XChangeGC(XtDisplay(w), gc_drawingAreaTieToTimeSeriesCorr, GCLineWidth, &gcValues); 17332: } 17333: else { 17334: } 17335: } 17336: 17337: /* ARGSUSED */ 17338: void 17339: EventProcDrawingAreaTieToTimeSeriesCorr(w, event, args, num_args) 17340: Widget w; 17341: XButtonEvent *event; 17342: String *args; 17343: int *num_args; 17344: { 17345: int x, i, kk, diff, xaxispixlen, idum, err; 17346: char string[200]; 17347: float fdum; 17348: double check, fract, ip; 17349: XmString xmstring; 17350: Dimension win_width; 17351: int XAxisTimeCorrSetup(); 17352: 17353: x = event->x; 17354: 17355: if(have_splicetoage_corr == DONT){ 17356: (void)sprintf(string, ""); 17357: } 17358: else if(have_splicetoage_corr == DO && corr.num_lead_lag[dset] > 0){ 17359: 17360: XtVaGetValues(w, XmNwidth, &win_width, NULL); 17361: 17362: /*calc. the length of the y axis and the half length 17363: of the x axis. adjust the length of x axis if its 17364: total length is not divisable by ten 17365: */ 17366: xaxispixlen = ((int)win_width - (2 * SPACE))/2; 17367: 17368: /* 17369: */ 17370: if((err = XAxisTimeCorrSetup(lead_lag, depstep, &xaxispixlen, &fdum, &idum, &lagperpix, &fdum)) != 0) { 17371: return; 17372: } 17373: 17374: check = corr.depleadlag[dset][0]/lagperpix + SPACE + xaxispixlen; 17375: diff= fabs(x-check); 17376: kk = 0; 17377: for(i=1; i<corr.num_lead_lag[dset]; ++i){ 17378: check = corr.depleadlag[dset][i]/lagperpix + SPACE + xaxispixlen; 17379: if(fabs(x-check) < diff){ 17380: diff = fabs(x-check); 17381: kk=i; 17382: } 17383: } 17384: (void)sprintf(string, "lead/leg = %.4fMa coef = %4.2f n = %3d age offset = %10.4fMa", 17385: corr.depleadlag[dset][kk], corr.coef[dset][kk], corr.n[kk], corr.depoffset[kk]); 17386: } 17387: else { 17388: (void)sprintf(string, ""); 17389: } 17390: 17391: if((int)strcmp(args[0], "but_1_down") == 0 || (int)strcmp(args[0], "but_1_move") == 0) { 17392: xmstring = XmStringCreateSimple(string); 17393: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 17394: XmStringFree(xmstring); 17395: } 17396: else if((int)strcmp(args[0], "but_1_up") == 0) { 17397: (void)sprintf(string, ""); 17398: xmstring = XmStringCreateSimple(string); 17399: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNlabelString, xmstring, NULL); 17400: XmStringFree(xmstring); 17401: } 17402: 17403: (void)sprintf(string, ""); 17404: } 17405: 17406: void 17407: SpliceToAgeRemoveTimeSeries(w, client_data, call_data) 17408: Widget w; 17409: XtPointer client_data; 17410: XtPointer call_data; 17411: { 17412: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17413: 17414: XmString xmstring; 17415: void DrawDrawingAreaSpliceToAge(); 17416: 17417: SpCleanUp(TIMESERIES); 17418: 17419: have_time_series = DONT; 17420: have_timeseries_tie = DONT; 17421: have_splicetoage_tie = DONT; 17422: XtUnmanageChild(formSpliceToAgeTieToTimeSeries); 17423: XtUnmanageChild(labelInvertTimeSeries); 17424: XtUnmanageChild(radioBoxInvertTimeSeries); 17425: XtVaSetValues(XtParent(formSpliceToAge), XmNwidth, 560, NULL); 17426: XtSetSensitive(pushButtonOpenAgeSignal, True); 17427: XtSetSensitive(pushButtonOpenTimeSeries, True); 17428: XtSetSensitive(radioBoxInvertTimeSeries, False); 17429: XtSetSensitive(pushButtonSpliceToAgeRemoveTimeSeries, False); 17430: xmstring=XmCvtCTToXmString("Open Time Series"); 17431: XtVaSetValues(pushButtonOpenTimeSeries,XmNlabelString,xmstring,NULL); 17432: XtVaSetValues(pushButtonOpenAgeSignal,XmNlabelString,xmstring,NULL); 17433: XmStringFree(xmstring); 17434: 17435: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 17436: reason_for_redraw = DRAW_EVERYTHING; 17437: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 17438: } 17439: } 17440: 17441: void 17442: SpliceToAgeClearTie(w, client_data, call_data) 17443: Widget w; 17444: XtPointer client_data; 17445: XtPointer call_data; 17446: { 17447: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17448: 17449: void DrawDrawingAreaSpliceToAge(); 17450: 17451: have_timeseries_tie = DONT; 17452: have_splicetoage_tie = DONT; 17453: last_splicetoage_tie = NONE; 17454: XtSetSensitive(pushButtonSpliceToAgeAddTiedDatum, False); 17455: XtSetSensitive(pushButtonSpliceToAgeRecorrelate, False); 17456: XtSetSensitive(pushButtonSpliceToAgeClearTie, False); 17457: 17458: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 17459: reason_for_redraw = DRAW_EVERYTHING; 17460: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 17461: } 17462: } 17463: 17464: void 17465: OpenSplicerTable(w, client_data, call_data) 17466: Widget w; 17467: XtPointer client_data; 17468: XtPointer call_data; 17469: { 17470: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17471: 17472: char *str, *path; 17473: int len; 17474: XmString xmstring; 17475: 17476: void SpUpdateFileSelection(); 17477: 17478: XtManageChild(formFileSelection); 17479: XtPopup(XtParent(formFileSelection),XtGrabNone); 17480: xmstring=XmCvtCTToXmString("Read"); 17481: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 17482: XmStringFree(xmstring); 17483: 17484: fileselection = OPENSPLICETABLE; 17485: 17486: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Open Splicer Table", NULL); 17487: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 17488: 17489: if((path=(char*)calloc((int)strlen(splicertable.dirname)+1000,CHAR_SIZE))==NULL) 17490: SpBadMemAlloc("OpenSplicerTable"); 17491: (void)sprintf(path, "%s", splicertable.dirname); 17492: 17493: len = (int)strlen(path); 17494: if(strcmp(&path[len-1], "/") == 0) { 17495: *strrchr(path,'/')= '\0'; 17496: } 17497: 17498: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 17499: SpBadMemAlloc("OpenSplicerTable"); 17500: } 17501: (void)sprintf(str,"%s/*", path); 17502: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 17503: free(str); 17504: 17505: XtVaSetValues(textFileSelectionSelected, XmNvalue, splicertable.filename, NULL); 17506: 17507: SpUpdateFileSelection(FILE_FILTER, OPENSPLICETABLE, path); 17508: (void)sprintf(preview_input_path,"%s",path); 17509: 17510: free(path); 17511: if(path) 17512: path = NULL; 17513: } 17514: 17515: void 17516: OpenStrat(w, client_data, call_data) 17517: Widget w; 17518: XtPointer client_data; 17519: XtPointer call_data; 17520: { 17521: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17522: 17523: int len; 17524: char *str, *path; 17525: XmString xmstring; 17526: 17527: void SpUpdateFileSelection(); 17528: 17529: XtManageChild(formFileSelection); 17530: XtPopup(XtParent(formFileSelection),XtGrabNone); 17531: xmstring=XmCvtCTToXmString("Read"); 17532: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 17533: XmStringFree(xmstring); 17534: XtVaSetValues(XtParent(formFileSelection), XmNheight, 670, NULL); 17535: XtVaSetValues(optionMenuStratType1, XmNmappedWhenManaged, True, NULL); 17536: XtVaSetValues(labelStratType1, XmNmappedWhenManaged, True, NULL); 17537: XtManageChild(optionMenuStratType1); 17538: XtManageChild(labelStratType1); 17539: 17540: fileselection = OPENSTRAT; 17541: 17542: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Open Stratigraphy", NULL); 17543: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 17544: 17545: if((path=(char*)calloc((int)strlen(default_strat_dirname)+1000,CHAR_SIZE))==NULL) 17546: SpBadMemAlloc("OpenSplicerTable"); 17547: (void)sprintf(path, "%s", default_strat_dirname); 17548: 17549: len = (int)strlen(path); 17550: if(strcmp(&path[len-1], "/") == 0) { 17551: *strrchr(path,'/')= '\0'; 17552: } 17553: 17554: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 17555: SpBadMemAlloc("OpenStrat"); 17556: } 17557: (void)sprintf(str, "%s", path); 17558: XtVaSetValues(textFileSelectionSelected, XmNvalue, str, NULL); 17559: (void)strncat(str,"/*",2); 17560: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 17561: free(str); 17562: 17563: SpUpdateFileSelection(FILE_FILTER,OPENSTRAT, path); 17564: (void)sprintf(preview_input_path,"%s",path); 17565: 17566: free(path); 17567: if(path) 17568: path = NULL; 17569: } 17570: 17571: void 17572: FileSelectionPreviewInputFilter(w, client_data, call_data) 17573: Widget w; 17574: XtPointer client_data; 17575: XtPointer call_data; 17576: { 17577: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17578: 17579: void SpUpdateFileSelection(); 17580: 17581: SpUpdateFileSelection(FILE_FILTER, PREVIEWINPUT, preview_input_path); 17582: XtVaSetValues(textFileSelectionSelectedPreviewInput, XmNvalue, preview_input_path, NULL); 17583: } 17584: 17585: void 17586: FileSelectionPreviewInputOK(w, client_data, call_data) 17587: Widget w; 17588: XtPointer client_data; 17589: XtPointer call_data; 17590: { 17591: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17592: 17593: char *infile; 17594: FILE *fd; 17595: 17596: infile = XmTextGetString(textFileSelectionSelectedPreviewInput); 17597: if(strlen(infile) == 0) { 17598: return; 17599: } 17600: 17601: /* check that filename is a valid name 17602: */ 17603: if((fd=fopen(infile, "r")) == NULL) { 17604: (void)sprintf(buffer,"Error opening preview input file %s", infile); 17605: SpManageWarningBox(buffer); 17606: } 17607: else { 17608: 17609: fclose(fd); 17610: ReadPreviewInput(infile); 17611: XtManageChild(formPreviewInput); 17612: XtPopup(XtParent(formPreviewInput),XtGrabNone); 17613: } 17614: 17615: free(infile); 17616: } 17617: 17618: void 17619: FileSelectionPreviewInputCancel(w, client_data, call_data) 17620: Widget w; 17621: XtPointer client_data; 17622: XtPointer call_data; 17623: { 17624: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17625: 17626: XtUnmanageChild(formFileSelectionPreviewInput); 17627: } 17628: 17629: void 17630: FileSelectionDirectoryPreviewInput(w, client_data, call_data) 17631: Widget w; 17632: XtPointer client_data; 17633: XtPointer call_data; 17634: { 17635: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17636: 17637: void SpUpdateFileSelection(); 17638: 17639: SpUpdateFileSelection(DIRECTORIES,PREVIEWINPUT, preview_input_path); 17640: 17641: XtVaSetValues(textFileSelectionSelectedPreviewInput, XmNvalue, preview_input_path, NULL); 17642: 17643: } 17644: 17645: void 17646: FileSelectionFilePreviewInput(w, client_data, call_data) 17647: Widget w; 17648: XtPointer client_data; 17649: XtPointer call_data; 17650: { 17651: XmListCallbackStruct *acs=(XmListCallbackStruct*)call_data; 17652: 17653: int nfile; 17654: char *infile, *path; 17655: 17656: /* get selected file name 17657: */ 17658: 17659: XmStringGetLtoR(acs->item,XmFONTLIST_DEFAULT_TAG,&infile); 17660: if((path=(char*)calloc((int)strlen(preview_input_path) + (int)strlen(infile)+50,CHAR_SIZE))==NULL) 17661: SpBadMemAlloc("FileSelectionFile"); 17662: 17663: (void)sprintf(path,"%s/%s",preview_input_path, infile); 17664: XtVaSetValues(textFileSelectionSelectedPreviewInput, XmNvalue, path, NULL); 17665: 17666: free(infile); 17667: free(path); 17668: } 17669: 17670: void 17671: InvertTimeSeries(w, client_data, call_data) 17672: Widget w; 17673: XtPointer client_data; 17674: XtPointer call_data; 17675: { 17676: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17677: 17678: void SpliceToAgeRecorrelate(); 17679: char *pclient = (char*) client_data; 17680: 17681: if(*pclient == 'Y') { 17682: XmToggleButtonSetState(toggleButtonTimeSeriesInvertYes, True, False); 17683: XmToggleButtonSetState(toggleButtonTimeSeriesInvertNo, False, False); 17684: } 17685: else if(*pclient == 'N') { 17686: XmToggleButtonSetState(toggleButtonTimeSeriesInvertNo, True, False); 17687: XmToggleButtonSetState(toggleButtonTimeSeriesInvertYes, False, False); 17688: } 17689: 17690: else { 17691: XmToggleButtonSetState(toggleButtonTimeSeriesInvertNo, True, False); 17692: XmToggleButtonSetState(toggleButtonTimeSeriesInvertYes, False, False); 17693: } 17694: 17695: if(have_time_series == DO) { 17696: if(XtIsManaged(XtParent(drawingAreaSpliceToAge))) { 17697: DrawDrawingAreaSpliceToAge(drawingAreaSpliceToAge, (XtPointer)NULL, (XtPointer)NULL); 17698: } 17699: } 17700: 17701: if(have_splicetoage_tie == DO && have_timeseries_tie == DO && 17702: have_splicetoage == DO && have_time_series == DO) { 17703: SpliceToAgeRecorrelate((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL); 17704: } 17705: } 17706: 17707: void 17708: SpDontUseAffineCB(w, client_data, call_data) 17709: Widget w; 17710: XtPointer client_data; 17711: XtPointer call_data; 17712: { 17713: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17714: 17715: XmToggleButtonCallbackStruct *toggle_info=(XmToggleButtonCallbackStruct *) call_data; 17716: affine.usetable = False; 17717: if(toggle_info->set) { 17718: XmTextSetString(textFieldAffineFileName,""); 17719: XtSetSensitive(pushButtonSelectAffineFileName, False); 17720: } 17721: } 17722: 17723: void 17724: OpenFormatODPOtherActive(w, client_data, call_data) 17725: Widget w; 17726: XtPointer client_data; 17727: XtPointer call_data; 17728: { 17729: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17730: 17731: char string [10]; 17732: 17733: XtManageChild(formOpenFormatsOther); 17734: XtPopup(XtParent(formOpenFormatsOther),XtGrabNone); 17735: XtSetSensitive(pushButtonOpenReflectance, True); 17736: XtSetSensitive(pushButtonOpenGrape, True); 17737: XtSetSensitive(pushButtonOpenPwave, True); 17738: XtSetSensitive(pushButtonOpenSusceptibility, True); 17739: XtSetSensitive(pushButtonOpenNaturalGamma, True); 17740: XtSetSensitive(pushButtonOpenOtherType, True); 17741: XtSetSensitive(toggleButtonHeaderNo, True); 17742: XtSetSensitive(toggleButtonHeaderYes, True); 17743: XtSetSensitive(textFieldNHeader, True); 17744: 17745: if(XmToggleButtonGetState(toggleButtonOpenFormatsOther1) == True) { 17746: (void)sprintf(string, "10"); 17747: } 17748: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther2) == True) { 17749: (void)sprintf(string, "9"); 17750: } 17751: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther3) == True) { 17752: (void)sprintf(string, "8"); 17753: } 17754: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther4) == True) { 17755: (void)sprintf(string, "7"); 17756: } 17757: else if(XmToggleButtonGetState(toggleButtonOpenFormatsOther5) == True) { 17758: (void)sprintf(string, "9"); 17759: } 17760: else { 17761: (void)sprintf(string, "?"); 17762: } 17763: XtVaSetValues(textFieldOpenFormatOtherValueColumn, XmNvalue, string, NULL); 17764: 17765: (void)sprintf(string, ""); 17766: } 17767: 17768: void 17769: SelectAffineTableFileName(w, client_data, call_data) 17770: Widget w; 17771: XtPointer client_data; 17772: XtPointer call_data; 17773: { 17774: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17775: 17776: char *str, *path; 17777: int len; 17778: XmString xmstring; 17779: 17780: void SpUpdateFileSelection(); 17781: 17782: XtUnmanageChild(formUseAffine); 17783: XtManageChild(formFileSelection); 17784: XtPopup(XtParent(formFileSelection),XtGrabNone); 17785: xmstring=XmCvtCTToXmString("OK"); 17786: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 17787: XmStringFree(xmstring); 17788: 17789: fileselection = OPENAFFINE; 17790: 17791: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Open Affine Table", NULL); 17792: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 17793: 17794: if((path=(char*)calloc((int)strlen(affine.dirname)+1000,CHAR_SIZE))==NULL) 17795: SpBadMemAlloc("SelectAffineTableFileName"); 17796: (void)sprintf(path, "%s", affine.dirname); 17797: 17798: len = (int)strlen(path); 17799: if(strcmp(&path[len-1], "/") == 0) { 17800: *strrchr(path,'/')= '\0'; 17801: } 17802: 17803: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 17804: SpBadMemAlloc("SelectAffineTableFileName"); 17805: } 17806: (void)sprintf(str,"%s/*", path); 17807: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 17808: free(str); 17809: 17810: XtVaSetValues(textFileSelectionSelected, XmNvalue, affine.filename, NULL); 17811: 17812: SpUpdateFileSelection(FILE_FILTER, OPENAFFINE, path); 17813: (void)sprintf(preview_input_path,"%s",path); 17814: 17815: free(path); 17816: if(path) 17817: path = NULL; 17818: } 17819: 17820: void 17821: OpenFormatTKActive(w, client_data, call_data) 17822: Widget w; 17823: XtPointer client_data; 17824: XtPointer call_data; 17825: { 17826: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17827: 17828: Widget tmp_widget; 17829: 17830: XtVaGetValues(optionMenuOpenType,XmNmenuHistory,&tmp_widget,NULL); 17831: if(tmp_widget == pushButtonOpenOtherType) { 17832: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenGrape, NULL); 17833: } 17834: XtSetSensitive(pushButtonOpenReflectance, True); 17835: XtSetSensitive(pushButtonOpenGrape, True); 17836: XtSetSensitive(pushButtonOpenPwave, True); 17837: XtSetSensitive(pushButtonOpenSusceptibility, True); 17838: XtSetSensitive(pushButtonOpenNaturalGamma, True); 17839: XtSetSensitive(pushButtonOpenOtherType, False); 17840: XtSetSensitive(toggleButtonHeaderNo, True); 17841: XtSetSensitive(toggleButtonHeaderYes, True); 17842: XtSetSensitive(textFieldNHeader, True); 17843: } 17844: 17845: void 17846: OpenFormatMST95Active(w, client_data, call_data) 17847: Widget w; 17848: XtPointer client_data; 17849: XtPointer call_data; 17850: { 17851: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17852: 17853: Widget tmp_widget; 17854: 17855: XtVaGetValues(optionMenuOpenType,XmNmenuHistory,&tmp_widget,NULL); 17856: if(tmp_widget == pushButtonOpenOtherType) { 17857: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenGrape, NULL); 17858: } 17859: XtSetSensitive(pushButtonOpenReflectance, True); 17860: XtSetSensitive(pushButtonOpenGrape, True); 17861: XtSetSensitive(pushButtonOpenPwave, True); 17862: XtSetSensitive(pushButtonOpenSusceptibility, True); 17863: XtSetSensitive(pushButtonOpenNaturalGamma, True); 17864: XtSetSensitive(pushButtonOpenOtherType, False); 17865: XtSetSensitive(toggleButtonHeaderNo, True); 17866: XtSetSensitive(toggleButtonHeaderYes, True); 17867: XtSetSensitive(textFieldNHeader, True); 17868: } 17869: 17870: void 17871: OpenFormatOSUSCATActive(w, client_data, call_data) 17872: Widget w; 17873: XtPointer client_data; 17874: XtPointer call_data; 17875: { 17876: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17877: 17878: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenReflectance, NULL); 17879: XtSetSensitive(pushButtonOpenReflectance, True); 17880: XtSetSensitive(pushButtonOpenGrape, False); 17881: XtSetSensitive(pushButtonOpenPwave, False); 17882: XtSetSensitive(pushButtonOpenSusceptibility, False); 17883: XtSetSensitive(pushButtonOpenNaturalGamma, False); 17884: XtSetSensitive(pushButtonOpenOtherType, False); 17885: XtSetSensitive(toggleButtonHeaderNo, True); 17886: XtSetSensitive(toggleButtonHeaderYes, True); 17887: XtSetSensitive(textFieldNHeader, True); 17888: } 17889: 17890: void 17891: ColorTimeSeries(w, client_data, call_data) 17892: Widget w; 17893: XtPointer client_data; 17894: XtPointer call_data; 17895: { 17896: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17897: 17898: int item_count; 17899: char *rgbcolor; 17900: XmString *pcolor; 17901: Pixel sampPixel; 17902: int GetColorPixelValue(); 17903: 17904: /* get the selected color name from the list 17905: */ 17906: XtVaGetValues(listColor, XmNselectedItemCount,&item_count, 17907: XmNselectedItems,&pcolor, NULL); 17908: XmStringGetLtoR(pcolor[0], XmFONTLIST_DEFAULT_TAG, &rgbcolor); 17909: 17910: /* and change the color of the core label button 17911: */ 17912: GetColorPixelValue(XtDisplay(w), rgbcolor, &sampPixel); 17913: XtVaSetValues(pushButtonColorTimeSeries, XmNbackground, sampPixel, NULL); 17914: 17915: XtVaSetValues(pushButtonColorTimeSeries, XmNlabelString, pcolor[0], NULL); 17916: (void)sprintf(tempcolor[TIMESERIES_COLOR], "%s", rgbcolor); 17917: tempfgPixel[TIMESERIES_COLOR] = sampPixel; 17918: XtFree(rgbcolor); 17919: } 17920: 17921: void 17922: SaveAffineTable(w, client_data, call_data) 17923: Widget w; 17924: XtPointer client_data; 17925: XtPointer call_data; 17926: { 17927: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17928: 17929: char *str, *path; 17930: int len; 17931: XmString xmstring; 17932: 17933: void SpUpdateFileSelection(); 17934: 17935: XtManageChild(formFileSelection); 17936: XtPopup(XtParent(formFileSelection),XtGrabNone); 17937: xmstring=XmCvtCTToXmString("Save"); 17938: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 17939: XmStringFree(xmstring); 17940: 17941: fileselection = SAVEAFFINE; 17942: 17943: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Save Affine Table", NULL); 17944: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 17945: 17946: if((path=(char*)calloc((int)strlen(affine.dirname)+1000,CHAR_SIZE))==NULL) 17947: SpBadMemAlloc("SaveAffineTable"); 17948: (void)sprintf(path, "%s", affine.dirname); 17949: 17950: len = (int)strlen(path); 17951: if(strcmp(&path[len-1], "/") == 0) { 17952: *strrchr(path,'/')= '\0'; 17953: } 17954: 17955: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 17956: SpBadMemAlloc("SaveAffineTable"); 17957: } 17958: (void)sprintf(str,"%s/*", path); 17959: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 17960: free(str); 17961: 17962: XtVaSetValues(textFileSelectionSelected, XmNvalue, affine.filename, NULL); 17963: 17964: SpUpdateFileSelection(FILE_FILTER, SAVEAFFINE, path); 17965: (void)sprintf(preview_input_path,"%s",path); 17966: 17967: free(path); 17968: if(path) 17969: path = NULL; 17970: } 17971: 17972: void 17973: SaveSpliceTable(w, client_data, call_data) 17974: Widget w; 17975: XtPointer client_data; 17976: XtPointer call_data; 17977: { 17978: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 17979: 17980: char *str, *path; 17981: int len; 17982: XmString xmstring; 17983: 17984: void SpUpdateFileSelection(); 17985: 17986: XtManageChild(formFileSelection); 17987: XtPopup(XtParent(formFileSelection),XtGrabNone); 17988: xmstring=XmCvtCTToXmString("Save"); 17989: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 17990: XmStringFree(xmstring); 17991: 17992: fileselection = SAVESPLICETABLE; 17993: 17994: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Save Splicer Table", NULL); 17995: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 17996: 17997: if((path=(char*)calloc((int)strlen(splicertable.dirname)+1000,CHAR_SIZE))==NULL) 17998: SpBadMemAlloc("SaveSplicerTable"); 17999: (void)sprintf(path, "%s", splicertable.dirname); 18000: 18001: len = (int)strlen(path); 18002: if(strcmp(&path[len-1], "/") == 0) { 18003: *strrchr(path,'/')= '\0'; 18004: } 18005: 18006: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 18007: SpBadMemAlloc("SaveSplicerTable"); 18008: } 18009: (void)sprintf(str,"%s/*", path); 18010: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 18011: free(str); 18012: 18013: XtVaSetValues(textFileSelectionSelected, XmNvalue, splicertable.filename, NULL); 18014: 18015: SpUpdateFileSelection(FILE_FILTER, SAVESPLICETABLE, path); 18016: (void)sprintf(preview_input_path,"%s",path); 18017: 18018: free(path); 18019: if(path) 18020: path = NULL; 18021: } 18022: 18023: void 18024: DontUseCullTable(w, client_data, call_data) 18025: Widget w; 18026: XtPointer client_data; 18027: XtPointer call_data; 18028: { 18029: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18030: 18031: XtSetSensitive(pushButtonSelectCullTableFilename, False); 18032: XtVaSetValues(textFieldCullTableFilename, XmNvalue, "", NULL); 18033: } 18034: 18035: void 18036: SelectCullTableFilename(w, client_data, call_data) 18037: Widget w; 18038: XtPointer client_data; 18039: XtPointer call_data; 18040: { 18041: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18042: 18043: char *str, *path; 18044: int len; 18045: XmString xmstring; 18046: 18047: void SpUpdateFileSelection(); 18048: 18049: XtUnmanageChild(formCull); 18050: XtManageChild(formFileSelection); 18051: XtPopup(XtParent(formFileSelection),XtGrabNone); 18052: xmstring=XmCvtCTToXmString("OK"); 18053: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 18054: XmStringFree(xmstring); 18055: 18056: fileselection = OPENCULLTABLE; 18057: 18058: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Open Cull Table", NULL); 18059: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 18060: 18061: if((path=(char*)calloc((int)strlen(cull.dirname)+1000,CHAR_SIZE))==NULL) 18062: SpBadMemAlloc("SelectAffineTableFileName"); 18063: (void)sprintf(path, "%s", cull.dirname); 18064: 18065: len = (int)strlen(path); 18066: if(strcmp(&path[len-1], "/") == 0) { 18067: *strrchr(path,'/')= '\0'; 18068: } 18069: 18070: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 18071: SpBadMemAlloc("SelectAffineTableFileName"); 18072: } 18073: (void)sprintf(str,"%s/*", path); 18074: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 18075: free(str); 18076: 18077: XtVaSetValues(textFileSelectionSelected, XmNvalue, cull.filename, NULL); 18078: 18079: SpUpdateFileSelection(FILE_FILTER, OPENCULLTABLE, path); 18080: (void)sprintf(preview_input_path,"%s",path); 18081: 18082: free(path); 18083: if(path) 18084: path = NULL; 18085: } 18086: 18087: void 18088: UseCullTable(w, client_data, call_data) 18089: Widget w; 18090: XtPointer client_data; 18091: XtPointer call_data; 18092: { 18093: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18094: 18095: XtSetSensitive(pushButtonSelectCullTableFilename, True); 18096: if((charptr=(char*)calloc((int)strlen(cull.filename)+10,CHAR_SIZE))==NULL) 18097: SpBadMemAlloc("UseCullTable"); 18098: (void)sprintf(charptr,"%s",cull.filename); 18099: XtVaSetValues(textFieldCullTableFilename, XmNvalue, charptr, NULL); 18100: free(charptr); 18101: } 18102: 18103: void 18104: DontUseCullParameters(w, client_data, call_data) 18105: Widget w; 18106: XtPointer client_data; 18107: XtPointer call_data; 18108: { 18109: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18110: 18111: XtSetSensitive(formCullOptions,False); 18112: } 18113: 18114: void 18115: UseCullParameters(w, client_data, call_data) 18116: Widget w; 18117: XtPointer client_data; 18118: XtPointer call_data; 18119: { 18120: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18121: 18122: XtSetSensitive(formCullOptions,True); 18123: } 18124: 18125: void 18126: SaveSplice(w, client_data, call_data) 18127: Widget w; 18128: XtPointer client_data; 18129: XtPointer call_data; 18130: { 18131: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18132: 18133: char *str, *path; 18134: int len; 18135: XmString xmstring; 18136: 18137: void SpUpdateFileSelection(); 18138: 18139: XtManageChild(formFileSelection); 18140: XtPopup(XtParent(formFileSelection),XtGrabNone); 18141: xmstring=XmCvtCTToXmString("Save"); 18142: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 18143: XmStringFree(xmstring); 18144: 18145: fileselection = SAVESPLICEDATA; 18146: 18147: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Save Splice", NULL); 18148: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 18149: 18150: if((path=(char*)calloc((int)strlen(outspdata_dirname)+1000,CHAR_SIZE))==NULL) 18151: SpBadMemAlloc("OpenSplicerTable"); 18152: (void)sprintf(path, "%s", outspdata_dirname); 18153: 18154: len = (int)strlen(path); 18155: if(strcmp(&path[len-1], "/") == 0) { 18156: *strrchr(path,'/')= '\0'; 18157: } 18158: 18159: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 18160: SpBadMemAlloc("OpenSplicerTable"); 18161: } 18162: (void)sprintf(str,"%s/*", path); 18163: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 18164: free(str); 18165: 18166: XtVaSetValues(textFileSelectionSelected, XmNvalue, outspdata_filename, NULL); 18167: 18168: SpUpdateFileSelection(FILE_FILTER, SAVESPLICEDATA, path); 18169: (void)sprintf(preview_input_path,"%s",path); 18170: 18171: free(path); 18172: if(path) 18173: path = NULL; 18174: } 18175: 18176: void 18177: SaveDataDirectory(w, client_data, call_data) 18178: Widget w; 18179: XtPointer client_data; 18180: XtPointer call_data; 18181: { 18182: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18183: 18184: char *filter, *path; 18185: 18186: void SpUpdateFileSelection(); 18187: 18188: filter = XmTextGetString(textFieldSaveDataFilter); 18189: /* allocate a lot of space for path so don't need to 18190: reallocate in SpUpdateFileSelection 18191: when reallocate there lose the pointer 18192: */ 18193: if((path=(char*)calloc((int)strlen(filter) + 1000,CHAR_SIZE))==NULL) 18194: SpBadMemAlloc("FileSelectionFile"); 18195: (void)sprintf(path, "%s", filter); 18196: *strrchr(path,'*')= '\0'; 18197: *strrchr(path,'/')= '\0'; 18198: 18199: SpUpdateFileSelection(DIRECTORIES,SAVEDATA, path); 18200: (void)sprintf(preview_input_path,"%s",path); 18201: 18202: XtVaSetValues(textFieldSaveDataDirectory, XmNvalue, path, NULL); 18203: 18204: free(path); 18205: } 18206: 18207: void 18208: SaveData(w, client_data, call_data) 18209: Widget w; 18210: XtPointer client_data; 18211: XtPointer call_data; 18212: { 18213: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18214: 18215: int len; 18216: char *str, *path; 18217: void XmTextFieldSetString(), SpUpdateFileSelection(); 18218: 18219: XtManageChild(formOutput); 18220: (void)XmTextFieldSetString(textFieldOutputPrefix,output_type[data[dset]->type]); 18221: (void)XmTextFieldSetString(textFieldOutputSuffix,"mod"); 18222: 18223: if((path=(char*)calloc((int)strlen(outdata_dirname)+1000,CHAR_SIZE))==NULL) 18224: SpBadMemAlloc("SaveData"); 18225: (void)sprintf(path, "%s", outdata_dirname); 18226: 18227: len = (int)strlen(path); 18228: if(strcmp(&path[len-1], "/") == 0) { 18229: *strrchr(path,'/')= '\0'; 18230: } 18231: 18232: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 18233: SpBadMemAlloc("SaveData"); 18234: } 18235: (void)sprintf(str, "%s/", path); 18236: XtVaSetValues(textFieldSaveDataDirectory, XmNvalue, str, NULL); 18237: (void)strncat(str,"*",1); 18238: XtVaSetValues(textFieldSaveDataFilter, XmNvalue, str, NULL); 18239: free(str); 18240: 18241: SpUpdateFileSelection(FILE_FILTER,SAVEDATA, path); 18242: 18243: free(path); 18244: } 18245: 18246: void 18247: SaveCullTable(w, client_data, call_data) 18248: Widget w; 18249: XtPointer client_data; 18250: XtPointer call_data; 18251: { 18252: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18253: 18254: char *str, *path; 18255: int len; 18256: XmString xmstring; 18257: 18258: void SpUpdateFileSelection(); 18259: 18260: XtUnmanageChild(formCull); 18261: XtManageChild(formFileSelection); 18262: XtPopup(XtParent(formFileSelection),XtGrabNone); 18263: xmstring=XmCvtCTToXmString("Save"); 18264: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 18265: XmStringFree(xmstring); 18266: 18267: fileselection = SAVECULLTABLE; 18268: 18269: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Save Cull Table", NULL); 18270: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 18271: 18272: if((path=(char*)calloc((int)strlen(cull.dirname)+1000,CHAR_SIZE))==NULL) 18273: SpBadMemAlloc("SelectAffineTableFileName"); 18274: (void)sprintf(path, "%s", cull.dirname); 18275: 18276: len = (int)strlen(path); 18277: if(strcmp(&path[len-1], "/") == 0) { 18278: *strrchr(path,'/')= '\0'; 18279: } 18280: 18281: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 18282: SpBadMemAlloc("SelectAffineTableFileName"); 18283: } 18284: (void)sprintf(str,"%s/*", path); 18285: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 18286: free(str); 18287: 18288: XtVaSetValues(textFileSelectionSelected, XmNvalue, cull.filename, NULL); 18289: 18290: SpUpdateFileSelection(FILE_FILTER, SAVECULLTABLE, path); 18291: (void)sprintf(preview_input_path,"%s",path); 18292: 18293: free(path); 18294: if(path) 18295: path = NULL; 18296: } 18297: 18298: void 18299: SaveStrat(w, client_data, call_data) 18300: Widget w; 18301: XtPointer client_data; 18302: XtPointer call_data; 18303: { 18304: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18305: 18306: int len; 18307: char *str, *path; 18308: XmString xmstring; 18309: 18310: void SpUpdateFileSelection(); 18311: 18312: XtManageChild(formFileSelection); 18313: XtPopup(XtParent(formFileSelection),XtGrabNone); 18314: xmstring=XmCvtCTToXmString("Save"); 18315: XtVaSetValues(pushButtonFileSelectionOK,XmNlabelString,xmstring,NULL); 18316: XmStringFree(xmstring); 18317: 18318: fileselection = SAVESTRAT; 18319: 18320: XtVaSetValues(xmDialogShellFileSelection, XmNtitle, "Save Stratigraphy", NULL); 18321: XtVaSetValues(textFileSelectionSelected, XmNvalue, "", NULL); 18322: 18323: if((path=(char*)calloc((int)strlen(default_strat_dirname)+1000,CHAR_SIZE))==NULL) 18324: SpBadMemAlloc("OpenSplicerTable"); 18325: (void)sprintf(path, "%s", default_strat_dirname); 18326: 18327: len = (int)strlen(path); 18328: if(strcmp(&path[len-1], "/") == 0) { 18329: *strrchr(path,'/')= '\0'; 18330: } 18331: 18332: if((str=(char*)calloc((int)strlen(path)+10, CHAR_SIZE)) == NULL) { 18333: SpBadMemAlloc("OpenStrat"); 18334: } 18335: (void)sprintf(str, "%s", path); 18336: XtVaSetValues(textFileSelectionSelected, XmNvalue, str, NULL); 18337: (void)strncat(str,"/*",2); 18338: XtVaSetValues(textFileSelectionFilter, XmNvalue, str, NULL); 18339: free(str); 18340: 18341: SpUpdateFileSelection(FILE_FILTER,SAVESTRAT, path); 18342: (void)sprintf(preview_input_path,"%s",path); 18343: 18344: free(path); 18345: if(path) 18346: path = NULL; 18347: } 18348: 18349: void 18350: SaveDataFilter(w, client_data, call_data) 18351: Widget w; 18352: XtPointer client_data; 18353: XtPointer call_data; 18354: { 18355: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18356: 18357: char *filter, *path; 18358: void SpUpdateFileSelection(); 18359: 18360: filter = XmTextGetString(textFieldSaveDataFilter); 18361: /* allocate a lot of space for path so don't need to 18362: reallocate in SpUpdateFileSelection 18363: when reallocate there lose the pointer 18364: */ 18365: if((path=(char*)calloc((int)strlen(filter) + 1000,CHAR_SIZE))==NULL) 18366: SpBadMemAlloc("FileSelectionFile"); 18367: (void)sprintf(path, "%s", filter); 18368: *strrchr(path,'*')= '\0'; 18369: 18370: SpUpdateFileSelection(FILE_FILTER, SAVEDATA, path); 18371: (void)sprintf(preview_input_path,"%s",path); 18372: 18373: XtVaSetValues(textFieldSaveDataDirectory, XmNvalue, path, NULL); 18374: free(path); 18375: } 18376: 18377: void 18378: SpLaunchSeekerCB(w, client_data, call_data) 18379: Widget w; 18380: XtPointer client_data; 18381: XtPointer call_data; 18382: { 18383: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18384: 18385: char *path, *getenv(), *where; 18386: 18387: /* put together command and submit it 18388: */ 18389: if((path=(char*)calloc(1000,CHAR_SIZE))==NULL) 18390: SpBadMemAlloc("Sa"); 18391: 18392: /* (void)strcpy(path,(char*)getenv("SEEKER_PATH")); 18393: */ 18394: (void)strcpy(path,"/turf/ouzel/eqt/seeker/seeker_code"); 18395: 18396: if((where=(char*)calloc(10,CHAR_SIZE))==NULL) 18397: SpBadMemAlloc("Sa"); 18398: if(whereami == SHORE) { 18399: (void)strcpy(where, "SHORE"); 18400: } 18401: else if(whereami == SHIP) { 18402: (void)strcpy(where, "SHIP"); 18403: } 18404: else { 18405: (void)strcpy(where, "SHORE"); 18406: } 18407: if((charptr=(char*)calloc((int)strlen(path) + 200, CHAR_SIZE))==NULL) 18408: SpBadMemAlloc("Sa"); 18409: (void)sprintf(charptr,"%s/seeker-c -bg lightgray -fg black -who SAGAN -where %s & ", path, where); 18410: (void)system(charptr); 18411: free(charptr); 18412: free(path); 18413: path = NULL; 18414: free(where); 18415: where = NULL; 18416: } 18417: 18418: void 18419: OpenFormatJanusActive(w, client_data, call_data) 18420: Widget w; 18421: XtPointer client_data; 18422: XtPointer call_data; 18423: { 18424: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18425: 18426: XtManageChild(formJanus); 18427: } 18428: 18429: void 18430: OverwriteCancel(w, client_data, call_data) 18431: Widget w; 18432: XtPointer client_data; 18433: XtPointer call_data; 18434: { 18435: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18436: } 18437: 18438: void 18439: OverwriteFile(w, client_data, call_data) 18440: Widget w; 18441: XtPointer client_data; 18442: XtPointer call_data; 18443: { 18444: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18445: } 18446: 18447: 18448: void 18449: GenericTextDismiss(w, client_data, call_data) 18450: Widget w; 18451: XtPointer client_data; 18452: XtPointer call_data; 18453: { 18454: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18455: 18456: XtUnmanageChild(formGenericText); 18457: } 18458: 18459: void 18460: JanusOK(w, client_data, call_data) 18461: Widget w; 18462: XtPointer client_data; 18463: XtPointer call_data; 18464: { 18465: XmAnyCallbackStruct *acs=(XmAnyCallbackStruct*)call_data; 18466: 18467: int tmp_format; 18468: Widget tmp_widget; 18469: 18470: XtUnmanageChild(formJanus); 18471: 18472: XtVaGetValues(optionMenuOpenType,XmNmenuHistory,&tmp_widget,NULL); 18473: if(tmp_widget == pushButtonOpenOtherType) { 18474: XtVaSetValues(optionMenuOpenType, XmNmenuHistory, pushButtonOpenGrape, NULL); 18475: } 18476: XtSetSensitive(pushButtonOpenReflectance, True); 18477: XtSetSensitive(pushButtonOpenGrape, True); 18478: XtSetSensitive(pushButtonOpenPwave, True); 18479: XtSetSensitive(pushButtonOpenSusceptibility, True); 18480: XtSetSensitive(pushButtonOpenNaturalGamma, True); 18481: XtSetSensitive(pushButtonOpenOtherType, False); 18482: XtVaGetValues(optionMenuOpenFormat,XmNmenuHistory,&tmp_widget,NULL); 18483: XtVaGetValues(tmp_widget,XmNuserData,&tmp_format,NULL); 18484: if(tmp_format == JANUS) { 18485: if(XmToggleButtonGetState(toggleButtonJanusClean) == True) { 18486: XtSetSensitive(toggleButtonHeaderNo, True); 18487: XtSetSensitive(toggleButtonHeaderYes, True); 18488: XtSetSensitive(textFieldNHeader, True); 18489: } 18490: else if(XmToggleButtonGetState(toggleButtonJanusOrig) == True) { 18491: XmToggleButtonSetState(toggleButtonHeaderNo, True, NULL); 18492: XmToggleButtonSetState(toggleButtonHeaderYes, False, NULL); 18493: XtSetSensitive(toggleButtonHeaderNo, False); 18494: XtSetSensitive(toggleButtonHeaderYes, False); 18495: XtSetSensitive(textFieldNHeader, False); 18496: } 18497: } 18498: } 18499: 18500: