1: /* 2: contains the following functions: 3: */ 4: void SplicerInitialSettings(); 5: void SetMinMax(); 6: void SetDisplayDefaults(); 7: int GetDisplayValues(); 8: void AxisDep(); 9: void AxisVar(); 10: void AxisCorr(); 11: void AxisDepthOffset(); 12: void AxisAge(); 13: void MakeTheGCs(); 14: void SetInitialColors(); 15: int FindAveDepth(); 16: int Correlate(); 17: int RepickDepth(); 18: int FindMinMax(); 19: int CleanUpCore(); 20: int CleanUpSpliceCore(); 21: void DisplaySliderControl(); 22: int StdDev(); 23: int SiteAveDepth(); 24: void MakeClipMask(); 25: void FindClipRegion(); 26: int FindMinMaxOneCore(); 27: void ReadColorList(); 28: int GetColorPixelValue(); 29: void SetCustomeColorButtonColors(); 30: void SetCustomeColorWidgetBGColors(); 31: void SetCustomeColorWidgetFGColors(); 32: void PlaceDialog(); 33: void MapStratToAffine(); 34: void FindStratDepthOffset(); 35: void AgeDepthMinMax(); 36: void AgeDepthPlotValues(); 37: int CalcAge(); 38: int GetColorSet(); 39: void SetColorSetBGandFG(); 40: int FindSpliceAveAge(); 41: 42: #include <Xm/Xm.h> 43: #include <Xm/Text.h> 44: #include <stdio.h> 45: #include <stdlib.h> 46: #include <string.h> 47: #include <math.h> 48: #include "splicer-creation-c.h" 49: #include "splicer_vars.h" 50: 51: void SplicerInitialSettings(dpy) 52: Display *dpy; 53: { 54: int i; 55: char *string; 56: time_t tp; 57: 58: /* 59: if((string=(char*)calloc(1000, CHAR_SIZE))==NULL) 60: SpBadMemAlloc(""); 61: (void)strcpy(string,(char*)getenv("WHERE_AM_I")); 62: for(i=0; i<strlen(string); ++i) { 63: string[i] = toupper(string[i]); 64: } 65: if(strcmp(string, "SHIP") == 0) { 66: whereami = SHIP; 67: } 68: else if(strcmp(string, "SHORE") == 0) { 69: whereami = SHORE; 70: } 71: else { 72: whereami = SHORE; 73: } 74: free(string); 75: */ 76: dataset_cnt = 0; 77: dset = 0; 78: XtUnmanageChild(optionMenuDataSet); 79: XtUnmanageChild(pushButtonDataSet1); 80: XtUnmanageChild(pushButtonDataSet2); 81: XtUnmanageChild(pushButtonDataSet3); 82: XtUnmanageChild(pushButtonDataSet4); 83: XtUnmanageChild(pushButtonDataSet5); 84: XtUnmanageChild(pushButtonDataSet6); 85: XtUnmanageChild(pushButtonDataSet7); 86: XtUnmanageChild(pushButtonDataSet8); 87: XtUnmanageChild(pushButtonDataSet9); 88: have_data = DONT; 89: have_affine = DONT; 90: have_tie = DONT; 91: last_tie = NONE; 92: have_tie1 = NO; 93: have_tie2 = NO; 94: have_shift = DONT; 95: have_corr = DONT; 96: have_splice = DONT; 97: have_core_to_splice = DONT; 98: have_splice_tie = DONT; 99: last_sp_tie = NONE; 100: have_sp_tie1 = NO; 101: have_sp_tie2 = NO; 102: have_strat = DONT; 103: have_splicetoage = DONT; 104: have_time_series = DONT; 105: have_splicetoage_tie = DONT; 106: have_timeseries_tie = DONT; 107: last_splicetoage_tie = NONE; 108: have_splicetoage_corr = DONT; 109: lastaffinehole = -1; 110: lastaffinecore = -1; 111: draw_offsets = NO; 112: are_compositing = NO; 113: did_affine = NO; 114: saved_affine = NO; 115: are_splicing = NO; 116: did_splicing = NO; 117: saved_splice = NO; 118: are_dragging = NO; 119: are_agemodelling = NO; 120: did_agemodel = NO; 121: saved_agemodel = NO; 122: agemodel_cnt = 0; 123: reason_for_redraw = DRAW_EVERYTHING; 124: last_scale_val_edit = 0; 125: last_scale_val_view = 0; 126: splicertable.data_cnt = 0; 127: agemodel_cnt = 0; 128: are_agemodelling = NO; 129: agemodelling_depth_type = MBSF; 130: write_report = NO; 131: open_dataform_is_up = NO; 132: MakeTheGCs(dpy); 133: SetInitialColors(dpy); 134: SetDisplayDefaults(); 135: ReadColorList(dpy); 136: XtSetSensitive(pushButtonDataBase, FALSE); 137: XtSetSensitive(cascadeButtonSave,FALSE); 138: XtSetSensitive(pushButtonSaveCull,FALSE); 139: XtSetSensitive(pushButtonSaveAffine,FALSE); 140: XtSetSensitive(pushButtonSaveSplicerTable,FALSE); 141: XtSetSensitive(pushButtonSaveStrat,FALSE); 142: XtSetSensitive(pushButtonSaveData,FALSE); 143: XtSetSensitive(pushButtonSaveSplicerData,FALSE); 144: XtSetSensitive(cascadeButtonClear,FALSE); 145: XtSetSensitive(pushButtonClearAll,FALSE); 146: XtSetSensitive(pushButtonClearComposite,FALSE); 147: XtSetSensitive(pushButtonClearSplice,FALSE); 148: XtSetSensitive(pushButtonClearStrat,FALSE); 149: XtSetSensitive(pushButtonComposite,FALSE); 150: XtSetSensitive(cascadeButtonSplice,FALSE); 151: XtSetSensitive(pushButtonDisplay,TRUE); 152: XtSetSensitive(pushButtonViewOffsets,FALSE); 153: XtSetSensitive(pushButtonViewAgeDepth,FALSE); 154: XtSetSensitive(cascadeButtonDataManip, False); 155: XmToggleButtonSetState(toggleButtonLockSlider, True, NULL); 156: XmToggleButtonSetState(toggleButtonAgeDepthmbsf, True, NULL); 157: XmToggleButtonSetState(toggleButtonPlotUnsmooth, True, NULL); 158: XmToggleButtonSetState(toggleButtonPlotSmooth, False, NULL); 159: XmToggleButtonSetState(toggleButtonPlotBoth, False, NULL); 160: XmToggleButtonSetState(toggleButtonOpenFormatsOther1, True, NULL); 161: XtSetSensitive(toggleButtonPlotSmooth,FALSE); 162: XtSetSensitive(toggleButtonPlotUnsmooth,FALSE); 163: XtSetSensitive(toggleButtonPlotBoth,FALSE); 164: XmToggleButtonSetState(toggleButtonHeaderNo, True, NULL); 165: XmToggleButtonSetState(toggleButtonHeaderYes, False, NULL); 166: 167: XtUnmanageChild(formFileSelectionTimeSeries); 168: XtUnmanageChild(optionMenuStratType1); 169: XtUnmanageChild(labelStratType1); 170: XtVaSetValues(XtParent(formFileSelection), XmNheight, 640, NULL); 171: 172: /* write to report 173: */ 174: XtManageChild(formTextReport); 175: if((string=(char*)calloc(1000, CHAR_SIZE))==NULL) 176: SpBadMemAlloc(""); 177: if(time(&tp)) { 178: (void)sprintf(string,"Start of Session. %s",ctime(&tp)); 179: } 180: else { 181: (void)sprintf(string, "Start of Session. No date available.\n"); 182: } 183: SpUpdateReport(string); 184: free(string); 185: XtPopdown(XtParent(formTextReport)); 186: } 187: 188: void SetMinMax(ds) 189: int ds; 190: { 191: int scalemax; 192: char string[50]; 193: 194: (void)sprintf(string, "%.2f", data[ds]->min); 195: XtVaSetValues(textVarMin, XmNvalue, string, NULL); 196: (void)sprintf(string, "%.2f", data[ds]->max); 197: XtVaSetValues(textVarMax, XmNvalue, string, NULL); 198: 199: scalemax = maxdep + (0.2 * maxdep); 200: XtVaSetValues(drawingAreaEditScale, XmNmaximum, scalemax, NULL); 201: XtVaSetValues(drawingAreaViewScale, XmNmaximum, scalemax, NULL); 202: 203: (void)sprintf(string, ""); 204: } 205: 206: void SetDisplayDefaults() 207: { 208: int scalemax; 209: char string[50]; 210: 211: depmeterdisplayed = DEPMETERDISPLAYED; 212: (void)sprintf(string, "%.3f", depmeterdisplayed); 213: XtVaSetValues(textDepthScale, XmNvalue, string, NULL); 214: 215: deptic = DEPTIC; 216: (void)sprintf(string, "%.1f", deptic); 217: XtVaSetValues(textDepthTic, XmNvalue, string, NULL); 218: 219: varaxislen = VAR_AXIS_LEN; 220: (void)sprintf(string, "%d", varaxislen); 221: XtVaSetValues(textVarAxisLen, XmNvalue, string, NULL); 222: 223: minvar = 0.0; 224: (void)sprintf(string, "%.2f", minvar); 225: XtVaSetValues(textVarMin, XmNvalue, string, NULL); 226: 227: maxvar = 0.0; 228: (void)sprintf(string, "%.2f", maxvar); 229: XtVaSetValues(textVarMax, XmNvalue, string, NULL); 230: 231: scale_mult = SCALE_MULT; 232: (void)sprintf(string, "%d", scale_mult); 233: XtVaSetValues(textScaleMult, XmNvalue, string, NULL); 234: 235: XtVaSetValues(drawingAreaEditScale, XmNscaleMultiple, scale_mult, NULL); 236: XtVaSetValues(drawingAreaViewScale, XmNscaleMultiple, scale_mult, NULL); 237: XmToggleButtonSetState(toggleButtonScaleDragYes, True, NULL); 238: XmToggleButtonSetState(toggleButtonScaleDragNo, False, NULL); 239: 240: maxdep = MAXDEP; 241: scalemax = maxdep; 242: XtVaSetValues(drawingAreaEditScale, XmNmaximum, scalemax, NULL); 243: XtVaSetValues(drawingAreaViewScale, XmNmaximum, scalemax, NULL); 244: 245: XmToggleButtonSetState(toggleButtonPlotUnsmooth, False, NULL); 246: XmToggleButtonSetState(toggleButtonPlotSmooth, False, NULL); 247: XmToggleButtonSetState(toggleButtonPlotBoth, False, NULL); 248: /* 249: if(smooth.method == NONE) { 250: } 251: else if(smooth.plot == UNSMOOTHED) { 252: } 253: else if(smooth.plot == SMOOTHED) { 254: XmToggleButtonSetState(toggleButtonPlotSmooth, True, NULL); 255: XmToggleButtonSetState(toggleButtonPlotUnsmooth, False, NULL); 256: } 257: else if(smooth.plot == SMOOTHEDBOTH) { 258: XmToggleButtonSetState(toggleButtonPlotBoth, True, NULL); 259: XmToggleButtonSetState(toggleButtonPlotUnsmooth, False, NULL); 260: } 261: */ 262: (void)sprintf(string, "%.2f", DEPTHCHANGE); 263: XtVaSetValues(textDepthChange, XmNvalue, string, NULL); 264: 265: (void)sprintf(string, ""); 266: } 267: 268: 269: int GetDisplayValues(ds) 270: int ds; 271: { 272: double check, fract, ip; 273: String str; 274: 275: str = XmTextGetString(textDepthScale); 276: depmeterdisplayed = atof(str); 277: XtFree(str); 278: 279: /* check that meters display is a whole number >= 1 280: */ 281: check = depmeterdisplayed; 282: fract = modf(check, &ip); 283: if(fract != 0.0){ 284: depmeterdisplayed = DEPMETERDISPLAYED; 285: (void)sprintf(buffer,"meters displayed must be a whole number."); 286: SpManageWarningBox(buffer); 287: return 1; 288: } 289: if(depmeterdisplayed < 1.0){ 290: depmeterdisplayed = DEPMETERDISPLAYED; 291: (void)sprintf(buffer,"meters displayed must be greater than or equal to 1.0."); 292: SpManageWarningBox(buffer); 293: return 1; 294: } 295: 296: str = XmTextGetString(textDepthTic); 297: deptic = atof(str); 298: XtFree(str); 299: 300: 301: /* check that the depth tic is a whole number and divides evenly into number 302: of meters displayed 303: */ 304: check = deptic; 305: fract = modf(check, &ip); 306: if(fract != 0.0){ 307: deptic = DEPTIC; 308: (void)sprintf(buffer,"the depth tic must be a whole number."); 309: SpManageWarningBox(buffer); 310: return 1; 311: } 312: check = depmeterdisplayed/deptic; 313: fract = modf(check, &ip); 314: if(fract != 0.0){ 315: deptic = DEPTIC; 316: (void)sprintf(buffer,"the depth tic interval must divide evenly into number of meters displyed"); 317: SpManageWarningBox(buffer); 318: return 1; 319: } 320: 321: str = XmTextGetString(textVarAxisLen); 322: varaxislen = atoi(str); 323: XtFree(str); 324: 325: /* check that the var axis length has some length 326: */ 327: if(varaxislen < 10){ 328: varaxislen = VAR_AXIS_LEN; 329: (void)sprintf(buffer,"the variable axis pixel length is unreasonably small."); 330: SpManageWarningBox(buffer); 331: return 1; 332: } 333: 334: str = XmTextGetString(textVarMin); 335: minvar = atof(str); 336: XtFree(str); 337: 338: str = XmTextGetString(textVarMax); 339: maxvar = atof(str); 340: XtFree(str); 341: 342: /* check that the max is greater than the min and the range is not 343: approaching zero 344: */ 345: if(maxvar < minvar){ 346: (void)sprintf(buffer,"the variable axis maximum is less than its minimum."); 347: SpManageWarningBox(buffer); 348: return 1; 349: } 350: if(have_data == DO){ 351: if(maxvar == minvar){ 352: (void)sprintf(buffer,"the variable axis minimum equals its maximum."); 353: SpManageWarningBox(buffer); 354: return 1; 355: } 356: if(fabs(maxvar - minvar) < 0.001){ 357: (void)sprintf(buffer,"the variable axis range is unreasonably small."); 358: SpManageWarningBox(buffer); 359: return 1; 360: } 361: } 362: 363: if(have_data == DO) { 364: data[ds]->min = minvar; 365: data[ds]->max = maxvar; 366: } 367: 368: /* check that the var axis length and var display range relative to 369: real var range is reasonable. just warn; 370: 371: if((varaxislen/(maxvar - minvar) * (realmaxvar - realminvar) - varaxislen) > 200) { 372: (void)sprintf(buffer,"the variable axis display range is much smaller than real range."); 373: SpManageWarningBox(buffer); 374: } 375: */ 376: 377: str = XmTextGetString(textScaleMult); 378: check = atof(str); 379: XtFree(str); 380: 381: /* check that slider scale is a whole number greater than or equal to one 382: */ 383: fract = modf(check, &ip); 384: if(fract != 0.0){ 385: (void)sprintf(buffer,"the scroll increment must be a whole number."); 386: SpManageWarningBox(buffer); 387: return 1; 388: } 389: scale_mult = check; 390: if(scale_mult < 1){ 391: (void)sprintf(buffer,"the scroll increment must be greater than or equal to 1.0."); 392: SpManageWarningBox(buffer); 393: return 1; 394: } 395: 396: XtVaSetValues(drawingAreaEditScale, XmNscaleMultiple, scale_mult, NULL); 397: XtVaSetValues(drawingAreaViewScale, XmNscaleMultiple, scale_mult, NULL); 398: 399: if(XmToggleButtonGetState(toggleButtonPlotUnsmooth) == True){ 400: smooth.plot = UNSMOOTHED; 401: } 402: else if(XmToggleButtonGetState(toggleButtonPlotSmooth) == True){ 403: smooth.plot = SMOOTHED; 404: } 405: else if(XmToggleButtonGetState(toggleButtonPlotBoth) == True){ 406: smooth.plot = SMOOTHEDBOTH; 407: } 408: 409: return 0; 410: } 411: 412: 413: void AxisDep(w, dpy, wid, gc, maxmeter, top_off, left, ticpixlen, depinc, unitinc, depscalepix, annot, label) 414: Widget w; 415: Display *dpy; 416: Window wid; 417: GC gc; 418: int top_off, left, ticpixlen, annot, label; 419: float unitinc, depscalepix, depinc, maxmeter; 420: { 421: int yoff, laboff, chk; 422: char s[50]; 423: Dimension win_height; 424: 425: /* get the height and width of the drawing area 426: */ 427: XtVaGetValues(w, XmNheight, &win_height, NULL); 428: 429: /* label the axis 430: */ 431: if(label > 0){ 432: if(label == MBSF) { 433: (void)sprintf(s,"mbsf"); 434: } 435: else if(label == MCD) { 436: (void)sprintf(s,"mcd"); 437: } 438: else { 439: (void)sprintf(s,"m"); 440: } 441: XDrawString(dpy, wid, gc, 8, OFF + 30, s, (int)strlen(s)); 442: } 443: 444: yoff = top_off; 445: /* draw the depth axis and tic it 446: */ 447: if(left > 0) { 448: XDrawLine(dpy, wid, gc, OFF, yoff, OFF, yoff + left); 449: yoff = yoff + left; 450: } 451: laboff=YAXIS_ANNOT_OFF; 452: if(unitinc >= 10.0 && unitinc < 100.0) { 453: laboff = YAXIS_ANNOT_OFF + 5; 454: } 455: else if(unitinc >= 100.0) { 456: laboff=YAXIS_ANNOT_OFF + 9; 457: } 458: XDrawLine(dpy, wid, gc, OFF, yoff, OFF-4, yoff); 459: (void)sprintf(s,"%.1f",unitinc); 460: XDrawString(dpy, wid, gc, OFF-laboff, yoff+2, s, (int)strlen(s)); 461: chk = 1; 462: 463: while(yoff+ticpixlen <= (int)win_height && unitinc < maxmeter){ 464: XDrawLine(dpy, wid, gc, OFF, yoff, OFF, yoff+ticpixlen); 465: yoff = yoff + ticpixlen; 466: XDrawLine(dpy, wid, gc, OFF, yoff, OFF-4, yoff); 467: unitinc = unitinc + depinc; 468: if(unitinc >= 10.0 && unitinc < 100.0) { 469: laboff = YAXIS_ANNOT_OFF + 5; 470: } 471: else if(unitinc >= 100.0) { 472: laboff=YAXIS_ANNOT_OFF + 9; 473: } 474: if(chk == annot){ 475: (void)sprintf(s,"%.1f",unitinc); 476: XDrawString(dpy, wid, gc, OFF-laboff, yoff, s, (int)strlen(s)); 477: chk = 1; 478: } 479: else { 480: ++chk; 481: } 482: } 483: if(yoff < (int)win_height && unitinc < maxmeter) { 484: XDrawLine(dpy, wid, gc, OFF, yoff, OFF, win_height); 485: } 486: 487: (void)sprintf(s, ""); 488: } 489: 490: void AxisVar() 491: { 492: } 493: 494: int XAxisDepthCorrSetup(lead, dt, len, tic, ntic, perpix, max) 495: int lead; 496: float dt; 497: int *len; 498: float *tic; 499: int *ntic; 500: float *perpix; 501: float *max; 502: { 503: double fract, check, ip; 504: 505: check = *len; 506: if(lead * dt <= 1){ 507: fract = modf((check/5.0), &ip); 508: if(fract == 0.0){ 509: } 510: else if(fract < 0.5){ 511: *len = ip * 5.0; 512: } 513: else { 514: *len = (ip * 5.0) + 5.0; 515: } 516: *tic=0.2; 517: *ntic=10; 518: *perpix=1.0/(*len); 519: *max=1.0; 520: } 521: else if(lead * dt <= 2){ 522: fract = modf((check/4.0), &ip); 523: if(fract == 0.0){ 524: } 525: else if(fract < 0.5){ 526: *len = ip * 4.0; 527: } 528: else { 529: *len = (ip * 4.0) + 4.0; 530: } 531: *tic=0.5; 532: *ntic=8; 533: *perpix=2.0/(*len); 534: *max=2.0; 535: } 536: else if(lead * dt <= 3){ 537: fract = modf((check/6.0), &ip); 538: if(fract == 0.0){ 539: } 540: else if(fract < 0.5){ 541: *len = ip * 6.0; 542: } 543: else { 544: *len = (ip * 6.0) + 6.0; 545: } 546: *tic=0.5; 547: *ntic=12; 548: *perpix=3.0/(*len); 549: *max=3.0; 550: } 551: else if(lead * dt <= 4){ 552: fract = modf((check/4.0), &ip); 553: if(fract == 0.0){ 554: } 555: else if(fract < 0.5){ 556: *len = ip * 4.0; 557: } 558: else { 559: *len = (ip * 4.0) + 4.0; 560: } 561: *tic=1.0; 562: *ntic=8; 563: *perpix=4.0/(*len); 564: *max=4.0; 565: } 566: else if(lead *dt <= 5){ 567: fract = modf((check/5.0), &ip); 568: if(fract == 0.0){ 569: } 570: else if(fract < 0.5){ 571: *len = ip * 5.0; 572: } 573: else { 574: *len = (ip * 5.0) + 5.0; 575: } 576: *tic=1.0; 577: *ntic=10; 578: *perpix=5.0/(*len); 579: *max=5.0; 580: } 581: else if(lead * dt <= 6){ 582: fract = modf((check/6.0), &ip); 583: if(fract == 0.0){ 584: } 585: else if(fract < 0.5){ 586: *len = ip * 6.0; 587: } 588: else { 589: *len = (ip * 6.0) + 6.0; 590: } 591: *tic=1.0; 592: *ntic=12; 593: *perpix=6.0/(*len); 594: *max=6.0; 595: } 596: else if(lead * dt <= 7){ 597: fract = modf((check/7.0), &ip); 598: if(fract == 0.0){ 599: } 600: else if(fract < 0.5){ 601: *len = ip * 7.0; 602: } 603: else { 604: *len = (ip * 7.0) + 7.0; 605: } 606: *tic=1.0; 607: *ntic=14; 608: *perpix=7.0/(*len); 609: *max=7.0; 610: } 611: else if(lead * dt <= 8){ 612: fract = modf((check/4.0), &ip); 613: if(fract == 0.0){ 614: } 615: else if(fract < 0.5){ 616: *len = ip * 4.0; 617: } 618: else { 619: *len = (ip * 4.0) + 4.0; 620: } 621: *tic=2.0; 622: *ntic=8; 623: *perpix=8.0/(*len); 624: *max=8.0; 625: } 626: else if(lead * dt <= 10){ 627: fract = modf((check/5.0), &ip); 628: if(fract == 0.0){ 629: } 630: else if(fract < 0.5){ 631: *len = ip * 5.0; 632: } 633: else { 634: *len = (ip * 5.0) + 5.0; 635: } 636: *tic=2.0; 637: *ntic=10; 638: *perpix=10.0/(*len); 639: *max=10.0; 640: } 641: else if(lead * dt <= 15){ 642: fract = modf((check/3.0), &ip); 643: if(fract == 0.0){ 644: } 645: else if(fract < 0.5){ 646: *len = ip * 3.0; 647: } 648: else { 649: *len = (ip * 3.0) + 3.0; 650: } 651: *tic=5.0; 652: *ntic=6; 653: *perpix=10.0/(*len); 654: *max=10.0; 655: } 656: else if(lead * dt <= 20){ 657: fract = modf((check/4.0), &ip); 658: if(fract == 0.0){ 659: } 660: else if(fract < 0.5){ 661: *len = ip * 4.0; 662: } 663: else { 664: *len = (ip * 4.0) + 4.0; 665: } 666: *tic=5.0; 667: *ntic=8; 668: *perpix=10.0/(*len); 669: *max=10.0; 670: } 671: else if(lead * dt <= 25){ 672: fract = modf((check/5.0), &ip); 673: if(fract == 0.0){ 674: } 675: else if(fract < 0.5){ 676: *len = ip * 5.0; 677: } 678: else { 679: *len = (ip * 5.0) + 5.0; 680: } 681: *tic=5.0; 682: *ntic=10; 683: *perpix=10.0/(*len); 684: *max=10.0; 685: } 686: else { 687: return 1; 688: } 689: 690: return 0; 691: } 692: 693: void AxisCorr(dpy, xid, gc, lagtic, nlagtic, maxlag, ylen, xlen, place) 694: Display *dpy; 695: Window xid; 696: GC gc; 697: int nlagtic, ylen, xlen, place; 698: float lagtic, maxlag; 699: { 700: int i, m, xoff, yoff, inc; 701: char s[50]; 702: float corr; 703: 704: /* draw and label the lead,lag axis and tic it 705: */ 706: XDrawString(dpy, xid, gc, SPACE, SPACE/2, "lag from tie", 12); 707: XDrawString(dpy, xid, gc, xlen + SPACE - 5, SPACE/2, "tie", 3); 708: XDrawString(dpy, xid, gc, (xlen * 2) + SPACE - 70, SPACE/2, "lead from tie", 13); 709: 710: m = SPACE; 711: yoff = (ylen/2) + SPACE; 712: XDrawLine(dpy, xid, gc, m, yoff, m + (xlen * 2), yoff); 713: if(place == 2) { 714: (void)sprintf(s,"%.2f",-1*maxlag); 715: } 716: else { 717: (void)sprintf(s,"%.1f",-1*maxlag); 718: } 719: XDrawString(dpy, xid, gc, m-5, yoff+15, s, (int)strlen(s)); 720: inc = (xlen * 2)/nlagtic; 721: for(i=0; i <= nlagtic; ++i){ 722: XDrawLine(dpy, xid, gc, m, yoff-3, m, yoff+3); 723: m = m + inc; 724: } 725: if(place == 2) { 726: (void)sprintf(s,"%.2f", maxlag); 727: } 728: else { 729: (void)sprintf(s,"%.1f", maxlag); 730: } 731: XDrawString(dpy, xid, gc, m-5-inc, yoff+15, s, (int)strlen(s)); 732: 733: /* draw and label the corr coef axis 734: */ 735: m = SPACE; 736: corr = 1.0; 737: xoff = SPACE + xlen; 738: XDrawLine(dpy, xid, gc, xoff, m, xoff, ylen + SPACE); 739: (void)sprintf(s,"%.1f",corr); 740: XDrawString(dpy, xid, gc, xoff+10, m+3, s, (int)strlen(s)); 741: inc = ylen/10; 742: for(i=0; i <= 10; ++i){ 743: XDrawLine(dpy, xid, gc, xoff-3, m, xoff+3, m); 744: m = m + inc; 745: } 746: (void)sprintf(s,"%.1f",-1*corr); 747: XDrawString(dpy, xid, gc, xoff+10, m+3-inc, s, (int)strlen(s)); 748: 749: (void)sprintf(s, ""); 750: } 751: 752: void AxisDepthOffset(w, dpy, wid, gc, maxmeter, top_off, left, ticpixlen, depinc, unitinc, depscalepix, annot) 753: Widget w; 754: Display *dpy; 755: Window wid; 756: GC gc; 757: int top_off, left, ticpixlen, annot; 758: float unitinc, depscalepix, depinc, maxmeter; 759: { 760: int xoff, laboff, inc, dinc; 761: char s[50]; 762: Dimension win_width; 763: 764: /* get the width of the drawing area 765: */ 766: XtVaGetValues(w, XmNwidth, &win_width, NULL); 767: 768: /*label the axis 769: */ 770: (void)sprintf(s,"Depth offset (m)"); 771: XDrawString(dpy, wid, gc, OFF + 20, 20, s, (int)strlen(s)); 772: 773: inc = unitinc + .1; 774: dinc = depinc + .1; 775: 776: /* draw the depth offset axis(x axis) and tic it 777: */ 778: xoff = OFF; 779: laboff= 0; 780: XDrawLine(dpy, wid, gc, xoff, OFF, xoff, OFF - 4); 781: (void)sprintf(s,"%d",inc); 782: XDrawString(dpy, wid, gc, xoff - laboff, OFF - 10, "0", 1); 783: 784: while(xoff + ticpixlen <= (int)win_width && unitinc < maxmeter){ 785: XDrawLine(dpy, wid, gc, xoff, OFF, xoff + ticpixlen, OFF); 786: xoff = xoff + ticpixlen; 787: XDrawLine(dpy, wid, gc, xoff, OFF, xoff, OFF - 4); 788: inc = inc + dinc; 789: if(inc >= 10 && inc < 100){ 790: laboff = 3; 791: } 792: else if(unitinc >= 100.0) { 793: laboff= 5; 794: } 795: (void)sprintf(s,"%d",inc); 796: XDrawString(dpy, wid, gc, xoff - laboff, OFF - 10, s, (int)strlen(s)); 797: } 798: 799: (void)sprintf(s, ""); 800: } 801: 802: void AxisAge(w, dpy, wid, gc, maxage, top_off, left, ticpixlen, ageinc, unitinc, ageperpix, annot) 803: Widget w; 804: Display *dpy; 805: Window wid; 806: GC gc; 807: int top_off, ticpixlen, annot, left; 808: float unitinc, ageperpix, ageinc, maxage; 809: { 810: int xoff, laboff, inc, dinc, max; 811: char s[50]; 812: Dimension win_width; 813: 814: /* get the width of the drawing area 815: */ 816: XtVaGetValues(w, XmNwidth, &win_width, NULL); 817: 818: /*label the axis 819: */ 820: (void)sprintf(s,"Age(Ma)"); 821: XDrawString(dpy, wid, gc, OFF + 20, 20, s, (int)strlen(s)); 822: 823: inc = unitinc + .1; 824: dinc = ageinc + .1; 825: max = maxage + .1; 826: 827: xoff = top_off; 828: 829: /* if axis does not start at first tic draw up to first tic 830: */ 831: if(left > 0) { 832: XDrawLine(dpy, wid, gc, xoff, top_off_agedepth_depth, xoff + left, top_off_agedepth_depth); 833: xoff = xoff + left; 834: } 835: 836: /* draw and label the first tic 837: */ 838: laboff= 0; 839: XDrawLine(dpy, wid, gc, xoff, OFF, xoff, OFF - 4); 840: (void)sprintf(s,"%d",inc); 841: XDrawString(dpy, wid, gc, xoff - laboff, top_off_agedepth_depth - 10, s, (int)strlen(s)); 842: 843: while(inc < max){ 844: XDrawLine(dpy, wid, gc, xoff, top_off_agedepth_depth, xoff + ticpixlen, top_off_agedepth_depth); 845: xoff = xoff + ticpixlen; 846: XDrawLine(dpy, wid, gc, xoff, top_off_agedepth_depth, xoff, top_off_agedepth_depth - 4); 847: inc = inc + dinc; 848: if(inc >= 10 && inc < 100){ 849: laboff = 3; 850: } 851: else if(inc >= 100.0) { 852: laboff= 5; 853: } 854: (void)sprintf(s,"%d",inc); 855: XDrawString(dpy, wid, gc, xoff - laboff, top_off_agedepth_depth - 10, s, (int)strlen(s)); 856: } 857: if(xoff < (int)win_width - top_off - SPACE - OFF && inc < max) { 858: ticpixlen = (int)win_width - top_off - SPACE - xoff; 859: XDrawLine(dpy, wid, gc, xoff, top_off_agedepth_depth, xoff + ticpixlen, top_off_agedepth_depth); 860: xoff = xoff + ticpixlen; 861: XDrawLine(dpy, wid, gc, xoff, top_off_agedepth_depth, xoff, top_off_agedepth_depth - 4); 862: laboff = 25; 863: unitinc = inc + (ticpixlen * ageperpix); 864: (void)sprintf(s,"%8.4f",unitinc); 865: XDrawString(dpy, wid, gc, xoff - laboff, top_off_agedepth_depth - 10, s, (int)strlen(s)); 866: } 867: 868: (void)sprintf(s, ""); 869: } 870: 871: AxisSpliceAge(w, dpy, wid, gc, maxmeter, top_off, left, ticpixlen, depinc, unitinc, depscalepix, annot, label) 872: Widget w; 873: Display *dpy; 874: Window wid; 875: GC gc; 876: int top_off, left, ticpixlen, annot, label; 877: float unitinc, depscalepix, depinc, maxmeter; 878: { 879: int yoff, laboff, chk; 880: char s[50]; 881: Dimension win_height; 882: 883: /* get the height and width of the drawing area 884: */ 885: XtVaGetValues(w, XmNheight, &win_height, NULL); 886: 887: if(label > 0){ 888: (void)sprintf(s,"Ma"); 889: XDrawString(dpy, wid, gc, 8, OFF + 30, s, (int)strlen(s)); 890: } 891: 892: yoff = top_off; 893: /* draw the depth axis and tic it 894: */ 895: if(left > 0) { 896: XDrawLine(dpy, wid, gc, OFF, yoff, OFF, yoff + left); 897: yoff = yoff + left; 898: } 899: laboff=YAXIS_ANNOT_OFF + 10; 900: if(unitinc >= 10.0) { 901: laboff = YAXIS_ANNOT_OFF + 15; 902: } 903: XDrawLine(dpy, wid, gc, OFF, yoff, OFF-4, yoff); 904: (void)sprintf(s,"%.3f",unitinc); 905: XDrawString(dpy, wid, gc, OFF-laboff, yoff+2, s, (int)strlen(s)); 906: chk = 1; 907: 908: while(yoff+ticpixlen <= (int)win_height && unitinc < maxmeter){ 909: XDrawLine(dpy, wid, gc, OFF, yoff, OFF, yoff+ticpixlen); 910: yoff = yoff + ticpixlen; 911: XDrawLine(dpy, wid, gc, OFF, yoff, OFF-4, yoff); 912: unitinc = unitinc + depinc; 913: if(unitinc >= 10.0 && unitinc < 100.0) { 914: laboff = YAXIS_ANNOT_OFF + 5; 915: } 916: else if(unitinc >= 100.0) { 917: laboff=YAXIS_ANNOT_OFF + 9; 918: } 919: if(chk == annot){ 920: (void)sprintf(s,"%.3f",unitinc); 921: XDrawString(dpy, wid, gc, OFF-laboff, yoff, s, (int)strlen(s)); 922: chk = 1; 923: } 924: else { 925: ++chk; 926: } 927: } 928: if(yoff < (int)win_height && unitinc < maxmeter) { 929: XDrawLine(dpy, wid, gc, OFF, yoff, OFF, win_height); 930: } 931: 932: (void)sprintf(s, ""); 933: } 934: 935: void MakeTheGCs(display) 936: Display *display; 937: { 938: int screen_num; 939: XFontStruct *font; 940: 941: /* create the GC's for the drawing windows 942: */ 943: screen_num = DefaultScreen(display); 944: gc_drawingAreaEdit = XCreateGC(display, 945: RootWindow(display, screen_num), 946: NULL, NULL); 947: gc_drawingAreaView = XCreateGC(display, 948: RootWindow(display, screen_num), 949: NULL, NULL); 950: gc_drawingAreaTieCorrelation = XCreateGC(display, 951: RootWindow(display, screen_num), 952: NULL, NULL); 953: gc_drawingAreaSpliceCorrelation = XCreateGC(display, 954: RootWindow(display, screen_num), 955: NULL, NULL); 956: gc_drawingAreaAgeDepth = XCreateGC(display, 957: RootWindow(display, screen_num), 958: NULL, NULL); 959: gc_drawingAreaDepthOffset = XCreateGC(display, 960: RootWindow(display, screen_num), 961: NULL, NULL); 962: gc_drawingAreaSpliceToAge = XCreateGC(display, 963: RootWindow(display, screen_num), 964: NULL, NULL); 965: gc_drawingAreaTieToTimeSeriesCorr = XCreateGC(display, 966: RootWindow(display, screen_num), 967: NULL, NULL); 968: 969: /* and set their fonts 970: */ 971: if(!(font = XLoadQueryFont(display, "-*-helvetica-*-r-*--12-*"))) { 972: (void)sprintf(buffer, "Query for composite and splice drawing area fonts failed."); 973: SpManageWarningBox(buffer); 974: } 975: else { 976: XSetFont(display, gc_drawingAreaEdit, font->fid); 977: XSetFont(display, gc_drawingAreaView, font->fid); 978: } 979: if(!(font = XLoadQueryFont(display, "-*-helvetica-*-r-*--10-*"))) { 980: (void)sprintf(buffer, "Query for correlation and depth offset drawing area fonts failed."); 981: SpManageWarningBox(buffer); 982: } 983: else { 984: XSetFont(display, gc_drawingAreaTieCorrelation, font->fid); 985: XSetFont(display, gc_drawingAreaSpliceCorrelation, font->fid); 986: XSetFont(display, gc_drawingAreaDepthOffset, font->fid); 987: XSetFont(display, gc_drawingAreaAgeDepth, font->fid); 988: XSetFont(display, gc_drawingAreaSpliceToAge, font->fid); 989: XSetFont(display, gc_drawingAreaTieToTimeSeriesCorr, font->fid); 990: } 991: if(!(font = XLoadQueryFont(display, "-*-helvetica-*-r-*--8-*"))) { 992: } 993: else { 994: } 995: } 996: 997: void SetInitialColors(dpy) 998: Display *dpy; 999: { 1000: XmString xmstring; 1001: XColor return_color, unused; 1002: Pixel pixwhite, pixblack; 1003: int GetColorSet(); 1004: 1005: cmap = DefaultColormapOfScreen(XtScreen(drawingAreaEdit)); 1006: 1007: /* get black and white pixel values for backup incase have a 1008: failed named color allocation 1009: */ 1010: pixblack = BlackPixelOfScreen(XtScreen(drawingAreaEdit)); 1011: pixwhite = WhitePixelOfScreen(XtScreen(drawingAreaEdit)); 1012: 1013: /* get the colorset to use 1014: */ 1015: GetColorSet(); 1016: 1017: /* set the background color for the four drawing areas 1018: */ 1019: if(!XAllocNamedColor(dpy, cmap, color[BG_COLOR], &return_color, &unused)) { 1020: (void)sprintf(buffer, "can not allocate named color. %s", color[BG_COLOR]); 1021: SpManageWarningBox(buffer); 1022: bgPixel = pixblack; 1023: xmstring = XmStringCreateSimple("black"); 1024: XtVaSetValues(pushButtonDrawingAreaColorBG, XmNlabelString, xmstring, NULL); 1025: XmStringFree(xmstring); 1026: } 1027: else { 1028: bgPixel = return_color.pixel; 1029: xmstring = XmStringCreateSimple(color[BG_COLOR]); 1030: XtVaSetValues(pushButtonDrawingAreaColorBG, XmNlabelString, xmstring, NULL); 1031: XmStringFree(xmstring); 1032: } 1033: XtVaSetValues(pushButtonDrawingAreaColorBG, XmNbackground, bgPixel, NULL); 1034: XtVaSetValues(drawingAreaEdit, XmNbackground, bgPixel, NULL); 1035: XtVaSetValues(drawingAreaView, XmNbackground, bgPixel, NULL); 1036: XtVaSetValues(drawingAreaTieCorrelation, XmNbackground, bgPixel, NULL); 1037: XtVaSetValues(drawingAreaCompCorrelation, XmNbackground, bgPixel, NULL); 1038: XtVaSetValues(drawingAreaDepthOffset, XmNbackground, bgPixel, NULL); 1039: XtVaSetValues(drawingAreaAgeDepth, XmNbackground, bgPixel, NULL); 1040: XtVaSetValues(drawingAreaSpliceToAge, XmNbackground, bgPixel, NULL); 1041: XtVaSetValues(drawingAreaTieToTimeSeriesCorr, XmNbackground, bgPixel, NULL); 1042: 1043: /* set the border color of labels for cursor location and ties to 1044: the drawing areas background color 1045: */ 1046: XtVaSetValues(labelCursorLocation, XmNborderColor, bgPixel, NULL); 1047: XtVaSetValues(labelDepthOffsetCursorLocation, XmNborderColor, bgPixel, NULL); 1048: XtVaSetValues(labelSpliceCursorLocation, XmNborderColor, bgPixel, NULL); 1049: XtVaSetValues(labelAgeDepthCursorLocation, XmNborderColor, bgPixel, NULL); 1050: XtVaSetValues(labelSpliceToAgeCursorLocation, XmNborderColor, bgPixel, NULL); 1051: XtVaSetValues(labelTie1ID, XmNborderColor, bgPixel, NULL); 1052: XtVaSetValues(labelTie2ID, XmNborderColor, bgPixel, NULL); 1053: XtVaSetValues(labelTie1var, XmNborderColor, bgPixel, NULL); 1054: XtVaSetValues(labelTie2var, XmNborderColor, bgPixel, NULL); 1055: XtVaSetValues(labelTie1sbd, XmNborderColor, bgPixel, NULL); 1056: XtVaSetValues(labelTie2sbd, XmNborderColor, bgPixel, NULL); 1057: XtVaSetValues(labelSpliceTie1ID, XmNborderColor, bgPixel, NULL); 1058: XtVaSetValues(labelSpliceTie2ID, XmNborderColor, bgPixel, NULL); 1059: XtVaSetValues(labelSpliceTie1var, XmNborderColor, bgPixel, NULL); 1060: XtVaSetValues(labelSpliceTie2var, XmNborderColor, bgPixel, NULL); 1061: XtVaSetValues(labelSpliceTie1sbd, XmNborderColor, bgPixel, NULL); 1062: XtVaSetValues(labelSpliceTie2sbd, XmNborderColor, bgPixel, NULL); 1063: XtVaSetValues(labelSpliceDifferenceInValue, XmNborderColor, bgPixel, NULL); 1064: 1065: 1066: /* set the row-column and label background color to drawing area color 1067: */ 1068: XtVaSetValues(rowColumnColorCompositeAndSplice, XmNbackground, bgPixel, NULL); 1069: XtVaSetValues(rowColumnColorCorrelation, XmNbackground, bgPixel, NULL); 1070: XtVaSetValues(rowColumnColorDepthOffset, XmNbackground, bgPixel, NULL); 1071: XtVaSetValues(rowColumnColorDrawingAreas, XmNbackground, bgPixel, NULL); 1072: XtVaSetValues(rowColumnColorAgeDepth, XmNbackground, bgPixel, NULL); 1073: XtVaSetValues(rowColumnColorSpliceToAge, XmNbackground, bgPixel, NULL); 1074: 1075: XtVaSetValues(labelDrawingAreaColorBG, XmNbackground, bgPixel, NULL); 1076: XtVaSetValues(labelDrawingAreaColorLabels, XmNbackground, bgPixel, NULL); 1077: XtVaSetValues(labelColorCoreRelated, XmNbackground, bgPixel, NULL); 1078: XtVaSetValues(labelColorCorembsf, XmNbackground, bgPixel, NULL); 1079: XtVaSetValues(labelColorCoremcd, XmNbackground, bgPixel, NULL); 1080: XtVaSetValues(labelColorSmooth, XmNbackground, bgPixel, NULL); 1081: XtVaSetValues(labelColorSplice, XmNbackground, bgPixel, NULL); 1082: XtVaSetValues(labelColorSpliceLocation, XmNbackground, bgPixel, NULL); 1083: XtVaSetValues(labelColorTieRelated, XmNbackground, bgPixel, NULL); 1084: XtVaSetValues(labelColorTiePtFixed, XmNbackground, bgPixel, NULL); 1085: XtVaSetValues(labelColorTiePtShift, XmNbackground, bgPixel, NULL); 1086: XtVaSetValues(labelColorTieLine, XmNbackground, bgPixel, NULL); 1087: XtVaSetValues(labelColorOverlayInCorr, XmNbackground, bgPixel, NULL); 1088: XtVaSetValues(labelColorOverlayOutCorr, XmNbackground, bgPixel, NULL); 1089: XtVaSetValues(labelColorStrat, XmNbackground, bgPixel, NULL); 1090: XtVaSetValues(labelColorPaleomag, XmNbackground, bgPixel, NULL); 1091: XtVaSetValues(labelColorDiatom, XmNbackground, bgPixel, NULL); 1092: XtVaSetValues(labelColorRad, XmNbackground, bgPixel, NULL); 1093: XtVaSetValues(labelColorForam, XmNbackground, bgPixel, NULL); 1094: XtVaSetValues(labelColorNanno, XmNbackground, bgPixel, NULL); 1095: XtVaSetValues(labelColorCorrCoef, XmNbackground, bgPixel, NULL); 1096: XtVaSetValues(labelColorBestCorr, XmNbackground, bgPixel, NULL); 1097: XtVaSetValues(labelColorDepthOffsetLine, XmNbackground, bgPixel, NULL); 1098: XtVaSetValues(labelColorDepthOffsetHole1, XmNbackground, bgPixel, NULL); 1099: XtVaSetValues(labelColorDepthOffsetHole2, XmNbackground, bgPixel, NULL); 1100: XtVaSetValues(labelColorDepthOffsetHole3, XmNbackground, bgPixel, NULL); 1101: XtVaSetValues(labelColorDepthOffsetHole4, XmNbackground, bgPixel, NULL); 1102: XtVaSetValues(labelColorDepthOffsetHole5, XmNbackground, bgPixel, NULL); 1103: XtVaSetValues(labelColorDepthOffsetHole6, XmNbackground, bgPixel, NULL); 1104: XtVaSetValues(labelColorDepthOffsetHole7, XmNbackground, bgPixel, NULL); 1105: XtVaSetValues(labelColorDepthOffsetHole8, XmNbackground, bgPixel, NULL); 1106: XtVaSetValues(labelColorDepthOffsetHole9, XmNbackground, bgPixel, NULL); 1107: XtVaSetValues(labelColorDepthOffsetHole10, XmNbackground, bgPixel, NULL); 1108: XtVaSetValues(labelColorDepthOffsetHole11, XmNbackground, bgPixel, NULL); 1109: XtVaSetValues(labelColorAgeDepthHandPick, XmNbackground, bgPixel, NULL); 1110: XtVaSetValues(labelColorAgeDepthLine, XmNbackground, bgPixel, NULL); 1111: XtVaSetValues(labelColorSedRate, XmNbackground, bgPixel, NULL); 1112: XtVaSetValues(labelColorTimeSeries, XmNbackground, bgPixel, NULL); 1113: XtVaSetValues(labelColorDatumLocation, XmNbackground, bgPixel, NULL); 1114: 1115: /* if no foreground and or background color were read on command line args 1116: set the colors for hsplicer foreground and background to the drawing 1117: args background and labels 1118: */ 1119: if(prgfg == NO || prgbg == NO) { 1120: (void)sprintf(prgfgcolor, ""); 1121: (void)sprintf(prgfgcolor, color[LABEL_COLOR]); 1122: (void)sprintf(prgbgcolor, ""); 1123: (void)sprintf(prgbgcolor, color[BG_COLOR]); 1124: } 1125: 1126: /* set all the foreground colors 1127: */ 1128: 1129: /* the labels for all four drawing areas 1130: */ 1131: if(!XAllocNamedColor(dpy, cmap, color[LABEL_COLOR], &return_color, &unused)) { 1132: (void)sprintf(buffer, "can not allocate named color. %s", color[LABEL_COLOR]); 1133: SpManageWarningBox(buffer); 1134: fgPixel[LABEL_COLOR] = pixwhite; 1135: xmstring = XmStringCreateSimple("white"); 1136: XtVaSetValues(pushButtonDrawingAreaColorLabels, XmNlabelString, xmstring, NULL); 1137: XmStringFree(xmstring); 1138: } 1139: else { 1140: fgPixel[LABEL_COLOR] = return_color.pixel; 1141: xmstring = XmStringCreateSimple(color[LABEL_COLOR]); 1142: XtVaSetValues(pushButtonDrawingAreaColorLabels, XmNlabelString, xmstring, NULL); 1143: XmStringFree(xmstring); 1144: } 1145: XtVaSetValues(pushButtonDrawingAreaColorLabels, XmNbackground, fgPixel[LABEL_COLOR], NULL); 1146: 1147: /* set the row-column label foreground colors to the label color 1148: */ 1149: XtVaSetValues(labelDrawingAreaColorBG, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1150: XtVaSetValues(labelDrawingAreaColorLabels, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1151: XtVaSetValues(labelColorCoreRelated, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1152: XtVaSetValues(labelColorCorembsf, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1153: XtVaSetValues(labelColorCoremcd, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1154: XtVaSetValues(labelColorSmooth, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1155: XtVaSetValues(labelColorSplice, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1156: XtVaSetValues(labelColorSpliceLocation, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1157: XtVaSetValues(labelColorTieRelated, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1158: XtVaSetValues(labelColorTiePtFixed, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1159: XtVaSetValues(labelColorTiePtShift, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1160: XtVaSetValues(labelColorTieLine, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1161: XtVaSetValues(labelColorOverlayInCorr, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1162: XtVaSetValues(labelColorOverlayOutCorr, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1163: XtVaSetValues(labelColorStrat, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1164: XtVaSetValues(labelColorPaleomag, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1165: XtVaSetValues(labelColorDiatom, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1166: XtVaSetValues(labelColorRad, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1167: XtVaSetValues(labelColorForam, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1168: XtVaSetValues(labelColorNanno, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1169: XtVaSetValues(labelColorCorrCoef, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1170: XtVaSetValues(labelColorBestCorr, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1171: XtVaSetValues(labelColorDepthOffsetLine, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1172: XtVaSetValues(labelColorDepthOffsetHole1, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1173: XtVaSetValues(labelColorDepthOffsetHole2, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1174: XtVaSetValues(labelColorDepthOffsetHole3, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1175: XtVaSetValues(labelColorDepthOffsetHole4, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1176: XtVaSetValues(labelColorDepthOffsetHole5, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1177: XtVaSetValues(labelColorDepthOffsetHole6, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1178: XtVaSetValues(labelColorDepthOffsetHole7, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1179: XtVaSetValues(labelColorDepthOffsetHole8, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1180: XtVaSetValues(labelColorDepthOffsetHole9, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1181: XtVaSetValues(labelColorDepthOffsetHole10, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1182: XtVaSetValues(labelColorDepthOffsetHole11, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1183: XtVaSetValues(labelColorAgeDepthHandPick, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1184: XtVaSetValues(labelColorAgeDepthLine, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1185: XtVaSetValues(labelColorSedRate, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1186: XtVaSetValues(labelColorTimeSeries, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1187: XtVaSetValues(labelColorDatumLocation, XmNforeground, fgPixel[LABEL_COLOR], NULL); 1188: 1189: /* the original unadjusted ODP sb depth 1190: */ 1191: if(!XAllocNamedColor(dpy, cmap, color[MBSF_COLOR], &return_color, &unused)) { 1192: (void)sprintf(buffer, "can not allocate named color. %s", color[MBSF_COLOR]); 1193: SpManageWarningBox(buffer); 1194: fgPixel[MBSF_COLOR] = pixwhite; 1195: xmstring = XmStringCreateSimple("white"); 1196: XtVaSetValues(pushButtonColorCorembsf, XmNlabelString, xmstring, NULL); 1197: XmStringFree(xmstring); 1198: } 1199: else { 1200: fgPixel[MBSF_COLOR] = return_color.pixel; 1201: xmstring = XmStringCreateSimple(color[MBSF_COLOR]); 1202: XtVaSetValues(pushButtonColorCorembsf, XmNlabelString, xmstring, NULL); 1203: XmStringFree(xmstring); 1204: } 1205: XtVaSetValues(pushButtonColorCorembsf, XmNbackground, fgPixel[MBSF_COLOR], NULL); 1206: 1207: /* the smoothed data 1208: */ 1209: if(!XAllocNamedColor(dpy, cmap, color[SMOOTH_COLOR], &return_color, &unused)) { 1210: (void)sprintf(buffer, "can not allocate named color. %s", color[SMOOTH_COLOR]); 1211: SpManageWarningBox(buffer); 1212: fgPixel[SMOOTH_COLOR] = pixwhite; 1213: xmstring = XmStringCreateSimple("white"); 1214: XtVaSetValues(pushButtonColorSmooth, XmNlabelString, xmstring, NULL); 1215: XmStringFree(xmstring); 1216: } 1217: else { 1218: fgPixel[SMOOTH_COLOR] = return_color.pixel; 1219: xmstring = XmStringCreateSimple(color[SMOOTH_COLOR]); 1220: XtVaSetValues(pushButtonColorSmooth, XmNlabelString, xmstring, NULL); 1221: XmStringFree(xmstring); 1222: } 1223: XtVaSetValues(pushButtonColorSmooth, XmNbackground, fgPixel[SMOOTH_COLOR], NULL); 1224: 1225: /* composite and splice tie lines 1226: */ 1227: if(!XAllocNamedColor(dpy, cmap, color[TIELINE_COLOR], &return_color, &unused)) { 1228: (void)sprintf(buffer, "can not allocate named color. %s", color[TIELINE_COLOR]); 1229: SpManageWarningBox(buffer); 1230: fgPixel[TIELINE_COLOR] = pixwhite; 1231: xmstring = XmStringCreateSimple("white"); 1232: XtVaSetValues(pushButtonColorTieLine, XmNlabelString, xmstring, NULL); 1233: XmStringFree(xmstring); 1234: } 1235: else { 1236: fgPixel[TIELINE_COLOR] = return_color.pixel; 1237: xmstring = XmStringCreateSimple(color[TIELINE_COLOR]); 1238: XtVaSetValues(pushButtonColorTieLine, XmNlabelString, xmstring, NULL); 1239: XmStringFree(xmstring); 1240: } 1241: XtVaSetValues(pushButtonColorTieLine, XmNbackground, fgPixel[TIELINE_COLOR], NULL); 1242: 1243: /* the middle button tie point 1 (fixed; it stays put) 1244: let this convention hold for splice as well 1245: */ 1246: if(!XAllocNamedColor(dpy, cmap, color[TIEPTFIXED_COLOR], &return_color, &unused)) { 1247: (void)sprintf(buffer, "can not allocate named color. %s", color[TIEPTFIXED_COLOR]); 1248: SpManageWarningBox(buffer); 1249: fgPixel[TIEPTFIXED_COLOR] = pixwhite; 1250: xmstring = XmStringCreateSimple("white"); 1251: XtVaSetValues(pushButtonColorTiePtFixed, XmNlabelString, xmstring, NULL); 1252: XmStringFree(xmstring); 1253: } 1254: else { 1255: fgPixel[TIEPTFIXED_COLOR] = return_color.pixel; 1256: xmstring = XmStringCreateSimple(color[TIEPTFIXED_COLOR]); 1257: XtVaSetValues(pushButtonColorTiePtFixed, XmNlabelString, xmstring, NULL); 1258: XmStringFree(xmstring); 1259: } 1260: XtVaSetValues(pushButtonColorTiePtFixed, XmNbackground, fgPixel[TIEPTFIXED_COLOR], NULL); 1261: 1262: /* the right button tie point 2 (shift; it moves) 1263: let this convention hold for splice as well 1264: */ 1265: if(!XAllocNamedColor(dpy, cmap, color[TIEPTSHIFT_COLOR], &return_color, &unused)) { 1266: (void)sprintf(buffer, "can not allocate named color. %s", color[TIEPTSHIFT_COLOR]); 1267: SpManageWarningBox(buffer); 1268: fgPixel[TIEPTSHIFT_COLOR] = pixwhite; 1269: xmstring = XmStringCreateSimple("white"); 1270: XtVaSetValues(pushButtonColorTiePtShift, XmNlabelString, xmstring, NULL); 1271: XmStringFree(xmstring); 1272: } 1273: else { 1274: fgPixel[TIEPTSHIFT_COLOR] = return_color.pixel; 1275: xmstring = XmStringCreateSimple(color[TIEPTSHIFT_COLOR]); 1276: XtVaSetValues(pushButtonColorTiePtShift, XmNlabelString, xmstring, NULL); 1277: XmStringFree(xmstring); 1278: } 1279: XtVaSetValues(pushButtonColorTiePtShift, XmNbackground, fgPixel[TIEPTSHIFT_COLOR], NULL); 1280: 1281: /* the composite and splice core overlays 1282: */ 1283: /* part of core used in correlation 1284: */ 1285: if(!XAllocNamedColor(dpy, cmap, color[OVERLAYINCORR_COLOR], &return_color, &unused)) { 1286: (void)sprintf(buffer, "can not allocate named color. %s", color[OVERLAYINCORR_COLOR]); 1287: SpManageWarningBox(buffer); 1288: fgPixel[OVERLAYINCORR_COLOR] = pixwhite; 1289: xmstring = XmStringCreateSimple("white"); 1290: XtVaSetValues(pushButtonColorOverlayInCorr, XmNlabelString, xmstring, NULL); 1291: XmStringFree(xmstring); 1292: } 1293: else { 1294: fgPixel[OVERLAYINCORR_COLOR] = return_color.pixel; 1295: xmstring = XmStringCreateSimple(color[OVERLAYINCORR_COLOR]); 1296: XtVaSetValues(pushButtonColorOverlayInCorr, XmNlabelString, xmstring, NULL); 1297: XmStringFree(xmstring); 1298: } 1299: XtVaSetValues(pushButtonColorOverlayInCorr, XmNbackground, fgPixel[OVERLAYINCORR_COLOR], NULL); 1300: /* part of core not used in correlation 1301: */ 1302: if(!XAllocNamedColor(dpy, cmap, color[OVERLAYOUTCORR_COLOR], &return_color, &unused)) { 1303: (void)sprintf(buffer, "can not allocate named color. %s", color[OVERLAYOUTCORR_COLOR]); 1304: SpManageWarningBox(buffer); 1305: fgPixel[OVERLAYOUTCORR_COLOR] = pixwhite; 1306: xmstring = XmStringCreateSimple("white"); 1307: XtVaSetValues(pushButtonColorOverlayOutCorr, XmNlabelString, xmstring, NULL); 1308: XmStringFree(xmstring); 1309: } 1310: else { 1311: fgPixel[OVERLAYOUTCORR_COLOR] = return_color.pixel; 1312: xmstring = XmStringCreateSimple(color[OVERLAYOUTCORR_COLOR]); 1313: XtVaSetValues(pushButtonColorOverlayOutCorr, XmNlabelString, xmstring, NULL); 1314: XmStringFree(xmstring); 1315: } 1316: XtVaSetValues(pushButtonColorOverlayOutCorr, XmNbackground, fgPixel[OVERLAYOUTCORR_COLOR], NULL); 1317: 1318: /* the depth adjusted(shifted) core 1319: */ 1320: if(!XAllocNamedColor(dpy, cmap, color[MCD_COLOR], &return_color, &unused)) { 1321: (void)sprintf(buffer, "can not allocate named color. %s", color[MCD_COLOR]); 1322: SpManageWarningBox(buffer); 1323: fgPixel[MCD_COLOR] = pixwhite; 1324: xmstring = XmStringCreateSimple("white"); 1325: XtVaSetValues(pushButtonColorCoremcd, XmNlabelString, xmstring, NULL); 1326: XmStringFree(xmstring); 1327: } 1328: else { 1329: fgPixel[MCD_COLOR] = return_color.pixel; 1330: xmstring = XmStringCreateSimple(color[MCD_COLOR]); 1331: XtVaSetValues(pushButtonColorCoremcd, XmNlabelString, xmstring, NULL); 1332: XmStringFree(xmstring); 1333: } 1334: XtVaSetValues(pushButtonColorCoremcd, XmNbackground, fgPixel[MCD_COLOR], NULL); 1335: 1336: 1337: /* the splice composite 1338: */ 1339: if(!XAllocNamedColor(dpy, cmap, color[SPLICE_COLOR], &return_color, &unused)) { 1340: (void)sprintf(buffer, "can not allocate named color. %s", color[SPLICE_COLOR]); 1341: SpManageWarningBox(buffer); 1342: fgPixel[SPLICE_COLOR] = pixwhite; 1343: xmstring = XmStringCreateSimple("white"); 1344: XtVaSetValues(pushButtonColorSplice, XmNlabelString, xmstring, NULL); 1345: XmStringFree(xmstring); 1346: } 1347: else { 1348: fgPixel[SPLICE_COLOR] = return_color.pixel; 1349: xmstring = XmStringCreateSimple(color[SPLICE_COLOR]); 1350: XtVaSetValues(pushButtonColorSplice, XmNlabelString, xmstring, NULL); 1351: XmStringFree(xmstring); 1352: } 1353: XtVaSetValues(pushButtonColorSplice, XmNbackground, fgPixel[SPLICE_COLOR], NULL); 1354: 1355: /* the lines between spliced cores 1356: */ 1357: if(!XAllocNamedColor(dpy, cmap, color[SPLICELOCATION_COLOR], &return_color, &unused)) { 1358: (void)sprintf(buffer, "can not allocate named color. %s", color[SPLICELOCATION_COLOR]); 1359: SpManageWarningBox(buffer); 1360: fgPixel[SPLICELOCATION_COLOR] = pixwhite; 1361: xmstring = XmStringCreateSimple("white"); 1362: XtVaSetValues(pushButtonColorSpliceLocation, XmNlabelString, xmstring, NULL); 1363: XmStringFree(xmstring); 1364: } 1365: else { 1366: fgPixel[SPLICELOCATION_COLOR] = return_color.pixel; 1367: xmstring = XmStringCreateSimple(color[SPLICELOCATION_COLOR]); 1368: XtVaSetValues(pushButtonColorSpliceLocation, XmNlabelString, xmstring, NULL); 1369: XmStringFree(xmstring); 1370: } 1371: XtVaSetValues(pushButtonColorSpliceLocation, XmNbackground, fgPixel[SPLICELOCATION_COLOR], NULL); 1372: 1373: /* the composite and splice correlation coef 1374: */ 1375: if(!XAllocNamedColor(dpy, cmap, color[CORRCOEF_COLOR], &return_color, &unused)) { 1376: (void)sprintf(buffer, "can not allocate named color. %s", color[CORRCOEF_COLOR]); 1377: SpManageWarningBox(buffer); 1378: fgPixel[CORRCOEF_COLOR] = pixwhite; 1379: xmstring = XmStringCreateSimple("white"); 1380: XtVaSetValues(pushButtonColorCorrCoef, XmNlabelString, xmstring, NULL); 1381: XmStringFree(xmstring); 1382: } 1383: else { 1384: fgPixel[CORRCOEF_COLOR] = return_color.pixel; 1385: xmstring = XmStringCreateSimple(color[CORRCOEF_COLOR]); 1386: XtVaSetValues(pushButtonColorCorrCoef, XmNlabelString, xmstring, NULL); 1387: XmStringFree(xmstring); 1388: } 1389: XtVaSetValues(pushButtonColorCorrCoef, XmNbackground, fgPixel[CORRCOEF_COLOR], NULL); 1390: 1391: /* the line on axis indicating location of best corr. coef. 1392: */ 1393: if(!XAllocNamedColor(dpy, cmap, color[BESTCORR_COLOR], &return_color, &unused)) { 1394: (void)sprintf(buffer, "can not allocate named color. %s", color[BESTCORR_COLOR]); 1395: SpManageWarningBox(buffer); 1396: fgPixel[BESTCORR_COLOR] = pixwhite; 1397: xmstring = XmStringCreateSimple("white"); 1398: XtVaSetValues(pushButtonColorBestCorr, XmNlabelString, xmstring, NULL); 1399: XmStringFree(xmstring); 1400: } 1401: else { 1402: fgPixel[BESTCORR_COLOR] = return_color.pixel; 1403: xmstring = XmStringCreateSimple(color[BESTCORR_COLOR]); 1404: XtVaSetValues(pushButtonColorBestCorr, XmNlabelString, xmstring, NULL); 1405: XmStringFree(xmstring); 1406: } 1407: XtVaSetValues(pushButtonColorBestCorr, XmNbackground, fgPixel[BESTCORR_COLOR], NULL); 1408: 1409: /* stratigraphy colors; 1410: */ 1411: if(!XAllocNamedColor(dpy, cmap, color[PALEOMAG_COLOR], &return_color, &unused)) { 1412: (void)sprintf(buffer, "can not allocate named color. %s", color[PALEOMAG_COLOR]); 1413: SpManageWarningBox(buffer); 1414: fgPixel[PALEOMAG_COLOR] = pixwhite; 1415: xmstring = XmStringCreateSimple("white"); 1416: XtVaSetValues(pushButtonColorPaleomag, XmNlabelString, xmstring, NULL); 1417: XmStringFree(xmstring); 1418: } 1419: else { 1420: fgPixel[PALEOMAG_COLOR] = return_color.pixel; 1421: xmstring = XmStringCreateSimple(color[PALEOMAG_COLOR]); 1422: XtVaSetValues(pushButtonColorPaleomag, XmNlabelString, xmstring, NULL); 1423: XmStringFree(xmstring); 1424: } 1425: XtVaSetValues(pushButtonColorPaleomag, XmNbackground, fgPixel[PALEOMAG_COLOR], NULL); 1426: 1427: if(!XAllocNamedColor(dpy, cmap, color[DIATOM_COLOR], &return_color, &unused)) { 1428: (void)sprintf(buffer, "can not allocate named color %s.", color[DIATOM_COLOR]); 1429: SpManageWarningBox(buffer); 1430: fgPixel[DIATOM_COLOR] = pixwhite; 1431: xmstring = XmStringCreateSimple("white"); 1432: XtVaSetValues(pushButtonColorDiatom, XmNlabelString, xmstring, NULL); 1433: XmStringFree(xmstring); 1434: } 1435: else { 1436: fgPixel[DIATOM_COLOR] = return_color.pixel; 1437: xmstring = XmStringCreateSimple(color[DIATOM_COLOR]); 1438: XtVaSetValues(pushButtonColorDiatom, XmNlabelString, xmstring, NULL); 1439: XmStringFree(xmstring); 1440: } 1441: XtVaSetValues(pushButtonColorDiatom, XmNbackground, fgPixel[DIATOM_COLOR], NULL); 1442: 1443: if(!XAllocNamedColor(dpy, cmap, color[RAD_COLOR], &return_color, &unused)) { 1444: (void)sprintf(buffer, "can not allocate named color. %s", color[RAD_COLOR]); 1445: SpManageWarningBox(buffer); 1446: fgPixel[RAD_COLOR] = pixwhite; 1447: xmstring = XmStringCreateSimple("white"); 1448: XtVaSetValues(pushButtonColorRad, XmNlabelString, xmstring, NULL); 1449: XmStringFree(xmstring); 1450: } 1451: else { 1452: fgPixel[RAD_COLOR] = return_color.pixel; 1453: xmstring = XmStringCreateSimple(color[RAD_COLOR]); 1454: XtVaSetValues(pushButtonColorRad, XmNlabelString, xmstring, NULL); 1455: XmStringFree(xmstring); 1456: } 1457: XtVaSetValues(pushButtonColorRad, XmNbackground, fgPixel[RAD_COLOR], NULL); 1458: 1459: if(!XAllocNamedColor(dpy, cmap, color[FORAM_COLOR], &return_color, &unused)) { 1460: (void)sprintf(buffer, "can not allocate named color. %s", color[FORAM_COLOR]); 1461: SpManageWarningBox(buffer); 1462: fgPixel[FORAM_COLOR] = pixwhite; 1463: xmstring = XmStringCreateSimple("white"); 1464: XtVaSetValues(pushButtonColorForam, XmNlabelString, xmstring, NULL); 1465: XmStringFree(xmstring); 1466: } 1467: else { 1468: fgPixel[FORAM_COLOR] = return_color.pixel; 1469: xmstring = XmStringCreateSimple(color[FORAM_COLOR]); 1470: XtVaSetValues(pushButtonColorForam, XmNlabelString, xmstring, NULL); 1471: XmStringFree(xmstring); 1472: } 1473: XtVaSetValues(pushButtonColorForam, XmNbackground, fgPixel[FORAM_COLOR], NULL); 1474: 1475: if(!XAllocNamedColor(dpy, cmap, color[NANNO_COLOR], &return_color, &unused)) { 1476: (void)sprintf(buffer, "can not allocate named color. %s", color[NANNO_COLOR]); 1477: SpManageWarningBox(buffer); 1478: fgPixel[NANNO_COLOR] = pixwhite; 1479: xmstring = XmStringCreateSimple("white"); 1480: XtVaSetValues(pushButtonColorNanno, XmNlabelString, xmstring, NULL); 1481: XmStringFree(xmstring); 1482: } 1483: else { 1484: fgPixel[NANNO_COLOR] = return_color.pixel; 1485: xmstring = XmStringCreateSimple(color[NANNO_COLOR]); 1486: XtVaSetValues(pushButtonColorNanno, XmNlabelString, xmstring, NULL); 1487: XmStringFree(xmstring); 1488: } 1489: XtVaSetValues(pushButtonColorNanno, XmNbackground, fgPixel[NANNO_COLOR], NULL); 1490: 1491: /* view depth offset colors 1492: */ 1493: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFLINE_COLOR], &return_color, &unused)) { 1494: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFLINE_COLOR]); 1495: SpManageWarningBox(buffer); 1496: fgPixel[DEPOFFLINE_COLOR] = pixwhite; 1497: xmstring = XmStringCreateSimple("white"); 1498: XtVaSetValues(pushButtonColorDepthOffsetLine, XmNlabelString, xmstring, NULL); 1499: XmStringFree(xmstring); 1500: } 1501: else { 1502: fgPixel[DEPOFFLINE_COLOR] = return_color.pixel; 1503: xmstring = XmStringCreateSimple(color[DEPOFFLINE_COLOR]); 1504: XtVaSetValues(pushButtonColorDepthOffsetLine, XmNlabelString, xmstring, NULL); 1505: XmStringFree(xmstring); 1506: } 1507: XtVaSetValues(pushButtonColorDepthOffsetLine, XmNbackground, fgPixel[DEPOFFLINE_COLOR], NULL); 1508: 1509: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE1_COLOR], &return_color, &unused)) { 1510: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE1_COLOR]); 1511: SpManageWarningBox(buffer); 1512: fgPixel[DEPOFFHOLE1_COLOR] = pixwhite; 1513: xmstring = XmStringCreateSimple("white"); 1514: XtVaSetValues(pushButtonColorDepthOffsetHole1, XmNlabelString, xmstring, NULL); 1515: XmStringFree(xmstring); 1516: } 1517: else { 1518: fgPixel[DEPOFFHOLE1_COLOR] = return_color.pixel; 1519: xmstring = XmStringCreateSimple(color[DEPOFFHOLE1_COLOR]); 1520: XtVaSetValues(pushButtonColorDepthOffsetHole1, XmNlabelString, xmstring, NULL); 1521: XmStringFree(xmstring); 1522: } 1523: XtVaSetValues(pushButtonColorDepthOffsetHole1, XmNbackground, fgPixel[DEPOFFHOLE1_COLOR], NULL); 1524: 1525: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE2_COLOR], &return_color, &unused)) { 1526: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE2_COLOR]); 1527: SpManageWarningBox(buffer); 1528: fgPixel[DEPOFFHOLE2_COLOR] = pixwhite; 1529: xmstring = XmStringCreateSimple("white"); 1530: XtVaSetValues(pushButtonColorDepthOffsetHole2, XmNlabelString, xmstring, NULL); 1531: XmStringFree(xmstring); 1532: } 1533: else { 1534: fgPixel[DEPOFFHOLE2_COLOR] = return_color.pixel; 1535: xmstring = XmStringCreateSimple(color[DEPOFFHOLE2_COLOR]); 1536: XtVaSetValues(pushButtonColorDepthOffsetHole2, XmNlabelString, xmstring, NULL); 1537: XmStringFree(xmstring); 1538: } 1539: XtVaSetValues(pushButtonColorDepthOffsetHole2, XmNbackground, fgPixel[DEPOFFHOLE2_COLOR], NULL); 1540: 1541: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE3_COLOR], &return_color, &unused)) { 1542: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE3_COLOR]); 1543: SpManageWarningBox(buffer); 1544: fgPixel[DEPOFFHOLE3_COLOR] = pixwhite; 1545: xmstring = XmStringCreateSimple("white"); 1546: XtVaSetValues(pushButtonColorDepthOffsetHole3, XmNlabelString, xmstring, NULL); 1547: XmStringFree(xmstring); 1548: } 1549: else { 1550: fgPixel[DEPOFFHOLE3_COLOR] = return_color.pixel; 1551: xmstring = XmStringCreateSimple(color[DEPOFFHOLE3_COLOR]); 1552: XtVaSetValues(pushButtonColorDepthOffsetHole3, XmNlabelString, xmstring, NULL); 1553: XmStringFree(xmstring); 1554: } 1555: XtVaSetValues(pushButtonColorDepthOffsetHole3, XmNbackground, fgPixel[DEPOFFHOLE3_COLOR], NULL); 1556: 1557: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE4_COLOR], &return_color, &unused)) { 1558: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE4_COLOR]); 1559: SpManageWarningBox(buffer); 1560: fgPixel[DEPOFFHOLE4_COLOR] = pixwhite; 1561: xmstring = XmStringCreateSimple("white"); 1562: XtVaSetValues(pushButtonColorDepthOffsetHole4, XmNlabelString, xmstring, NULL); 1563: XmStringFree(xmstring); 1564: } 1565: else { 1566: fgPixel[DEPOFFHOLE4_COLOR] = return_color.pixel; 1567: xmstring = XmStringCreateSimple(color[DEPOFFHOLE4_COLOR]); 1568: XtVaSetValues(pushButtonColorDepthOffsetHole4, XmNlabelString, xmstring, NULL); 1569: XmStringFree(xmstring); 1570: } 1571: XtVaSetValues(pushButtonColorDepthOffsetHole4, XmNbackground, fgPixel[DEPOFFHOLE4_COLOR], NULL); 1572: 1573: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE5_COLOR], &return_color, &unused)) { 1574: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE5_COLOR]); 1575: SpManageWarningBox(buffer); 1576: fgPixel[DEPOFFHOLE5_COLOR] = pixwhite; 1577: xmstring = XmStringCreateSimple("white"); 1578: XtVaSetValues(pushButtonColorDepthOffsetHole5, XmNlabelString, xmstring, NULL); 1579: XmStringFree(xmstring); 1580: } 1581: else { 1582: fgPixel[DEPOFFHOLE5_COLOR] = return_color.pixel; 1583: xmstring = XmStringCreateSimple(color[DEPOFFHOLE5_COLOR]); 1584: XtVaSetValues(pushButtonColorDepthOffsetHole5, XmNlabelString, xmstring, NULL); 1585: XmStringFree(xmstring); 1586: } 1587: XtVaSetValues(pushButtonColorDepthOffsetHole5, XmNbackground, fgPixel[DEPOFFHOLE5_COLOR], NULL); 1588: 1589: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE6_COLOR], &return_color, &unused)) { 1590: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE6_COLOR]); 1591: SpManageWarningBox(buffer); 1592: fgPixel[DEPOFFHOLE6_COLOR] = pixwhite; 1593: xmstring = XmStringCreateSimple("white"); 1594: XtVaSetValues(pushButtonColorDepthOffsetHole6, XmNlabelString, xmstring, NULL); 1595: XmStringFree(xmstring); 1596: } 1597: else { 1598: fgPixel[DEPOFFHOLE6_COLOR] = return_color.pixel; 1599: xmstring = XmStringCreateSimple(color[DEPOFFHOLE6_COLOR]); 1600: XtVaSetValues(pushButtonColorDepthOffsetHole6, XmNlabelString, xmstring, NULL); 1601: XmStringFree(xmstring); 1602: } 1603: XtVaSetValues(pushButtonColorDepthOffsetHole6, XmNbackground, fgPixel[DEPOFFHOLE6_COLOR], NULL); 1604: 1605: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE7_COLOR], &return_color, &unused)) { 1606: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE7_COLOR]); 1607: SpManageWarningBox(buffer); 1608: fgPixel[DEPOFFHOLE7_COLOR] = pixwhite; 1609: xmstring = XmStringCreateSimple("white"); 1610: XtVaSetValues(pushButtonColorDepthOffsetHole7, XmNlabelString, xmstring, NULL); 1611: XmStringFree(xmstring); 1612: } 1613: else { 1614: fgPixel[DEPOFFHOLE7_COLOR] = return_color.pixel; 1615: xmstring = XmStringCreateSimple(color[DEPOFFHOLE7_COLOR]); 1616: XtVaSetValues(pushButtonColorDepthOffsetHole7, XmNlabelString, xmstring, NULL); 1617: XmStringFree(xmstring); 1618: } 1619: XtVaSetValues(pushButtonColorDepthOffsetHole7, XmNbackground, fgPixel[DEPOFFHOLE7_COLOR], NULL); 1620: 1621: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE8_COLOR], &return_color, &unused)) { 1622: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE8_COLOR]); 1623: SpManageWarningBox(buffer); 1624: fgPixel[DEPOFFHOLE8_COLOR] = pixwhite; 1625: xmstring = XmStringCreateSimple("white"); 1626: XtVaSetValues(pushButtonColorDepthOffsetHole8, XmNlabelString, xmstring, NULL); 1627: XmStringFree(xmstring); 1628: } 1629: else { 1630: fgPixel[DEPOFFHOLE8_COLOR] = return_color.pixel; 1631: xmstring = XmStringCreateSimple(color[DEPOFFHOLE8_COLOR]); 1632: XtVaSetValues(pushButtonColorDepthOffsetHole8, XmNlabelString, xmstring, NULL); 1633: XmStringFree(xmstring); 1634: } 1635: XtVaSetValues(pushButtonColorDepthOffsetHole8, XmNbackground, fgPixel[DEPOFFHOLE8_COLOR], NULL); 1636: 1637: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE9_COLOR], &return_color, &unused)) { 1638: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE9_COLOR]); 1639: SpManageWarningBox(buffer); 1640: fgPixel[DEPOFFHOLE9_COLOR] = pixwhite; 1641: xmstring = XmStringCreateSimple("white"); 1642: XtVaSetValues(pushButtonColorDepthOffsetHole9, XmNlabelString, xmstring, NULL); 1643: XmStringFree(xmstring); 1644: } 1645: else { 1646: fgPixel[DEPOFFHOLE9_COLOR] = return_color.pixel; 1647: xmstring = XmStringCreateSimple(color[DEPOFFHOLE9_COLOR]); 1648: XtVaSetValues(pushButtonColorDepthOffsetHole9, XmNlabelString, xmstring, NULL); 1649: XmStringFree(xmstring); 1650: } 1651: XtVaSetValues(pushButtonColorDepthOffsetHole9, XmNbackground, fgPixel[DEPOFFHOLE9_COLOR], NULL); 1652: 1653: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE10_COLOR], &return_color, &unused)) { 1654: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE10_COLOR]); 1655: SpManageWarningBox(buffer); 1656: fgPixel[DEPOFFHOLE10_COLOR] = pixwhite; 1657: xmstring = XmStringCreateSimple("white"); 1658: XtVaSetValues(pushButtonColorDepthOffsetHole10, XmNlabelString, xmstring, NULL); 1659: XmStringFree(xmstring); 1660: } 1661: else { 1662: fgPixel[DEPOFFHOLE10_COLOR] = return_color.pixel; 1663: xmstring = XmStringCreateSimple(color[DEPOFFHOLE10_COLOR]); 1664: XtVaSetValues(pushButtonColorDepthOffsetHole10, XmNlabelString, xmstring, NULL); 1665: XmStringFree(xmstring); 1666: } 1667: XtVaSetValues(pushButtonColorDepthOffsetHole10, XmNbackground, fgPixel[DEPOFFHOLE10_COLOR], NULL); 1668: 1669: if(!XAllocNamedColor(dpy, cmap, color[DEPOFFHOLE11_COLOR], &return_color, &unused)) { 1670: (void)sprintf(buffer, "can not allocate named color. %s", color[DEPOFFHOLE11_COLOR]); 1671: SpManageWarningBox(buffer); 1672: fgPixel[DEPOFFHOLE11_COLOR] = pixwhite; 1673: xmstring = XmStringCreateSimple("white"); 1674: XtVaSetValues(pushButtonColorDepthOffsetHole11, XmNlabelString, xmstring, NULL); 1675: XmStringFree(xmstring); 1676: } 1677: else { 1678: fgPixel[DEPOFFHOLE11_COLOR] = return_color.pixel; 1679: xmstring = XmStringCreateSimple(color[DEPOFFHOLE11_COLOR]); 1680: XtVaSetValues(pushButtonColorDepthOffsetHole11, XmNlabelString, xmstring, NULL); 1681: XmStringFree(xmstring); 1682: } 1683: XtVaSetValues(pushButtonColorDepthOffsetHole11, XmNbackground, fgPixel[DEPOFFHOLE11_COLOR], NULL); 1684: 1685: /* colors for the age depth 1686: */ 1687: if(!XAllocNamedColor(dpy, cmap, color[AGEDEPHANDPICK_COLOR], &return_color, &unused)) { 1688: (void)sprintf(buffer, "can not allocate named color. %s", color[AGEDEPHANDPICK_COLOR]); 1689: SpManageWarningBox(buffer); 1690: fgPixel[AGEDEPHANDPICK_COLOR] = pixwhite; 1691: xmstring = XmStringCreateSimple("white"); 1692: XtVaSetValues(pushButtonColorAgeDepthHandPick, XmNlabelString, xmstring, NULL); 1693: XmStringFree(xmstring); 1694: } 1695: else { 1696: fgPixel[AGEDEPHANDPICK_COLOR] = return_color.pixel; 1697: xmstring = XmStringCreateSimple(color[AGEDEPHANDPICK_COLOR]); 1698: XtVaSetValues(pushButtonColorAgeDepthHandPick, XmNlabelString, xmstring, NULL); 1699: XmStringFree(xmstring); 1700: } 1701: XtVaSetValues(pushButtonColorAgeDepthHandPick, XmNbackground, fgPixel[AGEDEPHANDPICK_COLOR], NULL); 1702: 1703: if(!XAllocNamedColor(dpy, cmap, color[AGEDEPLINE_COLOR], &return_color, &unused)) { 1704: (void)sprintf(buffer, "can not allocate named color. %s", color[AGEDEPLINE_COLOR]); 1705: SpManageWarningBox(buffer); 1706: fgPixel[AGEDEPLINE_COLOR] = pixwhite; 1707: xmstring = XmStringCreateSimple("white"); 1708: XtVaSetValues(pushButtonColorAgeDepthLine, XmNlabelString, xmstring, NULL); 1709: XmStringFree(xmstring); 1710: } 1711: else { 1712: fgPixel[AGEDEPLINE_COLOR] = return_color.pixel; 1713: xmstring = XmStringCreateSimple(color[AGEDEPLINE_COLOR]); 1714: XtVaSetValues(pushButtonColorAgeDepthLine, XmNlabelString, xmstring, NULL); 1715: XmStringFree(xmstring); 1716: } 1717: XtVaSetValues(pushButtonColorAgeDepthLine, XmNbackground, fgPixel[AGEDEPLINE_COLOR], NULL); 1718: 1719: /* set the colors for splice vs age 1720: */ 1721: if(!XAllocNamedColor(dpy, cmap, color[SEDRATE_COLOR], &return_color, &unused)) { 1722: (void)sprintf(buffer, "can not allocate named color. %s", color[SEDRATE_COLOR]); 1723: SpManageWarningBox(buffer); 1724: fgPixel[SEDRATE_COLOR] = pixwhite; 1725: xmstring = XmStringCreateSimple("white"); 1726: XtVaSetValues(pushButtonColorSedRate, XmNlabelString, xmstring, NULL); 1727: XmStringFree(xmstring); 1728: } 1729: else { 1730: fgPixel[SEDRATE_COLOR] = return_color.pixel; 1731: xmstring = XmStringCreateSimple(color[SEDRATE_COLOR]); 1732: XtVaSetValues(pushButtonColorSedRate, XmNlabelString, xmstring, NULL); 1733: XmStringFree(xmstring); 1734: } 1735: XtVaSetValues(pushButtonColorSedRate, XmNbackground, fgPixel[SEDRATE_COLOR], NULL); 1736: 1737: if(!XAllocNamedColor(dpy, cmap, color[TIMESERIES_COLOR], &return_color, &unused)) { 1738: (void)sprintf(buffer, "can not allocate named color. %s", color[TIMESERIES_COLOR]); 1739: SpManageWarningBox(buffer); 1740: fgPixel[TIMESERIES_COLOR] = pixwhite; 1741: xmstring = XmStringCreateSimple("white"); 1742: XtVaSetValues(pushButtonColorTimeSeries, XmNlabelString, xmstring, NULL); 1743: XmStringFree(xmstring); 1744: } 1745: else { 1746: fgPixel[TIMESERIES_COLOR] = return_color.pixel; 1747: xmstring = XmStringCreateSimple(color[TIMESERIES_COLOR]); 1748: XtVaSetValues(pushButtonColorTimeSeries, XmNlabelString, xmstring, NULL); 1749: XmStringFree(xmstring); 1750: } 1751: XtVaSetValues(pushButtonColorTimeSeries, XmNbackground, fgPixel[TIMESERIES_COLOR], NULL); 1752: 1753: if(!XAllocNamedColor(dpy, cmap, color[DATUMLOC_COLOR], &return_color, &unused)) { 1754: (void)sprintf(buffer, "can not allocate named color. %s", color[DATUMLOC_COLOR]); 1755: SpManageWarningBox(buffer); 1756: fgPixel[DATUMLOC_COLOR] = pixwhite; 1757: xmstring = XmStringCreateSimple("white"); 1758: XtVaSetValues(pushButtonColorDatumLocation, XmNlabelString, xmstring, NULL); 1759: XmStringFree(xmstring); 1760: } 1761: else { 1762: fgPixel[DATUMLOC_COLOR] = return_color.pixel; 1763: xmstring = XmStringCreateSimple(color[DATUMLOC_COLOR]); 1764: XtVaSetValues(pushButtonColorDatumLocation, XmNlabelString, xmstring, NULL); 1765: XmStringFree(xmstring); 1766: } 1767: XtVaSetValues(pushButtonColorDatumLocation, XmNbackground, fgPixel[DATUMLOC_COLOR], NULL); 1768: } 1769: 1770: 1771: int FindAveDepth(holenum, corenum, pavedt) 1772: int holenum, corenum; 1773: float *pavedt; 1774: { 1775: int i, n, err, dum; 1776: float sbd[MAXPERCORE], dat[MAXPERCORE]; 1777: 1778: /* calculate the average depth step for current 1779: 'tied' cores. 1780: note that cum depth offset is irrelevant 1781: and whether using smooth or not unimportant 1782: */ 1783: *pavedt = 0.0; 1784: n = 0; 1785: if(data[dset]->holes[holenum]->core[corenum]->numvalues > 1){ 1786: 1787: /* clean core of bad values 1788: */ 1789: dum = 0; 1790: err = CleanUpCore(dset, holenum, corenum, &n, sbd, dat, NO, &dum); 1791: 1792: if(n > 1) { 1793: for(i=0; i<n-1; ++i){ 1794: *pavedt = *pavedt + sbd[i+1] - sbd[i]; 1795: } 1796: *pavedt = *pavedt/n; 1797: } 1798: else { 1799: (void)sprintf(buffer, "Warning; can not calculate average depth in hole %c core %d. using 0.05m.", 1800: data[dset]->holes[holenum]->name, data[dset]->holes[holenum]->core[corenum]->num); 1801: SpManageWarningBox(buffer); 1802: *pavedt = 0.05; 1803: return 1; 1804: } 1805: } 1806: else { 1807: (void)sprintf(buffer, "Warning; hole %c core %d has less than 2 points!", 1808: data[dset]->holes[holenum]->name, data[dset]->holes[holenum]->core[corenum]->num); 1809: SpManageWarningBox(buffer); 1810: return 2; 1811: } 1812: 1813: return 0; 1814: } 1815: 1816: 1817: /* correlation function. note that in this function 1818: x is core 1 and y is core 2 1819: */ 1820: int Correlate(nx,ny,offx,offy,x,y,pcoef,pn) 1821: int nx, ny, offx, offy, *pn; 1822: float x[MAXPERCORE], y[MAXPERCORE], *pcoef; 1823: { 1824: int j; 1825: float sumx, sumy, sumxy, sumxsq, sumysq, stdevx, stdevy; 1826: 1827: 1828: *pn=0; 1829: sumx=0.0; 1830: sumy=0.0; 1831: sumxy=0.0; 1832: sumxsq=0.0; 1833: sumysq=0.0; 1834: 1835: /* sum up 1836: */ 1837: for(j=0; j<ny; ++j){ 1838: if(j+offx+offy < 0 || j+offx+offy >= nx){ 1839: } 1840: else if(x[j+offx+offy] == -9999.0 || y[j+offy] == -9999.0){ 1841: } 1842: else { 1843: ++*pn; 1844: sumx=sumx+x[j+offx+offy]; 1845: sumy=sumy+y[j+offy]; 1846: sumxy=sumxy+x[j+offx+offy]*y[j+offy]; 1847: sumxsq=sumxsq+x[j+offx+offy]*x[j+offx+offy]; 1848: sumysq=sumysq+y[j+offy]*y[j+offy]; 1849: } 1850: } 1851: 1852: /* calculate the standard deviation and 1853: the correlation coeficiant 1854: */ 1855: if(*pn > 1){ 1856: stdevx=((*pn)*sumxsq)-(sumx*sumx); 1857: stdevy=((*pn)*sumysq)-(sumy*sumy); 1858: if(stdevx <= 0 || stdevy <= 0){ 1859: *pcoef=0.0; 1860: *pn=0; 1861: } 1862: else { 1863: stdevx=sqrt(stdevx); 1864: stdevy=sqrt(stdevy); 1865: *pcoef=(((*pn)*sumxy)-(sumx*sumy))/(stdevx*stdevy); 1866: } 1867: } 1868: else { 1869: *pcoef=0.0; 1870: *pn=0; 1871: } 1872: return 0; 1873: } 1874: 1875: 1876: /* repick depth at constant depth step 1877: */ 1878: int RepickDepth(pdep,pvar,pn,ptie,dt) 1879: int *pn, *ptie; 1880: float *pdep, *pvar, dt; 1881: { 1882: int i, n, k, kt, lastk, lastn; 1883: float dep[MAXPERCORE], var[MAXPERCORE]; 1884: 1885: /* repick from tie point backwards to first sample 1886: */ 1887: n=(pdep[*ptie]-pdep[0])/dt+1; 1888: if(n > MAXPERCORE){ 1889: return 1; 1890: } 1891: dep[n-1]=pdep[*ptie]; 1892: for(i=n-2; i>=0;--i){ 1893: dep[i]=dep[i+1]-dt; 1894: } 1895: k=*ptie; 1896: kt=n-1; 1897: while(kt >= 0){ 1898: if((k-1) < 0 && dep[kt] <= pdep[0]){ 1899: var[kt]=(pvar[1]-pvar[0])/ 1900: (pdep[1]-pdep[0])* 1901: (dep[kt]-pdep[0])+pvar[0]; 1902: --kt; 1903: } 1904: else if(dep[kt] <= pdep[k] && 1905: dep[kt] >= pdep[k-1]){ 1906: var[kt]=(pvar[k]-pvar[k-1])/ 1907: (pdep[k]-pdep[k-1])* 1908: (dep[kt]-pdep[k-1])+pvar[k-1]; 1909: --kt; 1910: } 1911: else if(dep[kt] < pdep[k] && (k-1) > 0){ 1912: --k; 1913: } 1914: else if(dep[kt] < pdep[0]){ 1915: var[kt]=(pvar[1]-pvar[0])/ 1916: (pdep[1]-pdep[0])* 1917: (dep[kt]-pdep[0])+pvar[0]; 1918: --kt; 1919: } 1920: } 1921: 1922: /* repick from tie point to last sample 1923: */ 1924: lastk=*pn-1; 1925: lastn=(pdep[lastk]-pdep[*ptie])/dt+n; 1926: if(lastn > MAXPERCORE){ 1927: return 1; 1928: } 1929: for(i=n;i<lastn;++i){ 1930: dep[i]=dep[i-1]+dt; 1931: } 1932: k=*ptie; 1933: kt=n; 1934: while(kt < lastn){ 1935: if(k > lastk && dep[kt] >= pdep[lastk]){ 1936: var[kt]=(pvar[lastk]-pvar[lastk-1])/ 1937: (pdep[lastk]-pdep[lastk-1])* 1938: (dep[kt]-pdep[lastk])+pvar[lastk]; 1939: ++kt; 1940: } 1941: else if(dep[kt] >= pdep[k-1] && 1942: dep[kt] <= pdep[k]){ 1943: var[kt]=(pvar[k]-pvar[k-1])/ 1944: (pdep[k]-pdep[k-1])* 1945: (dep[kt]-pdep[k-1])+pvar[k-1]; 1946: ++kt; 1947: } 1948: else if(dep[kt] > pdep[k] && (k+1) <= lastk){ 1949: ++k; 1950: } 1951: else if(dep[kt] > pdep[lastk]){ 1952: var[kt]=(pvar[lastk]-pvar[lastk-1])/ 1953: (pdep[lastk]-pdep[lastk-1])* 1954: (dep[kt]-pdep[lastk])+pvar[lastk]; 1955: ++kt; 1956: } 1957: } 1958: *ptie=n-1; 1959: *pn=lastn; 1960: for(i=0; i<lastn; ++i){ 1961: pdep[i]=dep[i]; 1962: pvar[i]=var[i]; 1963: } 1964: 1965: /* check that have no duplicate depths 1966: */ 1967: for(i=1; i<lastn; ++i){ 1968: if(dep[i-1] == dep[i]){ 1969: (void)sprintf(buffer, "Repick; depths not in descending order at %.2f", dep[i]); 1970: SpManageWarningBox(buffer); 1971: } 1972: else if(dep[i-1] > dep[i]){ 1973: (void)sprintf(buffer, "Repicking depth; depths not in descending order at %.2f", dep[i]); 1974: SpManageWarningBox(buffer); 1975: } 1976: } 1977: 1978: return 0; 1979: } 1980: 1981: 1982: /* find min and max of current var for entire site. 1983: convert these to nearest reasonable whole numbers. 1984: and change them to +/- (PLUSMINUSSTD std from mean. 1985: use this range to calculate the initial drawing 1986: scale to use. 1987: this would be (max-min)/VAR_AXIS_LEN 1988: also find the maximum depth; minimum always 0. 1989: */ 1990: int FindMinMax(ds) 1991: int ds; 1992: { 1993: int i, j, k, sm, err, dum, coren, nstd; 1994: float *phold, coredep[MAXPERCORE], corevar[MAXPERCORE]; 1995: double std, mean, sumstd, summean; 1996: 1997: if(data[ds]->numholes < 1) { 1998: return(0); 1999: } 2000: 2001: if(smooth.method == NONE) { 2002: sm = NO; 2003: } 2004: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 2005: (smooth.plot == UNSMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 2006: sm = NO; 2007: } 2008: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 2009: smooth.plot == SMOOTHED){ 2010: sm = YES; 2011: } 2012: 2013: minvar = 9999.0; 2014: maxvar = -9999.0; 2015: maxdep = -9999.0; 2016: summean = 0.0; 2017: mean = 0.0; 2018: sumstd = 0.0; 2019: std = 0.0; 2020: nstd = 0; 2021: 2022: for(i=0; i<data[ds]->numholes; ++i) { 2023: if(data[ds]->holes[i]->numcores < 1) { 2024: } 2025: else { 2026: for(j=0; j<data[ds]->holes[i]->numcores; ++j) { 2027: if(data[ds]->holes[i]->core[j]->numvalues < 1) { 2028: } 2029: else { 2030: for(k=0; k<data[ds]->holes[i]->core[j]->numvalues; ++k) { 2031: 2032: if(sm == NO && 2033: (data[ds]->holes[i]->core[j]->value[k]->quality) == GOOD){ 2034: phold = data[ds]->holes[i]->core[j]->value[k]->data; 2035: if(*phold > maxvar) { 2036: maxvar = *phold; 2037: } 2038: else if(*phold < minvar) { 2039: minvar = *phold; 2040: } 2041: } 2042: else if(sm == YES && 2043: data[ds]->holes[i]->core[j]->value[k]->smooth_ok >= SMOK){ 2044: if(data[ds]->holes[i]->core[j]->value[k]->sm_data > maxvar) { 2045: maxvar = data[ds]->holes[i]->core[j]->value[k]->sm_data; 2046: } 2047: else if(data[ds]->holes[i]->core[j]->value[k]->sm_data < minvar) { 2048: minvar = data[ds]->holes[i]->core[j]->value[k]->sm_data; 2049: } 2050: } 2051: else { 2052: } 2053: } 2054: 2055: dum = 0; 2056: err = CleanUpCore(ds, i, j, &coren, coredep, corevar, NO, &dum); 2057: err = StdDev(corevar, coren, 0, coren, &std, &mean); 2058: sumstd = sumstd + std; 2059: summean = summean + mean; 2060: ++nstd; 2061: } 2062: } 2063: } 2064: j = data[ds]->holes[i]->numcores - 1; 2065: k = data[ds]->holes[i]->core[j]->numvalues - 1; 2066: if(data[ds]->holes[i]->core[j]->value[k]->sb_depth > maxdep){ 2067: maxdep = data[ds]->holes[i]->core[j]->value[k]->sb_depth; 2068: } 2069: } 2070: 2071: if(minvar == 9999.0 || maxvar == -9999.0) { 2072: return 1; 2073: } 2074: else { 2075: realminvar = minvar; 2076: realmaxvar = maxvar; 2077: 2078: if(nstd > 0 && err == 0) { 2079: std = sumstd/nstd; 2080: mean = summean/nstd; 2081: minvar = mean - (PLUSMINUSSTD * std); 2082: maxvar = mean + (PLUSMINUSSTD * std); 2083: } 2084: else { 2085: return 1; 2086: } 2087: } 2088: 2089: return 0; 2090: } 2091: 2092: /* clean up one cores depth and var 2093: for either plotting or correlation. 2094: find and average mult samples per level, 2095: remove bad values, 2096: chack that samples in desending order, 2097: Add the cummulative depth offset to sbd. 2098: (future) deal with gaps in data. 2099: */ 2100: int CleanUpCore(s, hnum, cnum, pn, psbd, pdata, sm, pt) 2101: int s, hnum, cnum, *pn, sm, *pt; 2102: float *pdata, *psbd; 2103: { 2104: int j, k, n, ndiv, tie; 2105: float sum, savetiedep; 2106: 2107: /*look for and trash any bad data by not storing 2108: them in the pointers pdata and psbd 2109: if have sent a core for correlation and remove 2110: a sample, change the tie(if needed). 2111: */ 2112: 2113: n = 0; 2114: tie = *pt; 2115: for(j=0; j<data[s]->holes[hnum]->core[cnum]->numvalues; ++j) { 2116: if(sm == NO && data[s]->holes[hnum]->core[cnum]->value[j]->quality == GOOD){ 2117: pdata[n] = *data[s]->holes[hnum]->core[cnum]->value[j]->data; 2118: psbd[n] = data[s]->holes[hnum]->core[cnum]->value[j]->sb_depth; 2119: ++n; 2120: } 2121: else if(sm == YES && data[s]->holes[hnum]->core[cnum]->value[j]->smooth_ok >= SMOK){ 2122: pdata[n] = data[s]->holes[hnum]->core[cnum]->value[j]->sm_data; 2123: psbd[n] = data[s]->holes[hnum]->core[cnum]->value[j]->sb_depth; 2124: ++n; 2125: } 2126: else if(tie > 0 && n < tie){ 2127: --tie; 2128: } 2129: } 2130: *pn = n; 2131: 2132: /* check that there are at least two data points in 2133: this core 2134: */ 2135: if(n < 2) { 2136: return 1; 2137: } 2138: 2139: /* check that data is in order 2140: */ 2141: for(j=1; j<n; ++j) { 2142: if(psbd[j] < psbd[j-1]) { 2143: return 2; 2144: } 2145: } 2146: 2147: /* look for mult samples per level and average any found 2148: can now use the pointers pdata and psbd rather than 2149: the global structs 2150: the var will either be unsmoothed or smoothed 2151: depending on value of sm = NO/YES. 2152: if are correlating and find mult samples, adjust 2153: tie(if needed) 2154: */ 2155: sum = pdata[0]; 2156: ndiv = 1; 2157: savetiedep = psbd[tie]; 2158: k = 0; 2159: for(j=1; j<n; ++j){ 2160: if(psbd[j] == psbd[j-1] && 2161: j < n-1){ 2162: sum = sum + pdata[j]; 2163: ++ndiv; 2164: } 2165: else if(psbd[j] == psbd[j-1] && j == n-1){ 2166: sum = sum + pdata[j]; 2167: ++ndiv; 2168: psbd[k] = psbd[j-1]; 2169: pdata[k] = sum/ndiv; 2170: ++k; 2171: --tie; 2172: } 2173: else if(psbd[j] != psbd[j-1] && j < n-1){ 2174: psbd[k] = psbd[j-1]; 2175: pdata[k] = sum/ndiv; 2176: sum = pdata[j]; 2177: ndiv=1; 2178: ++k; 2179: } 2180: else if(psbd[j] != psbd[j-1] && j == n-1){ 2181: psbd[k] = psbd[j-1]; 2182: pdata[k] = sum/ndiv; 2183: ++k; 2184: psbd[k] = psbd[j]; 2185: pdata[k] = pdata[j]; 2186: ++k; 2187: } 2188: else { 2189: } 2190: } 2191: *pn = k; 2192: *pt = tie; 2193: 2194: for(j=0; j<k; ++j) { 2195: if(fabs(savetiedep - psbd[j]) < 0.0001) { 2196: tie = j; 2197: } 2198: } 2199: *pt = tie; 2200: 2201: /* check again that there are at least two data points in 2202: this core 2203: */ 2204: if(k < 2) { 2205: return 1; 2206: } 2207: 2208: 2209: /* check if somehow screwed up the tie. HOW? 2210: but how do i know if i have tie 1 or 2? 2211: pdata[tie] should = textTie?sbd 2212: */ 2213: 2214: /*add the cummulative depth offset to the sbd. 2215: note that the temp shift(overlay) offset will 2216: be done in the drawing functions 2217: */ 2218: n = *pn; 2219: for(j=0; j<n; ++j) { 2220: psbd[j] = psbd[j] + data[s]->holes[hnum]->core[cnum]->cum_dep_offset; 2221: } 2222: 2223: /*check to see if there are any 'user defined' gaps in 2224: this core. 2225: then do what?? code them somehow?? 2226: */ 2227: 2228: return 0; 2229: } 2230: 2231: 2232: /* clean up core being added to splice composite 2233: by; 2234: finding and averaging mult samples per level, 2235: remove bad values, 2236: chack that samples in desending order, 2237: Add the Depthoffset to sbd. 2238: (future) deal with gaps in data. 2239: */ 2240: int CleanUpSpliceCore(hnum, cnum, pn, psbd, pdata, sm, spcornum, spstart, pmap) 2241: int hnum, cnum, *pn, sm, spcornum, spstart, *pmap; 2242: float *pdata, *psbd; 2243: { 2244: int j, k, n, ndiv; 2245: float sum; 2246: 2247: /*look for and trash any bad data by not storing 2248: them in the pointers pdata and psbd 2249: start at the tie array location 2250: */ 2251: n = 0; 2252: for(j=spstart; j<data[dset]->holes[hnum]->core[cnum]->numvalues; ++j) { 2253: if(sm == NO && data[dset]->holes[hnum]->core[cnum]->value[j]->quality == GOOD){ 2254: pdata[n] = *data[dset]->holes[hnum]->core[cnum]->value[j]->data; 2255: pmap[n] = j; 2256: psbd[n] = data[dset]->holes[hnum]->core[cnum]->value[j]->sb_depth; 2257: ++n; 2258: } 2259: else if(sm == YES && data[dset]->holes[hnum]->core[cnum]->value[j]->smooth_ok >= SMOK){ 2260: pdata[n] = data[dset]->holes[hnum]->core[cnum]->value[j]->sm_data; 2261: pmap[n] = j; 2262: psbd[n] = data[dset]->holes[hnum]->core[cnum]->value[j]->sb_depth; 2263: ++n; 2264: } 2265: } 2266: *pn = n; 2267: 2268: /* check that there are at least two data points in 2269: this core 2270: */ 2271: if(n < 2) { 2272: return 1; 2273: } 2274: /* check that data is in order 2275: */ 2276: for(j=1; j<n; ++j) { 2277: if(psbd[j] < psbd[j-1]) { 2278: return 1; 2279: } 2280: } 2281: 2282: /* look for mult samples per level and average any found 2283: can now use the pointers pdata and psbd rather than 2284: the global structs 2285: the var will either be unsmoothed or smoothed 2286: depending on value of sm = NO/YES. 2287: */ 2288: sum = pdata[0]; 2289: ndiv = 1; 2290: k = 0; 2291: for(j=1; j<n; ++j){ 2292: if(psbd[j] == psbd[j-1] && j < n-1){ 2293: sum = sum + pdata[j]; 2294: ++ndiv; 2295: } 2296: else if(psbd[j] == psbd[j-1] && j == n-1){ 2297: sum = sum + pdata[j]; 2298: ++ndiv; 2299: pmap[k] = pmap[j-1]; 2300: psbd[k] = psbd[j-1]; 2301: pdata[k] = sum/ndiv; 2302: ++k; 2303: } 2304: else if(psbd[j] != psbd[j-1] && j < n-1){ 2305: pmap[k] = pmap[j-1]; 2306: psbd[k] = psbd[j-1]; 2307: pdata[k] = sum/ndiv; 2308: sum = pdata[j]; 2309: ndiv=1; 2310: ++k; 2311: } 2312: else if(psbd[j] != psbd[j-1] && j == n-1){ 2313: pmap[k] = pmap[j-1]; 2314: psbd[k] = psbd[j-1]; 2315: pdata[k] = sum/ndiv; 2316: ++k; 2317: pmap[k] = pmap[j]; 2318: psbd[k] = psbd[j]; 2319: pdata[k] = pdata[j]; 2320: ++k; 2321: } 2322: else { 2323: } 2324: } 2325: *pn = k; 2326: 2327: /* check again that there are at least two data points in 2328: this core 2329: */ 2330: if(k < 2) { 2331: return 1; 2332: } 2333: 2334: /*add the splice depth offset to the sbd. 2335: */ 2336: n = *pn; 2337: for(j=0; j<n; ++j) { 2338: psbd[j] = psbd[j] + spcomp.Depthoffset[spcornum]; 2339: } 2340: 2341: return 0; 2342: } 2343: 2344: /*how=1; the lock toggle has been activated. 2345: if it is on use the scale value of View slider 2346: and change Edit silder and redraw Edit. 2347: how=2; the Edit slider has been changed. if the lock 2348: toggle is on get the Edit slider scale value 2349: and change the View slider scale value to Edit 2350: and redraw View 2351: how=3; the View slider has been changed. if the lock 2352: toggle is on get the View slider scale value 2353: and change the Edit slider scale value to View 2354: and redraw Edit 2355: */ 2356: void DisplaySliderControl(how) 2357: int how; 2358: { 2359: int scale_edit, scale_view; 2360: 2361: /* if the scale lock option is on 2362: */ 2363: if(XmToggleButtonGetState(toggleButtonLockSlider) == True) { 2364: 2365: XmScaleGetValue(drawingAreaViewScale, &scale_view); 2366: XmScaleGetValue(drawingAreaEditScale, &scale_edit); 2367: 2368: /* if the top values of the two scales differ 2369: */ 2370: if(scale_view != scale_edit) { 2371: 2372: reason_for_redraw = DRAW_EVERYTHING; 2373: 2374: /* lock toggle hit; 2375: make the top value of edit scale equal to view scale 2376: */ 2377: if(how == 1){ 2378: XtVaSetValues(drawingAreaEditScale, XmNvalue, scale_view, NULL); 2379: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 2380: } 2381: 2382: /* edit scale has been changed or dragged; 2383: make the top value of view scale equal to edit scale 2384: */ 2385: else if(how == 2){ 2386: XtVaSetValues(drawingAreaViewScale, XmNvalue, scale_edit, NULL); 2387: DrawDrawingAreaView(drawingAreaView, (XtPointer)NULL, (XtPointer)NULL); 2388: } 2389: 2390: /* view scale has been changed or dragged; 2391: make the top value of edit scale equal to view scale 2392: */ 2393: else if(how == 3){ 2394: XtVaSetValues(drawingAreaEditScale, XmNvalue, scale_view, NULL); 2395: DrawDrawingAreaEdit(drawingAreaEdit, (XtPointer)NULL, (XtPointer)NULL); 2396: } 2397: } 2398: } 2399: } 2400: 2401: int FindValueInCoreToSplice(ds, sm, depth, hole, core, parr, phow, pval, psmval) 2402: int ds, hole, core, *parr, *phow, sm; 2403: float depth, *pval, *psmval; 2404: { 2405: int i, j; 2406: float *pval1, *pval2, val1, val2, dep1,dep2; 2407: 2408: /* search for a sample in core to splice at the same depth as splice tie. 2409: if none is found, interpolate a value at splice tie depth 2410: */ 2411: *parr = -1; 2412: for(i=0; i<data[ds]->holes[hole]->core[core]->numvalues; ++i) { 2413: if(data[ds]->holes[hole]->core[core]->value[i]->quality != GOOD){ 2414: } 2415: else if(fabs(data[ds]->holes[hole]->core[core]->value[i]->sb_depth + 2416: data[ds]->holes[hole]->core[core]->cum_dep_offset - depth) < ROUNDCHECK) { 2417: *parr = i; 2418: *phow = REAL; 2419: pval1 = data[ds]->holes[hole]->core[core]->value[i]->data; 2420: val1 = *pval1; 2421: *pval = val1; 2422: if(sm == YES && data[ds]->holes[hole]->core[core]->value[i]->smooth_ok >= SMOK) { 2423: *psmval = data[ds]->holes[hole]->core[core]->value[i]->sm_data; 2424: } 2425: else { 2426: *psmval = *pval; 2427: } 2428: return 0; 2429: } 2430: } 2431: if(*parr == -1 && data[ds]->holes[hole]->core[core]->numvalues >= 2) { 2432: i = 0; 2433: j = 1; 2434: while(j < data[ds]->holes[hole]->core[core]->numvalues) { 2435: if(data[ds]->holes[hole]->core[core]->value[i]->quality != GOOD) { 2436: ++i; 2437: if(i == j) { 2438: ++j; 2439: } 2440: } 2441: else if(data[ds]->holes[hole]->core[core]->value[j]->quality != GOOD) { 2442: ++j; 2443: } 2444: else if(data[ds]->holes[hole]->core[core]->value[i]->sb_depth + 2445: data[ds]->holes[hole]->core[core]->cum_dep_offset < depth && 2446: data[ds]->holes[hole]->core[core]->value[j]->sb_depth + 2447: data[ds]->holes[hole]->core[core]->cum_dep_offset > depth) { 2448: *parr = j; 2449: *phow = INTERPOLATED; 2450: dep1 = data[ds]->holes[hole]->core[core]->value[i]->sb_depth + 2451: data[ds]->holes[hole]->core[core]->cum_dep_offset; 2452: dep2 = data[ds]->holes[hole]->core[core]->value[j]->sb_depth + 2453: data[ds]->holes[hole]->core[core]->cum_dep_offset; 2454: pval1 = data[ds]->holes[hole]->core[core]->value[i]->data; 2455: pval2 = data[ds]->holes[hole]->core[core]->value[j]->data; 2456: val1 = *pval1; 2457: val2 = *pval2; 2458: *pval = val1 + (val2 - val1) * (depth - dep1)/(dep2 - dep1); 2459: if(sm == YES && 2460: data[ds]->holes[hole]->core[core]->value[i]->smooth_ok >= SMOK && 2461: data[ds]->holes[hole]->core[core]->value[j]->smooth_ok >= SMOK) { 2462: val1 = data[ds]->holes[hole]->core[core]->value[i]->sm_data; 2463: val2 = data[ds]->holes[hole]->core[core]->value[j]->sm_data; 2464: *psmval = val1 + (val2 - val1) * (depth - dep1)/(dep2 - dep1); 2465: } 2466: else { 2467: *psmval = *pval; 2468: } 2469: return 0; 2470: } 2471: else { 2472: ++i; 2473: ++j; 2474: } 2475: } 2476: } 2477: 2478: return 1; 2479: } 2480: 2481: int StdDev(x, n, off, win, stddev, xmean) 2482: int n, off, win; 2483: float *x; 2484: double *stddev, *xmean; 2485: { 2486: int i; 2487: float sum, sumsq, nx; 2488: 2489: if(win < 1 || off + win > n) { 2490: return 1; 2491: } 2492: 2493: sum = 0.0; 2494: sumsq = 0.0; 2495: 2496: nx = 0.0; 2497: for(i=off; i<off+win; ++i) { 2498: sum = sum + x[i]; 2499: sumsq = sumsq + x[i] * x[i]; 2500: ++nx; 2501: } 2502: 2503: *xmean = sum/nx; 2504: 2505: if(nx < 2.0) { 2506: return 1; 2507: } 2508: else { 2509: *stddev = (nx * sumsq - sum * sum)/(nx * (nx - 1)); 2510: if(*stddev < 0.0) { 2511: *stddev = 0.0; 2512: } 2513: else { 2514: *stddev = sqrt(*stddev); 2515: } 2516: } 2517: 2518: return 0; 2519: } 2520: 2521: int SiteAveDepth() 2522: { 2523: int i, j, n, err; 2524: float avedep, sumavedep; 2525: 2526: n = 0; 2527: sumavedep = 0.0; 2528: for(i=0; i<data[dset]->numholes; ++i) { 2529: if(data[dset]->holes[i]->numcores < 1) { 2530: } 2531: else { 2532: for(j=0; j<data[dset]->holes[i]->numcores; ++j) { 2533: if(data[dset]->holes[i]->core[j]->numvalues < 1) { 2534: } 2535: else { 2536: 2537: if(err = FindAveDepth(i, j, &avedep) == 0) { 2538: sumavedep = sumavedep + avedep; 2539: ++n; 2540: } 2541: } 2542: } 2543: } 2544: } 2545: if(n > 0 && sumavedep > 0.0) { 2546: avedep = sumavedep/n; 2547: average_depth_step = avedep * 100; 2548: } 2549: else { 2550: average_depth_step = AVEDEPTHSTEP; 2551: (void)sprintf(buffer,"Warning: could not calculate the average depth step for this data set."); 2552: SpManageWarningBox(buffer); 2553: } 2554: } 2555: 2556: void MakeClipMask(dpy, gc, x, y, width, height) 2557: Display *dpy; 2558: GC gc; 2559: short int x, y; 2560: unsigned short int width, height; 2561: { 2562: Region r; 2563: XRectangle rect; 2564: 2565: r = XCreateRegion(); 2566: 2567: rect.x = x; 2568: rect.y = y; 2569: rect.width = width; 2570: rect.height = height; 2571: 2572: XUnionRectWithRegion(&rect, r, r); 2573: 2574: XSetRegion(dpy, gc, r); 2575: 2576: XDestroyRegion(r); 2577: } 2578: 2579: void FindClipRegion(who, win_width, win_height, start_hole) 2580: int who, start_hole; 2581: Dimension win_width, win_height; 2582: { 2583: 2584: int i, tie, err, n, sm, x1, x2, x3, y1, y2, y3, h1, h2, h3, w1, w2, w3, t1, t2, point_clip; 2585: float sbd[MAXPERCORE], dat[MAXPERCORE], min1, min2, max1, max2; 2586: 2587: point_clip = 2; 2588: 2589: if(smooth.method == NONE) { 2590: sm = NO; 2591: } 2592: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 2593: (smooth.plot == UNSMOOTHED)){ 2594: sm = NO; 2595: } 2596: else if((smooth.method == GAUSSIAN || smooth.method == OTHER) && 2597: (smooth.plot == SMOOTHED || smooth.plot == SMOOTHEDBOTH)){ 2598: sm = YES; 2599: } 2600: else { 2601: sm = NO; 2602: } 2603: 2604: if(who == EDIT) { 2605: 2606: if(reason_for_redraw == DRAW_TIES) { 2607: 2608: if(have_tie1 == DO && have_tie2 == DONT) { 2609: tie = tie1arraynum; 2610: err = CleanUpCore(dset, tie1holenum, tie1corenum, &n, sbd, dat, sm, &tie); 2611: y1 = (sbd[tie] - top_meter_edit)/depperpix + top_off_edit; 2612: if(y1 < POINTSIZE) { 2613: y1 = POINTSIZE; 2614: } 2615: clip_y = y1 - POINTSIZE; 2616: clip_height = POINTSIZE * point_clip; 2617: x1 = (dat[tie] - minvar)/varperpix+ 2618: OFF + SPACE + (tie1holenum - start_hole) * (varaxislen + SPACE); 2619: if(x1 < POINTSIZE) { 2620: x1 = POINTSIZE; 2621: } 2622: clip_x = x1 - POINTSIZE; 2623: clip_width = POINTSIZE * point_clip; 2624: 2625: } 2626: else if(have_tie1 == DONT && have_tie2 == DO) { 2627: tie = tie2arraynum; 2628: err = CleanUpCore(dset, tie2holenum, tie2corenum, &n, sbd, dat, sm, &tie); 2629: y2 = (sbd[tie] - top_meter_edit)/depperpix + top_off_edit; 2630: if(y2 < POINTSIZE) { 2631: y2 = POINTSIZE; 2632: } 2633: clip_y = y2 - POINTSIZE; 2634: clip_height = POINTSIZE * point_clip; 2635: x2 = (dat[tie] - minvar)/varperpix+ 2636: OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2637: if(x2 < POINTSIZE) { 2638: x2 = POINTSIZE; 2639: } 2640: clip_x = x2 - POINTSIZE; 2641: clip_width = POINTSIZE * point_clip; 2642: } 2643: else if(have_tie1 == DO && have_tie2 == DO) { 2644: 2645: sm = NO; 2646: tie = tie1arraynum; 2647: err = CleanUpCore(dset, tie1holenum, tie1corenum, &n, sbd, dat, sm, &tie); 2648: FindMinMaxOneCore(dat, n, &min1, &max1); 2649: x1 = (min1 - minvar)/varperpix + OFF + SPACE + (tie1holenum - start_hole) * (varaxislen + SPACE); 2650: w1 = (max1 - minvar)/varperpix + OFF + SPACE + (tie1holenum - start_hole) * (varaxislen + SPACE); 2651: 2652: tie = tie2arraynum; 2653: err = CleanUpCore(dset, tie2holenum, tie2corenum, &n, sbd, dat, sm, &tie); 2654: FindMinMaxOneCore(dat, n, &min2, &max2); 2655: t2 = (sbd[tie] - top_meter_edit)/depperpix + top_off_edit; 2656: y3 = (sbd[0] - top_meter_edit + tiedepoffset)/depperpix + top_off_edit; 2657: h3 = (sbd[n-1] - top_meter_edit + tiedepoffset)/depperpix + top_off_edit; 2658: x2 = (min2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2659: w2 = (max2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2660: x3 = (min2 - minvar)/varperpix + OFF + SPACE + (tie1holenum - start_hole) * (varaxislen + SPACE); 2661: w3 = (max2 - minvar)/varperpix + OFF + SPACE + (tie1holenum - start_hole) * (varaxislen + SPACE); 2662: 2663: if(y3 <= t2) { 2664: y1 = y3; 2665: } 2666: else if(y3 > t2) { 2667: y1 = t2; 2668: } 2669: if(y1 < 0) { 2670: clip_y = 0; 2671: } 2672: else { 2673: clip_y = y1; 2674: } 2675: 2676: if(h3 <= t2) { 2677: h1 = t2; 2678: } 2679: else if(h3 > t2) { 2680: h1 = h3; 2681: } 2682: if(h1 < 0) { 2683: h1 = 0; 2684: } 2685: clip_height = h1 - clip_y; 2686: 2687: if(x2 < x1) { 2688: x1 = x2; 2689: } 2690: if(x3 < x1) { 2691: x1 = x3; 2692: } 2693: if(x1 < 0) { 2694: clip_x = 0; 2695: } 2696: else { 2697: clip_x = x1; 2698: } 2699: 2700: if(w2 > w1) { 2701: w1 = w2; 2702: } 2703: if(w3 > w1) { 2704: w1 = w3; 2705: } 2706: if(w1 < 0) { 2707: w1 = 0; 2708: } 2709: clip_width = w1 - clip_x; 2710: } 2711: } 2712: 2713: else if(reason_for_redraw == DRAW_DEPTHSHIFT || reason_for_redraw == DRAW_DEPTHSHIFTUNDO) { 2714: 2715: sm = NO; 2716: tie = tie2arraynum; 2717: err = CleanUpCore(dset, tie2holenum, tie2corenum, &n, sbd, dat, sm, &tie); 2718: 2719: if(reason_for_redraw == DRAW_DEPTHSHIFT) { 2720: if(lastdepoffset >= 0.0) { 2721: y2 = (sbd[0] - top_meter_edit - lastdepoffset)/depperpix + top_off_edit; 2722: } 2723: else if(lastdepoffset < 0.0) { 2724: y2 = (sbd[0] - top_meter_edit)/depperpix + top_off_edit; 2725: } 2726: } 2727: else if(reason_for_redraw == DRAW_DEPTHSHIFTUNDO) { 2728: if(lastdepoffset >= 0.0) { 2729: y2 = (sbd[0] - top_meter_edit)/depperpix + top_off_edit; 2730: } 2731: else if(lastdepoffset < 0.0) { 2732: y2 = (sbd[0] - top_meter_edit - lastdepoffset)/depperpix + top_off_edit; 2733: } 2734: } 2735: if(y2 < 0) { 2736: clip_y = 0; 2737: } 2738: else { 2739: clip_y = y2; 2740: } 2741: 2742: if(lastshiftwho == ONECORE) { 2743: if(reason_for_redraw == DRAW_DEPTHSHIFT) { 2744: if(lastdepoffset >= 0.0) { 2745: h2 = (sbd[n-1] - top_meter_edit)/depperpix + top_off_edit; 2746: } 2747: else if(lastdepoffset < 0.0) { 2748: h2 = (sbd[n-1] - top_meter_edit + lastdepoffset)/depperpix + top_off_edit; 2749: } 2750: } 2751: else if(reason_for_redraw == DRAW_DEPTHSHIFTUNDO) { 2752: if(lastdepoffset >= 0.0) { 2753: h2 = (sbd[n-1] - top_meter_edit + lastdepoffset)/depperpix + top_off_edit; 2754: } 2755: else if(lastdepoffset < 0.0) { 2756: h2 = (sbd[n-1] - top_meter_edit)/depperpix + top_off_edit; 2757: } 2758: } 2759: } 2760: else if(lastshiftwho == ALLCORES) { 2761: h2 = (int)win_height; 2762: } 2763: if(h2 < 0) { 2764: h2 = 0; 2765: } 2766: clip_height = h2 - clip_y; 2767: 2768: if(lastshiftwho == ONECORE || tie2corenum == data[dset]->holes[tie2holenum]->numcores - 1) { 2769: FindMinMaxOneCore(dat, n, &min2, &max2); 2770: x2 = (min2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2771: w2 = (max2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2772: } 2773: else if(lastshiftwho == ALLCORES && tie2corenum < data[dset]->holes[tie2holenum]->numcores - 1) { 2774: FindMinMaxOneCore(dat, n, &min2, &max2); 2775: x2 = (min2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2776: w2 = (max2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2777: i = tie2corenum + 1; 2778: while(i < data[dset]->holes[tie2holenum]->numcores) { 2779: tie = 0; 2780: err = CleanUpCore(dset, tie2holenum, i, &n, sbd, dat, sm, &tie); 2781: if(((sbd[0] - top_meter_edit - lastdepoffset)/depperpix + top_off_edit) > (int)win_height) { 2782: break; 2783: } 2784: else { 2785: FindMinMaxOneCore(dat, n, &min2, &max2); 2786: x3 = (min2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2787: w3 = (max2 - minvar)/varperpix + OFF + SPACE + (tie2holenum - start_hole) * (varaxislen + SPACE); 2788: if(x3 < x2) { 2789: x2 = x3; 2790: } 2791: if(w3 > w2) { 2792: w2 = w3; 2793: } 2794: ++i; 2795: } 2796: } 2797: } 2798: if(x2 < 0) { 2799: clip_x = 0; 2800: } 2801: else { 2802: clip_x = x2; 2803: } 2804: if(w2 < 0) { 2805: w2 = 0; 2806: } 2807: clip_width = w2 - clip_x; 2808: } 2809: 2810: else { 2811: clip_x = 0; 2812: clip_y = 0; 2813: clip_width = (int)win_width; 2814: clip_height = (int)win_height; 2815: } 2816: 2817: } 2818: 2819: else if(who == VIEW) { 2820: 2821: if(reason_for_redraw == DRAW_TIES) { 2822: 2823: } 2824: 2825: else if(reason_for_redraw == DRAW_COREGRABBED) { 2826: 2827: sm = NO; 2828: tie = splicearraynum; 2829: err = CleanUpCore(dset, spliceholenum, splicecorenum, &n, sbd, dat, sm, &tie); 2830: y1 = (sbd[0] - top_meter_view)/depperpix + top_off_view; 2831: if(y1 < 0) { 2832: clip_y = 0; 2833: } 2834: else { 2835: clip_y = y1; 2836: } 2837: h2 = (sbd[n-1] - top_meter_view)/depperpix + top_off_view; 2838: clip_height = h2 - clip_y; 2839: 2840: FindMinMaxOneCore(dat, n, &min1, &max1); 2841: x1 = (min1 - minvar)/varperpix + OFF + SPACE + varaxislen; 2842: w1 = (max1 - minvar)/varperpix + OFF + SPACE + varaxislen; 2843: if(x1 < 0) { 2844: clip_x = 0; 2845: } 2846: else { 2847: clip_x = x1; 2848: } 2849: if(w1 < 0) { 2850: w2 = 0; 2851: } 2852: clip_width = w1 - clip_x; 2853: } 2854: 2855: else if(reason_for_redraw == DRAW_CORECLEARED) { 2856: 2857: } 2858: 2859: else if(reason_for_redraw == DRAW_SPLICED) { 2860: 2861: } 2862: 2863: else if(reason_for_redraw == DRAW_APPEND) { 2864: 2865: } 2866: 2867: else if(reason_for_redraw == DRAW_UNDONE) { 2868: 2869: } 2870: 2871: else { 2872: clip_x = 0; 2873: clip_y = 0; 2874: clip_width = (int)win_width; 2875: clip_height = (int)win_height; 2876: } 2877: 2878: } 2879: 2880: else { 2881: clip_x = 0; 2882: clip_y = 0; 2883: clip_width = (int)win_width; 2884: clip_height = (int)win_height; 2885: } 2886: } 2887: 2888: int FindMinMaxOneCore(pdat, n, pmin, pmax) 2889: int n; 2890: float *pdat, *pmin, *pmax; 2891: { 2892: int i; 2893: 2894: *pmin = 99999.0; 2895: *pmax = -99999.0; 2896: for(i=0; i<n; ++i) { 2897: if(*pmin > pdat[i]) { 2898: *pmin = pdat[i]; 2899: } 2900: if(*pmax < pdat[i]) { 2901: *pmax = pdat[i]; 2902: } 2903: } 2904: if(*pmin == 99999.0 || *pmax == -99999.0) { 2905: return 1; 2906: } 2907: else { 2908: return 0; 2909: } 2910: } 2911: 2912: void ReadColorList(dpy) 2913: Display *dpy; 2914: { 2915: int start, i; 2916: char line[1000], rgbcolor[51], value[51], *color_path, *filename, *getenv(); 2917: FILE *fp; 2918: XmString xmstring; 2919: Pixel sampPixel; 2920: 2921: start = 0; 2922: if((color_path=(char*)calloc(1000, CHAR_SIZE))==NULL) 2923: SpBadMemAlloc("ReadColorList"); 2924: (void)strcpy(color_path,(char*)getenv("SPLICER_COLOR_PATH")); 2925: if((filename=(char*)calloc((int)strlen(color_path) + 50, CHAR_SIZE))==NULL) 2926: SpBadMemAlloc("ReadColorList"); 2927: (void)sprintf(filename, "%s/color-name-list", color_path); 2928: free(color_path); 2929: 2930: if((fp = fopen(filename, "r")) != NULL) { 2931: strcpy(line, ""); 2932: while(fgets(line, 1000, fp) != NULL) { 2933: 2934: for(i=50; i>=0; --i) { 2935: strcpy(&rgbcolor[i], ""); 2936: strcpy(&value[i], ""); 2937: } 2938: strcpy(rgbcolor, ""); 2939: strcpy(value, ""); 2940: 2941: (void)strncpy(value, &line[13], (int)strlen(line) - 12); 2942: 2943: sscanf(value, "%s", rgbcolor); 2944: 2945: xmstring = XmStringCreateSimple(rgbcolor); 2946: XmListAddItemUnselected(listColor, xmstring, 0); 2947: XmStringFree(xmstring); 2948: if(start == 0) { 2949: 2950: /* let the first color in the list be the selected 2951: and displayed sample color 2952: */ 2953: GetColorPixelValue(dpy, rgbcolor, &sampPixel); 2954: XtVaSetValues(drawingAreaColorSelect, XmNbackground, sampPixel, NULL); 2955: XmListSelectPos(listColor, 1, NULL); 2956: start = 1; 2957: } 2958: strcpy(line, ""); 2959: } 2960: fclose(fp); 2961: } 2962: else { 2963: (void)sprintf(buffer,"Warning: Could not open splicer's color-name-list."); 2964: SpManageWarningBox(buffer); 2965: } 2966: 2967: free(filename); 2968: 2969: (void)sprintf(line, ""); 2970: (void)sprintf(rgbcolor, ""); 2971: (void)sprintf(value, ""); 2972: } 2973: 2974: int GetColorPixelValue(dpy, rgbc, pixel) 2975: Display *dpy; 2976: char rgbc[51]; 2977: Pixel *pixel; 2978: { 2979: int test; 2980: XColor return_color, unused; 2981: 2982: if(!(test=XAllocNamedColor(dpy, cmap, rgbc, &return_color, &unused))) { 2983: (void)printf("can not allocate named color: %s. reason %d\n", rgbc, test); 2984: *pixel = BlackPixelOfScreen(XtScreen(drawingAreaColorSelect)); 2985: } 2986: else { 2987: *pixel = return_color.pixel; 2988: } 2989: } 2990: 2991: void SetCustomeColorWidgetBGColors(bgP) 2992: Pixel bgP; 2993: { 2994: 2995: /* set the row-column background color 2996: */ 2997: XtVaSetValues(rowColumnColorCompositeAndSplice, XmNbackground, bgP, NULL); 2998: XtVaSetValues(rowColumnColorCorrelation, XmNbackground, bgP, NULL); 2999: XtVaSetValues(rowColumnColorDepthOffset, XmNbackground, bgP, NULL); 3000: XtVaSetValues(rowColumnColorDrawingAreas, XmNbackground, bgP, NULL); 3001: XtVaSetValues(rowColumnColorAgeDepth, XmNbackground, bgP, NULL); 3002: XtVaSetValues(rowColumnColorSpliceToAge, XmNbackground, bgP, NULL); 3003: 3004: /* set the label background color 3005: */ 3006: XtVaSetValues(labelDrawingAreaColorBG, XmNbackground, bgP, NULL); 3007: XtVaSetValues(labelDrawingAreaColorLabels, XmNbackground, bgP, NULL); 3008: XtVaSetValues(labelColorCoreRelated, XmNbackground, bgP, NULL); 3009: XtVaSetValues(labelColorCorembsf, XmNbackground, bgP, NULL); 3010: XtVaSetValues(labelColorCoremcd, XmNbackground, bgP, NULL); 3011: XtVaSetValues(labelColorSmooth, XmNbackground, bgP, NULL); 3012: XtVaSetValues(labelColorSplice, XmNbackground, bgP, NULL); 3013: XtVaSetValues(labelColorSpliceLocation, XmNbackground, bgP, NULL); 3014: XtVaSetValues(labelColorTieRelated, XmNbackground, bgP, NULL); 3015: XtVaSetValues(labelColorTiePtFixed, XmNbackground, bgP, NULL); 3016: XtVaSetValues(labelColorTiePtShift, XmNbackground, bgP, NULL); 3017: XtVaSetValues(labelColorTieLine, XmNbackground, bgP, NULL); 3018: XtVaSetValues(labelColorOverlayInCorr, XmNbackground, bgP, NULL); 3019: XtVaSetValues(labelColorOverlayOutCorr, XmNbackground, bgP, NULL); 3020: XtVaSetValues(labelColorStrat, XmNbackground, bgP, NULL); 3021: XtVaSetValues(labelColorPaleomag, XmNbackground, bgP, NULL); 3022: XtVaSetValues(labelColorDiatom, XmNbackground, bgP, NULL); 3023: XtVaSetValues(labelColorRad, XmNbackground, bgP, NULL); 3024: XtVaSetValues(labelColorForam, XmNbackground, bgP, NULL); 3025: XtVaSetValues(labelColorNanno, XmNbackground, bgP, NULL); 3026: XtVaSetValues(labelColorCorrCoef, XmNbackground, bgP, NULL); 3027: XtVaSetValues(labelColorBestCorr, XmNbackground, bgP, NULL); 3028: XtVaSetValues(labelColorDepthOffsetLine, XmNbackground, bgP, NULL); 3029: XtVaSetValues(labelColorDepthOffsetHole1, XmNbackground, bgP, NULL); 3030: XtVaSetValues(labelColorDepthOffsetHole2, XmNbackground, bgP, NULL); 3031: XtVaSetValues(labelColorDepthOffsetHole3, XmNbackground, bgP, NULL); 3032: XtVaSetValues(labelColorDepthOffsetHole4, XmNbackground, bgP, NULL); 3033: XtVaSetValues(labelColorDepthOffsetHole5, XmNbackground, bgP, NULL); 3034: XtVaSetValues(labelColorDepthOffsetHole6, XmNbackground, bgP, NULL); 3035: XtVaSetValues(labelColorDepthOffsetHole7, XmNbackground, bgP, NULL); 3036: XtVaSetValues(labelColorDepthOffsetHole8, XmNbackground, bgP, NULL); 3037: XtVaSetValues(labelColorDepthOffsetHole9, XmNbackground, bgP, NULL); 3038: XtVaSetValues(labelColorDepthOffsetHole10, XmNbackground, bgP, NULL); 3039: XtVaSetValues(labelColorDepthOffsetHole11, XmNbackground, bgP, NULL); 3040: XtVaSetValues(labelColorAgeDepthHandPick, XmNbackground, bgP, NULL); 3041: XtVaSetValues(labelColorAgeDepthLine, XmNbackground, bgP, NULL); 3042: XtVaSetValues(labelColorSedRate, XmNbackground, bgP, NULL); 3043: XtVaSetValues(labelColorTimeSeries, XmNbackground, bgP, NULL); 3044: XtVaSetValues(labelColorDatumLocation, XmNbackground, bgP, NULL); 3045: } 3046: 3047: void SetCustomeColorWidgetFGColors(fgP) 3048: Pixel fgP; 3049: { 3050: 3051: /* set the row-column label colors 3052: */ 3053: XtVaSetValues(labelDrawingAreaColorBG, XmNforeground, fgP, NULL); 3054: XtVaSetValues(labelDrawingAreaColorLabels, XmNforeground, fgP, NULL); 3055: XtVaSetValues(labelColorCoreRelated, XmNforeground, fgP, NULL); 3056: XtVaSetValues(labelColorCorembsf, XmNforeground, fgP, NULL); 3057: XtVaSetValues(labelColorCoremcd, XmNforeground, fgP, NULL); 3058: XtVaSetValues(labelColorSmooth, XmNforeground, fgP, NULL); 3059: XtVaSetValues(labelColorSplice, XmNforeground, fgP, NULL); 3060: XtVaSetValues(labelColorSpliceLocation, XmNforeground, fgP, NULL); 3061: XtVaSetValues(labelColorTieRelated, XmNforeground, fgP, NULL); 3062: XtVaSetValues(labelColorTiePtFixed, XmNforeground, fgP, NULL); 3063: XtVaSetValues(labelColorTiePtShift, XmNforeground, fgP, NULL); 3064: XtVaSetValues(labelColorTieLine, XmNforeground, fgP, NULL); 3065: XtVaSetValues(labelColorOverlayInCorr, XmNforeground, fgP, NULL); 3066: XtVaSetValues(labelColorOverlayOutCorr, XmNforeground, fgP, NULL); 3067: XtVaSetValues(labelColorStrat, XmNforeground, fgP, NULL); 3068: XtVaSetValues(labelColorPaleomag, XmNforeground, fgP, NULL); 3069: XtVaSetValues(labelColorDiatom, XmNforeground, fgP, NULL); 3070: XtVaSetValues(labelColorRad, XmNforeground, fgP, NULL); 3071: XtVaSetValues(labelColorForam, XmNforeground, fgP, NULL); 3072: XtVaSetValues(labelColorNanno, XmNforeground, fgP, NULL); 3073: XtVaSetValues(labelColorCorrCoef, XmNforeground, fgP, NULL); 3074: XtVaSetValues(labelColorBestCorr, XmNforeground, fgP, NULL); 3075: XtVaSetValues(labelColorDepthOffsetLine, XmNforeground, fgP, NULL); 3076: XtVaSetValues(labelColorDepthOffsetHole1, XmNforeground, fgP, NULL); 3077: XtVaSetValues(labelColorDepthOffsetHole2, XmNforeground, fgP, NULL); 3078: XtVaSetValues(labelColorDepthOffsetHole3, XmNforeground, fgP, NULL); 3079: XtVaSetValues(labelColorDepthOffsetHole4, XmNforeground, fgP, NULL); 3080: XtVaSetValues(labelColorDepthOffsetHole5, XmNforeground, fgP, NULL); 3081: XtVaSetValues(labelColorDepthOffsetHole6, XmNforeground, fgP, NULL); 3082: XtVaSetValues(labelColorDepthOffsetHole7, XmNforeground, fgP, NULL); 3083: XtVaSetValues(labelColorDepthOffsetHole8, XmNforeground, fgP, NULL); 3084: XtVaSetValues(labelColorDepthOffsetHole9, XmNforeground, fgP, NULL); 3085: XtVaSetValues(labelColorDepthOffsetHole10, XmNforeground, fgP, NULL); 3086: XtVaSetValues(labelColorDepthOffsetHole11, XmNforeground, fgP, NULL); 3087: XtVaSetValues(labelColorAgeDepthHandPick, XmNforeground, fgP, NULL); 3088: XtVaSetValues(labelColorAgeDepthLine, XmNforeground, fgP, NULL); 3089: } 3090: 3091: void SetCustomeColorButtonColors(bgP, buttP, buttColorName) 3092: Pixel bgP, buttP[NCUSTOMECOLORBUTT]; 3093: char buttColorName[NCUSTOMECOLORBUTT][50]; 3094: { 3095: 3096: int i; 3097: XmString xmstring; 3098: 3099: XtVaSetValues(pushButtonDrawingAreaColorBG, XmNbackground, bgP, NULL); 3100: xmstring = XmStringCreateSimple(buttColorName[BG_COLOR]); 3101: XtVaSetValues(pushButtonDrawingAreaColorBG, XmNlabelString, xmstring, NULL); 3102: XmStringFree(xmstring); 3103: 3104: XtVaSetValues(pushButtonDrawingAreaColorLabels, XmNbackground, buttP[LABEL_COLOR], NULL); 3105: xmstring = XmStringCreateSimple(buttColorName[LABEL_COLOR]); 3106: XtVaSetValues(pushButtonDrawingAreaColorLabels, XmNlabelString, xmstring, NULL); 3107: XmStringFree(xmstring); 3108: 3109: XtVaSetValues(pushButtonColorCorembsf, XmNbackground, buttP[MBSF_COLOR], NULL); 3110: xmstring = XmStringCreateSimple(buttColorName[MBSF_COLOR]); 3111: XtVaSetValues(pushButtonColorCorembsf, XmNlabelString, xmstring, NULL); 3112: XmStringFree(xmstring); 3113: 3114: XtVaSetValues(pushButtonColorCoremcd, XmNbackground, buttP[MCD_COLOR], NULL); 3115: xmstring = XmStringCreateSimple(buttColorName[MCD_COLOR]); 3116: XtVaSetValues(pushButtonColorCoremcd, XmNlabelString, xmstring, NULL); 3117: XmStringFree(xmstring); 3118: 3119: XtVaSetValues(pushButtonColorSmooth, XmNbackground, buttP[SMOOTH_COLOR], NULL); 3120: xmstring = XmStringCreateSimple(buttColorName[SMOOTH_COLOR]); 3121: XtVaSetValues(pushButtonColorSmooth, XmNlabelString, xmstring, NULL); 3122: XmStringFree(xmstring); 3123: 3124: XtVaSetValues(pushButtonColorSplice, XmNbackground, buttP[SPLICE_COLOR], NULL); 3125: xmstring = XmStringCreateSimple(buttColorName[SPLICE_COLOR]); 3126: XtVaSetValues(pushButtonColorSplice, XmNlabelString, xmstring, NULL); 3127: XmStringFree(xmstring); 3128: 3129: XtVaSetValues(pushButtonColorSpliceLocation, XmNbackground, buttP[SPLICELOCATION_COLOR], NULL); 3130: xmstring = XmStringCreateSimple(buttColorName[SPLICELOCATION_COLOR]); 3131: XtVaSetValues(pushButtonColorSpliceLocation, XmNlabelString, xmstring, NULL); 3132: XmStringFree(xmstring); 3133: 3134: XtVaSetValues(pushButtonColorTiePtFixed, XmNbackground, buttP[TIEPTFIXED_COLOR], NULL); 3135: xmstring = XmStringCreateSimple(buttColorName[TIEPTFIXED_COLOR]); 3136: XtVaSetValues(pushButtonColorTiePtFixed, XmNlabelString, xmstring, NULL); 3137: XmStringFree(xmstring); 3138: 3139: XtVaSetValues(pushButtonColorTiePtShift, XmNbackground, buttP[TIEPTSHIFT_COLOR], NULL); 3140: xmstring = XmStringCreateSimple(buttColorName[TIEPTSHIFT_COLOR]); 3141: XtVaSetValues(pushButtonColorTiePtShift, XmNlabelString, xmstring, NULL); 3142: XmStringFree(xmstring); 3143: 3144: XtVaSetValues(pushButtonColorTieLine, XmNbackground, buttP[TIELINE_COLOR], NULL); 3145: xmstring = XmStringCreateSimple(buttColorName[TIELINE_COLOR]); 3146: XtVaSetValues(pushButtonColorTieLine, XmNlabelString, xmstring, NULL); 3147: XmStringFree(xmstring); 3148: 3149: XtVaSetValues(pushButtonColorOverlayInCorr, XmNbackground, buttP[OVERLAYINCORR_COLOR], NULL); 3150: xmstring = XmStringCreateSimple(buttColorName[OVERLAYINCORR_COLOR]); 3151: XtVaSetValues(pushButtonColorOverlayInCorr, XmNlabelString, xmstring, NULL); 3152: XmStringFree(xmstring); 3153: 3154: XtVaSetValues(pushButtonColorOverlayOutCorr, XmNbackground, buttP[OVERLAYOUTCORR_COLOR], NULL); 3155: xmstring = XmStringCreateSimple(buttColorName[OVERLAYOUTCORR_COLOR]); 3156: XtVaSetValues(pushButtonColorOverlayOutCorr, XmNlabelString, xmstring, NULL); 3157: XmStringFree(xmstring); 3158: 3159: XtVaSetValues(pushButtonColorPaleomag, XmNbackground, buttP[PALEOMAG_COLOR], NULL); 3160: xmstring = XmStringCreateSimple(buttColorName[PALEOMAG_COLOR]); 3161: XtVaSetValues(pushButtonColorPaleomag, XmNlabelString, xmstring, NULL); 3162: XmStringFree(xmstring); 3163: 3164: XtVaSetValues(pushButtonColorDiatom, XmNbackground, buttP[DIATOM_COLOR], NULL); 3165: xmstring = XmStringCreateSimple(buttColorName[DIATOM_COLOR]); 3166: XtVaSetValues(pushButtonColorDiatom, XmNlabelString, xmstring, NULL); 3167: XmStringFree(xmstring); 3168: 3169: XtVaSetValues(pushButtonColorRad, XmNbackground, buttP[RAD_COLOR], NULL); 3170: xmstring = XmStringCreateSimple(buttColorName[RAD_COLOR]); 3171: XtVaSetValues(pushButtonColorRad, XmNlabelString, xmstring, NULL); 3172: XmStringFree(xmstring); 3173: 3174: XtVaSetValues(pushButtonColorForam, XmNbackground, buttP[FORAM_COLOR], NULL); 3175: xmstring = XmStringCreateSimple(buttColorName[FORAM_COLOR]); 3176: XtVaSetValues(pushButtonColorForam, XmNlabelString, xmstring, NULL); 3177: XmStringFree(xmstring); 3178: 3179: XtVaSetValues(pushButtonColorNanno, XmNbackground, buttP[NANNO_COLOR], NULL); 3180: xmstring = XmStringCreateSimple(buttColorName[NANNO_COLOR]); 3181: XtVaSetValues(pushButtonColorNanno, XmNlabelString, xmstring, NULL); 3182: XmStringFree(xmstring); 3183: 3184: XtVaSetValues(pushButtonColorCorrCoef, XmNbackground, buttP[CORRCOEF_COLOR], NULL); 3185: xmstring = XmStringCreateSimple(buttColorName[CORRCOEF_COLOR]); 3186: XtVaSetValues(pushButtonColorCorrCoef, XmNlabelString, xmstring, NULL); 3187: XmStringFree(xmstring); 3188: 3189: XtVaSetValues(pushButtonColorBestCorr, XmNbackground, buttP[BESTCORR_COLOR], NULL); 3190: xmstring = XmStringCreateSimple(buttColorName[BESTCORR_COLOR]); 3191: XtVaSetValues(pushButtonColorBestCorr, XmNlabelString, xmstring, NULL); 3192: XmStringFree(xmstring); 3193: 3194: XtVaSetValues(pushButtonColorDepthOffsetLine, XmNbackground, buttP[DEPOFFLINE_COLOR], NULL); 3195: xmstring = XmStringCreateSimple(buttColorName[DEPOFFLINE_COLOR]); 3196: XtVaSetValues(pushButtonColorDepthOffsetLine, XmNlabelString, xmstring, NULL); 3197: XmStringFree(xmstring); 3198: 3199: XtVaSetValues(pushButtonColorDepthOffsetHole1, XmNbackground, buttP[DEPOFFHOLE1_COLOR], NULL); 3200: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE1_COLOR]); 3201: XtVaSetValues(pushButtonColorDepthOffsetHole1, XmNlabelString, xmstring, NULL); 3202: XmStringFree(xmstring); 3203: 3204: XtVaSetValues(pushButtonColorDepthOffsetHole2, XmNbackground, buttP[DEPOFFHOLE2_COLOR], NULL); 3205: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE2_COLOR]); 3206: XtVaSetValues(pushButtonColorDepthOffsetHole2, XmNlabelString, xmstring, NULL); 3207: XmStringFree(xmstring); 3208: 3209: XtVaSetValues(pushButtonColorDepthOffsetHole3, XmNbackground, buttP[DEPOFFHOLE3_COLOR], NULL); 3210: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE3_COLOR]); 3211: XtVaSetValues(pushButtonColorDepthOffsetHole3, XmNlabelString, xmstring, NULL); 3212: XmStringFree(xmstring); 3213: 3214: XtVaSetValues(pushButtonColorDepthOffsetHole4, XmNbackground, buttP[DEPOFFHOLE4_COLOR], NULL); 3215: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE4_COLOR]); 3216: XtVaSetValues(pushButtonColorDepthOffsetHole4, XmNlabelString, xmstring, NULL); 3217: XmStringFree(xmstring); 3218: 3219: XtVaSetValues(pushButtonColorDepthOffsetHole5, XmNbackground, buttP[DEPOFFHOLE5_COLOR], NULL); 3220: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE5_COLOR]); 3221: XtVaSetValues(pushButtonColorDepthOffsetHole5, XmNlabelString, xmstring, NULL); 3222: XmStringFree(xmstring); 3223: 3224: XtVaSetValues(pushButtonColorDepthOffsetHole6, XmNbackground, buttP[DEPOFFHOLE6_COLOR], NULL); 3225: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE6_COLOR]); 3226: XtVaSetValues(pushButtonColorDepthOffsetHole6, XmNlabelString, xmstring, NULL); 3227: XmStringFree(xmstring); 3228: 3229: XtVaSetValues(pushButtonColorDepthOffsetHole7, XmNbackground, buttP[DEPOFFHOLE7_COLOR], NULL); 3230: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE7_COLOR]); 3231: XtVaSetValues(pushButtonColorDepthOffsetHole7, XmNlabelString, xmstring, NULL); 3232: XmStringFree(xmstring); 3233: 3234: XtVaSetValues(pushButtonColorDepthOffsetHole8, XmNbackground, buttP[DEPOFFHOLE8_COLOR], NULL); 3235: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE8_COLOR]); 3236: XtVaSetValues(pushButtonColorDepthOffsetHole8, XmNlabelString, xmstring, NULL); 3237: XmStringFree(xmstring); 3238: 3239: XtVaSetValues(pushButtonColorDepthOffsetHole9, XmNbackground, buttP[DEPOFFHOLE9_COLOR], NULL); 3240: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE9_COLOR]); 3241: XtVaSetValues(pushButtonColorDepthOffsetHole9, XmNlabelString, xmstring, NULL); 3242: XmStringFree(xmstring); 3243: 3244: XtVaSetValues(pushButtonColorDepthOffsetHole10, XmNbackground, buttP[DEPOFFHOLE10_COLOR], NULL); 3245: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE10_COLOR]); 3246: XtVaSetValues(pushButtonColorDepthOffsetHole10, XmNlabelString, xmstring, NULL); 3247: XmStringFree(xmstring); 3248: 3249: XtVaSetValues(pushButtonColorDepthOffsetHole11, XmNbackground, buttP[DEPOFFHOLE11_COLOR], NULL); 3250: xmstring = XmStringCreateSimple(buttColorName[DEPOFFHOLE11_COLOR]); 3251: XtVaSetValues(pushButtonColorDepthOffsetHole11, XmNlabelString, xmstring, NULL); 3252: XmStringFree(xmstring); 3253: 3254: xmstring = XmStringCreateSimple(buttColorName[AGEDEPHANDPICK_COLOR]); 3255: XtVaSetValues(pushButtonColorAgeDepthHandPick, XmNlabelString, xmstring, NULL); 3256: XmStringFree(xmstring); 3257: 3258: xmstring = XmStringCreateSimple(buttColorName[AGEDEPLINE_COLOR]); 3259: XtVaSetValues(pushButtonColorAgeDepthLine, XmNlabelString, xmstring, NULL); 3260: XmStringFree(xmstring); 3261: } 3262: 3263: void HardwireAxis(max, pmaxunit, pannot, pticinc, ppixperunit, pticpixlen, punitperpix, axispixlen, zoomfact) 3264: int *pannot, *ppixperunit, *pticpixlen, axispixlen, zoomfact; 3265: float max, *pmaxunit, *pticinc, *punitperpix; 3266: { 3267: double check, fract, ip; 3268: 3269: if(max <= 50.0){ 3270: *pmaxunit = 50.0; 3271: *pannot = 2; 3272: *pticinc = 5.0; 3273: *ppixperunit = 12; 3274: *pticpixlen = 60; 3275: *punitperpix = 0.0833; 3276: } 3277: else if(max <= 75.0){ 3278: *pmaxunit = 75.0; 3279: *pannot = 5; 3280: *pticinc = 5.0; 3281: *ppixperunit = 8; 3282: *pticpixlen = 40; 3283: *punitperpix = 0.125; 3284: } 3285: else if(max <= 100.0){ 3286: *pmaxunit = 100.0; 3287: *pannot = 2; 3288: *pticinc = 10.0; 3289: *ppixperunit = 6; 3290: *pticpixlen = 60; 3291: *punitperpix = 0.1666; 3292: } 3293: else if(max <= 120.0){ 3294: *pmaxunit = 120.0; 3295: *pannot = 2; 3296: *pticinc = 10.0; 3297: *ppixperunit = 5; 3298: *pticpixlen = 50; 3299: *punitperpix = 0.2000; 3300: } 3301: else if(max <= 150.0){ 3302: *pmaxunit = 150.0; 3303: *pannot = 2; 3304: *pticinc = 25.0; 3305: *ppixperunit = 4; 3306: *pticpixlen = 100; 3307: *punitperpix = 0.2500; 3308: } 3309: else if(max <= 200.0){ 3310: *pmaxunit = 200.0; 3311: *pannot = 2; 3312: *pticinc = 25.0; 3313: *ppixperunit = 3; 3314: *pticpixlen = 75; 3315: *punitperpix = 0.3333; 3316: } 3317: else if(max <= 300.0){ 3318: *pmaxunit = 300.0; 3319: *pannot = 2; 3320: *pticinc = 50.0; 3321: *ppixperunit = 2; 3322: *pticpixlen = 100; 3323: *punitperpix = 0.5000; 3324: } 3325: else if(max <= 600.0){ 3326: *pmaxunit = 600.0; 3327: *pannot = 1; 3328: *pticinc = 100; 3329: *ppixperunit = 1; 3330: *pticpixlen = 100; 3331: *punitperpix = 1.000; 3332: } 3333: else { 3334: *pmaxunit = max; 3335: *pannot = 1; 3336: *pticinc = 100.0; 3337: check = *pmaxunit/(*pticinc); 3338: fract = modf(check, &ip); 3339: if(fract == 0.0){ 3340: } 3341: else { 3342: *pmaxunit = (ip * (*pticinc)) + (*pticinc); 3343: } 3344: check = axispixlen/(*pmaxunit); 3345: fract = modf(check, &ip); 3346: *ppixperunit = ip; 3347: 3348: *pticpixlen = *ppixperunit * (*pticinc); 3349: check = *ppixperunit; 3350: *punitperpix = 1.0/check; 3351: } 3352: } 3353: 3354: void PlaceDialog(w, where) 3355: Widget w; 3356: int where; 3357: { 3358: Dimension wwidth, wheight; 3359: Position x, y; 3360: 3361: XtVaGetValues(w, XmNwidth, &wwidth, XmNheight, &wheight, NULL); 3362: 3363: if(where == TOPLEFT) { 3364: x = 20; 3365: y = 20; 3366: } 3367: else if(where == BOTLEFT) { 3368: x = 10; 3369: y = (int)HeightOfScreen(XtScreen(w)) - (int)wheight - 20; 3370: } 3371: else if(where == TOPRIGHT) { 3372: y = 20; 3373: x = (int)WidthOfScreen(XtScreen(w)) - (int)wwidth - 10; 3374: } 3375: else if(where == BOTRIGHT) { 3376: x = (int)WidthOfScreen(XtScreen(w)) - (int)wwidth - 10; 3377: y = (int)HeightOfScreen(XtScreen(w)) - (int)wheight - 10; 3378: } 3379: else { 3380: x = 20; 3381: y = 20; 3382: } 3383: 3384: XtVaSetValues(w, XmNx, x, XmNy, y, NULL); 3385: } 3386: 3387: void MapStratToAffine() 3388: { 3389: int i, j, k, l, m; 3390: char holename[2]; 3391: 3392: /* find if the datum is in the affine table 3393: */ 3394: for( i=0; i<strat_file_cnt; ++i) { 3395: for(j=0; j<strat[i]->data_cnt; ++j) { 3396: strat[i]->data[j].hole_is_in_dataset = NO; 3397: strat[i]->data[j].top.in_affine = NO; 3398: strat[i]->data[j].bot.in_affine = NO; 3399: strat[i]->data[j].top.aff_map_hole = -1; 3400: strat[i]->data[j].top.aff_map_core = -1; 3401: strat[i]->data[j].bot.aff_map_hole = -1; 3402: strat[i]->data[j].bot.aff_map_core = -1; 3403: for(k=0; k<affinetable.numhole; ++k) { 3404: (void)sprintf(holename,"%c", strat[i]->data[j].top.hole); 3405: if(strcmp(holename, affinetable.hole[k].name) == 0) { 3406: strat[i]->data[j].top.aff_map_hole = k; 3407: strat[i]->data[j].bot.aff_map_hole = k; 3408: for(m=0; m<data[dset]->numholes; ++m) { 3409: if(strat[i]->data[j].top.hole == data[dset]->holes[m]->name) { 3410: strat[i]->data[j].hole_is_in_dataset = YES; 3411: } 3412: } 3413: for(l=0; l<affinetable.hole[k].numcore; ++l) { 3414: if(strat[i]->data[j].top.core == affinetable.hole[k].core[l].name) { 3415: strat[i]->data[j].top.in_affine = YES; 3416: strat[i]->data[j].top.aff_map_core = l; 3417: } 3418: if(strat[i]->data[j].bot.core == affinetable.hole[k].core[l].name) { 3419: strat[i]->data[j].bot.in_affine = YES; 3420: strat[i]->data[j].bot.aff_map_core = l; 3421: } 3422: } 3423: } 3424: } 3425: } 3426: } 3427: 3428: (void)sprintf(holename, ""); 3429: } 3430: 3431: void FindStratDepthOffset() 3432: { 3433: int i, j; 3434: 3435: /* set the strat cum depth offset 3436: 3437: use the following rules for whether to use strat: 3438: 3439: if the affine table does not contain the hole of datum; 3440: dont'-can't use datum 3441: if the affine table does not have the core(s) for both the top and bot of datum; 3442: ? 3443: if the affine table has the core for the top of datum but not the bot; 3444: use the top offset for bot; 3445: if the affine table has the core for the bot of datum but not the top; 3446: use the bot offset for top; 3447: */ 3448: 3449: for( i=0; i<strat_file_cnt; ++i) { 3450: for(j=0; j<strat[i]->data_cnt; ++j) { 3451: if(strat[i]->data[j].top.in_affine == YES && strat[i]->data[j].bot.in_affine == YES) { 3452: strat[i]->data[j].top.offset = affinetable.hole[strat[i]->data[j].top.aff_map_hole].core[strat[i]->data[j].top.aff_map_core].cum_depth_offset; 3453: strat[i]->data[j].bot.offset = affinetable.hole[strat[i]->data[j].bot.aff_map_hole].core[strat[i]->data[j].bot.aff_map_core].cum_depth_offset; 3454: } 3455: else if(strat[i]->data[j].top.in_affine == YES && strat[i]->data[j].bot.in_affine == NO) { 3456: strat[i]->data[j].top.offset = affinetable.hole[strat[i]->data[j].top.aff_map_hole].core[strat[i]->data[j].top.aff_map_core].cum_depth_offset; 3457: strat[i]->data[j].bot.offset = strat[i]->data[j].top.offset; 3458: } 3459: else if(strat[i]->data[j].top.in_affine == NO && strat[i]->data[j].bot.in_affine == YES) { 3460: strat[i]->data[j].bot.offset = affinetable.hole[strat[i]->data[j].bot.aff_map_hole].core[strat[i]->data[j].bot.aff_map_core].cum_depth_offset; 3461: strat[i]->data[j].top.offset = strat[i]->data[j].bot.offset; 3462: } 3463: else { 3464: strat[i]->data[j].top.offset = 0.0; 3465: strat[i]->data[j].bot.offset = 0.0; 3466: } 3467: 3468: strat[i]->data[j].aveage = (strat[i]->data[j].bot_age + strat[i]->data[j].top_age)/2.0; 3469: strat[i]->data[j].avembsf = (strat[i]->data[j].bot.sb_depth + strat[i]->data[j].top.sb_depth)/2.0; 3470: strat[i]->data[j].avemcd = (strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset + 3471: strat[i]->data[j].top.sb_depth + strat[i]->data[j].top.offset)/2.0; 3472: } 3473: } 3474: } 3475: 3476: void AgeDepthMinMax() 3477: { 3478: int i, j, scalemax; 3479: 3480: if(have_strat == DO) { 3481: maxagedepdepth = 0.0; 3482: maxagedepage = 0.0; 3483: for(i=0; i<strat_file_cnt; ++i) { 3484: for(j=0; j<strat[i]->data_cnt; ++j) { 3485: if(strat[i]->data[j].top.in_affine == YES || strat[i]->data[j].bot.in_affine == YES) { 3486: if(strat[i]->data[j].bot.sb_depth > maxagedepdepth) { 3487: maxagedepdepth = strat[i]->data[j].bot.sb_depth; 3488: } 3489: if(strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset > maxagedepdepth) { 3490: maxagedepdepth = strat[i]->data[j].bot.sb_depth + strat[i]->data[j].bot.offset; 3491: } 3492: if(strat[i]->data[j].bot_age > maxagedepage) { 3493: maxagedepage = strat[i]->data[j].bot_age; 3494: } 3495: } 3496: } 3497: } 3498: 3499: /* set the scale bars max 3500: 3501: scalemax = maxagedepdepth + 1; 3502: maxagedepdepth = scalemax; 3503: XtVaSetValues(scaleDrawingAreaAgeDepthDepth, XmNmaximum, scalemax, NULL); 3504: scalemax = maxagedepage + 1; 3505: maxagedepage = scalemax; 3506: XtVaSetValues(scaleDrawingAreaAgeDepthAge, XmNmaximum, scalemax, NULL); 3507: */ 3508: } 3509: } 3510: 3511: void AgeDepthPlotValues(winlen, pmaxvalue, startvalue, pfirsttic, topoffset, botoffset, pleft, pticpixlen, ticlen, ppixperunit) 3512: int winlen, topoffset, botoffset, *pticpixlen, *ppixperunit, *pleft; 3513: float *pmaxvalue, startvalue, *pfirsttic, ticlen; 3514: { 3515: int axispixlen; 3516: double check, fract, ip; 3517: 3518: /* is the length of axis evenly divisiable by tic 3519: if not increase axis length so it is 3520: */ 3521: check = *pmaxvalue/ticlen; 3522: fract = modf(check, &ip); 3523: if(fract == 0.0) { 3524: } 3525: else { 3526: *pmaxvalue = (ip * ticlen) + ticlen; 3527: } 3528: 3529: /* is the top value divisable by tic or is there a remainder 3530: */ 3531: check = startvalue/ticlen; 3532: fract = modf(check, &ip); 3533: 3534: /*if no remainder than axis starts at a tic 3535: and if there is a remainder axis does not start at a tic 3536: and the first tic is the next one down 3537: */ 3538: if(fract == 0.0) { 3539: *pfirsttic = startvalue; 3540: } 3541: else { 3542: *pfirsttic = ticlen * ip + ticlen; 3543: } 3544: 3545: axispixlen = winlen - topoffset - botoffset; 3546: 3547: /* calculate how many pixels in a unit; truncate the result so mult. 3548: units are equal to a pixel value that is a whole number 3549: */ 3550: check = axispixlen/(*pmaxvalue); 3551: fract = modf(check, &ip); 3552: *ppixperunit = ip; 3553: 3554: *pticpixlen = *ppixperunit * ticlen; 3555: 3556: /*if axis does not start at a tic calculate the distance 3557: in pixels from top of axis to first tic 3558: */ 3559: if(*pfirsttic == startvalue) { 3560: *pleft = 0; 3561: } 3562: else { 3563: *pleft = (*pfirsttic - startvalue) * *ppixperunit; 3564: } 3565: 3566: } 3567: 3568: int CalcAge() 3569: { 3570: int i, j, k; 3571: 3572: /* calculate the age of the splice using age model 3573: */ 3574: 3575: /* need at least two datums in age model 3576: because can't calc. sed rate with just one 3577: */ 3578: if(agemodel_cnt <=1) { 3579: return YES; 3580: } 3581: 3582: /* calc the rates of change ddep/dage 3583: */ 3584: agemodel_avesedrate = 0.0; 3585: for(i=0; i<agemodel_cnt-1; ++i) { 3586: agemodel[i].sedrate = (agemodel[i+1].avemcd - agemodel[i].avemcd)/(agemodel[i+1].aveage - agemodel[i].aveage); 3587: agemodel_avesedrate = agemodel_avesedrate + agemodel[i].sedrate; 3588: } 3589: agemodel[agemodel_cnt - 1].sedrate = agemodel[agemodel_cnt -2].sedrate; 3590: agemodel_avesedrate = agemodel_avesedrate/agemodel_cnt; 3591: 3592: for(j=0; j<spcomp.numcores; ++j) { 3593: for(k=0; k<spcomp.numpercore[j]; ++k) { 3594: if(spcomp.sb_depth[j][k] <= agemodel[0].avemcd) { 3595: spcomp.age[j][k] = agemodel[0].aveage - (agemodel[0].avemcd - spcomp.sb_depth[j][k])/agemodel[0].sedrate; 3596: spcomp.sedrate[j][k] = agemodel[0].sedrate; 3597: } 3598: else if(spcomp.sb_depth[j][k] >= agemodel[agemodel_cnt-1].avemcd) { 3599: spcomp.age[j][k] = agemodel[agemodel_cnt-1].aveage - 3600: (agemodel[agemodel_cnt-1].avemcd - spcomp.sb_depth[j][k])/agemodel[agemodel_cnt-1].sedrate; 3601: spcomp.sedrate[j][k] = agemodel[agemodel_cnt-1].sedrate; 3602: } 3603: else { 3604: for(i=0; i<agemodel_cnt-1; ++i) { 3605: if(spcomp.sb_depth[j][k] >= agemodel[i].avemcd && spcomp.sb_depth[j][k] <= agemodel[i+1].avemcd) { 3606: spcomp.age[j][k] = agemodel[i].aveage - (agemodel[i].avemcd - spcomp.sb_depth[j][k])/agemodel[i].sedrate; 3607: spcomp.sedrate[j][k] = agemodel[i].sedrate; 3608: } 3609: } 3610: } 3611: } 3612: } 3613: 3614: return NO; 3615: } 3616: 3617: int GetColorSet() 3618: { 3619: int i; 3620: 3621: if(colorset == EARTH_COLORSET) { 3622: (void)strcpy(color[BG_COLOR],"NavajoWhite"); 3623: (void)strcpy(color[LABEL_COLOR],"brown"); 3624: (void)strcpy(color[MBSF_COLOR],"SlateGray"); 3625: (void)strcpy(color[MCD_COLOR],"DarkOliveGreen"); 3626: (void)strcpy(color[SMOOTH_COLOR],"gray"); 3627: (void)strcpy(color[SPLICE_COLOR],"SkyBlue"); 3628: (void)strcpy(color[SPLICELOCATION_COLOR],"sienna"); 3629: (void)strcpy(color[TIEPTFIXED_COLOR],"red"); 3630: (void)strcpy(color[TIEPTSHIFT_COLOR],"green"); 3631: (void)strcpy(color[TIELINE_COLOR],"tomato"); 3632: (void)strcpy(color[OVERLAYINCORR_COLOR],"red"); 3633: (void)strcpy(color[OVERLAYOUTCORR_COLOR],"pink"); 3634: (void)strcpy(color[PALEOMAG_COLOR],"blue"); 3635: (void)strcpy(color[DIATOM_COLOR],"SpringGreen"); 3636: (void)strcpy(color[RAD_COLOR],"white"); 3637: (void)strcpy(color[FORAM_COLOR],"HotPink"); 3638: (void)strcpy(color[NANNO_COLOR],"brown"); 3639: (void)strcpy(color[CORRCOEF_COLOR],"ForestGreen"); 3640: (void)strcpy(color[BESTCORR_COLOR],"yellow"); 3641: (void)strcpy(color[DEPOFFLINE_COLOR],"black"); 3642: (void)strcpy(color[DEPOFFHOLE1_COLOR],"white"); 3643: (void)strcpy(color[DEPOFFHOLE2_COLOR],"green"); 3644: (void)strcpy(color[DEPOFFHOLE3_COLOR],"blue"); 3645: (void)strcpy(color[DEPOFFHOLE4_COLOR],"red"); 3646: (void)strcpy(color[DEPOFFHOLE5_COLOR],"orange"); 3647: (void)strcpy(color[DEPOFFHOLE6_COLOR],"brown"); 3648: (void)strcpy(color[DEPOFFHOLE7_COLOR],"violet"); 3649: (void)strcpy(color[DEPOFFHOLE8_COLOR],"pink"); 3650: (void)strcpy(color[DEPOFFHOLE9_COLOR],"DarkGreen"); 3651: (void)strcpy(color[DEPOFFHOLE10_COLOR],"MidnightBlue"); 3652: (void)strcpy(color[DEPOFFHOLE11_COLOR],"PowderBlue"); 3653: (void)strcpy(color[AGEDEPHANDPICK_COLOR], "orchid"); 3654: (void)strcpy(color[AGEDEPLINE_COLOR], "black"); 3655: (void)strcpy(color[SEDRATE_COLOR], "green"); 3656: (void)strcpy(color[DATUMLOC_COLOR], "burlywood"); 3657: (void)strcpy(color[TIMESERIES_COLOR], "salmon"); 3658: } 3659: else if(colorset == CORPORATE_COLORSET) { 3660: (void)strcpy(color[BG_COLOR],"gainsboro"); 3661: (void)strcpy(color[LABEL_COLOR],"black"); 3662: (void)strcpy(color[MBSF_COLOR],"ForestGreen"); 3663: (void)strcpy(color[MCD_COLOR],"blue"); 3664: (void)strcpy(color[SMOOTH_COLOR],"peru"); 3665: (void)strcpy(color[SPLICE_COLOR],"black"); 3666: (void)strcpy(color[SPLICELOCATION_COLOR],"yellow"); 3667: (void)strcpy(color[TIEPTFIXED_COLOR],"red"); 3668: (void)strcpy(color[TIEPTSHIFT_COLOR],"green"); 3669: (void)strcpy(color[TIELINE_COLOR],"purple"); 3670: (void)strcpy(color[OVERLAYINCORR_COLOR],"red"); 3671: (void)strcpy(color[OVERLAYOUTCORR_COLOR],"LightPink"); 3672: (void)strcpy(color[PALEOMAG_COLOR],"red"); 3673: (void)strcpy(color[DIATOM_COLOR],"white"); 3674: (void)strcpy(color[RAD_COLOR],"DarkSeaGreen"); 3675: (void)strcpy(color[FORAM_COLOR],"DeepPink"); 3676: (void)strcpy(color[NANNO_COLOR],"DarkSlateBlue"); 3677: (void)strcpy(color[CORRCOEF_COLOR],"red"); 3678: (void)strcpy(color[BESTCORR_COLOR],"yellow"); 3679: (void)strcpy(color[DEPOFFLINE_COLOR],"black"); 3680: (void)strcpy(color[DEPOFFHOLE1_COLOR],"blue"); 3681: (void)strcpy(color[DEPOFFHOLE2_COLOR],"green"); 3682: (void)strcpy(color[DEPOFFHOLE3_COLOR],"yellow"); 3683: (void)strcpy(color[DEPOFFHOLE4_COLOR],"red"); 3684: (void)strcpy(color[DEPOFFHOLE5_COLOR],"orange"); 3685: (void)strcpy(color[DEPOFFHOLE6_COLOR],"purple"); 3686: (void)strcpy(color[DEPOFFHOLE7_COLOR],"brown"); 3687: (void)strcpy(color[DEPOFFHOLE8_COLOR],"gold"); 3688: (void)strcpy(color[DEPOFFHOLE9_COLOR],"violet"); 3689: (void)strcpy(color[DEPOFFHOLE10_COLOR],"darkgreen"); 3690: (void)strcpy(color[DEPOFFHOLE11_COLOR],"DarkKhaki"); 3691: (void)strcpy(color[AGEDEPHANDPICK_COLOR], "purple"); 3692: (void)strcpy(color[AGEDEPLINE_COLOR], "brown"); 3693: (void)strcpy(color[SEDRATE_COLOR], "tomato"); 3694: (void)strcpy(color[DATUMLOC_COLOR], "burlywood"); 3695: (void)strcpy(color[TIMESERIES_COLOR], "ForestGreen"); 3696: } 3697: else if(colorset == MARITIME_COLORSET) { 3698: (void)strcpy(color[BG_COLOR],"black"); 3699: (void)strcpy(color[LABEL_COLOR],"white"); 3700: (void)strcpy(color[MBSF_COLOR],"yellow"); 3701: (void)strcpy(color[MCD_COLOR],"green"); 3702: (void)strcpy(color[SMOOTH_COLOR],"pink"); 3703: (void)strcpy(color[SPLICE_COLOR],"turquoise"); 3704: (void)strcpy(color[SPLICELOCATION_COLOR],"white"); 3705: (void)strcpy(color[TIEPTFIXED_COLOR],"red"); 3706: (void)strcpy(color[TIEPTSHIFT_COLOR],"green"); 3707: (void)strcpy(color[TIELINE_COLOR],"orange"); 3708: (void)strcpy(color[OVERLAYINCORR_COLOR],"turquoise"); 3709: (void)strcpy(color[OVERLAYOUTCORR_COLOR],"green"); 3710: (void)strcpy(color[PALEOMAG_COLOR],"red"); 3711: (void)strcpy(color[DIATOM_COLOR],"limegreen"); 3712: (void)strcpy(color[RAD_COLOR],"white"); 3713: (void)strcpy(color[FORAM_COLOR],"pink"); 3714: (void)strcpy(color[NANNO_COLOR],"lightblue"); 3715: (void)strcpy(color[CORRCOEF_COLOR],"lightblue"); 3716: (void)strcpy(color[BESTCORR_COLOR],"yellow"); 3717: (void)strcpy(color[DEPOFFLINE_COLOR],"white"); 3718: (void)strcpy(color[DEPOFFHOLE1_COLOR],"pink"); 3719: (void)strcpy(color[DEPOFFHOLE2_COLOR],"green"); 3720: (void)strcpy(color[DEPOFFHOLE3_COLOR],"yellow"); 3721: (void)strcpy(color[DEPOFFHOLE4_COLOR],"blue"); 3722: (void)strcpy(color[DEPOFFHOLE5_COLOR],"orange"); 3723: (void)strcpy(color[DEPOFFHOLE6_COLOR],"violet"); 3724: (void)strcpy(color[DEPOFFHOLE7_COLOR],"red"); 3725: (void)strcpy(color[DEPOFFHOLE8_COLOR],"brown"); 3726: (void)strcpy(color[DEPOFFHOLE9_COLOR],"turquoise"); 3727: (void)strcpy(color[DEPOFFHOLE10_COLOR],"darkgreen"); 3728: (void)strcpy(color[DEPOFFHOLE11_COLOR],"lightblue"); 3729: (void)strcpy(color[AGEDEPHANDPICK_COLOR],"yellow"); 3730: (void)strcpy(color[AGEDEPLINE_COLOR], "red"); 3731: (void)strcpy(color[SEDRATE_COLOR], "green"); 3732: (void)strcpy(color[DATUMLOC_COLOR], "yellow"); 3733: (void)strcpy(color[TIMESERIES_COLOR], "red"); 3734: } 3735: else if(colorset == ODP_COLORSET) { 3736: (void)strcpy(color[BG_COLOR],"black"); 3737: (void)strcpy(color[LABEL_COLOR],"white"); 3738: (void)strcpy(color[MBSF_COLOR],"gold"); 3739: (void)strcpy(color[MCD_COLOR],"DodgerBlue"); 3740: (void)strcpy(color[SMOOTH_COLOR],"khaki"); 3741: (void)strcpy(color[SPLICE_COLOR],"DodgerBlue"); 3742: (void)strcpy(color[SPLICELOCATION_COLOR],"aquamarine"); 3743: (void)strcpy(color[TIEPTFIXED_COLOR],"red"); 3744: (void)strcpy(color[TIEPTSHIFT_COLOR],"green"); 3745: (void)strcpy(color[TIELINE_COLOR],"DarkOrange"); 3746: (void)strcpy(color[OVERLAYINCORR_COLOR],"LemonChiffon"); 3747: (void)strcpy(color[OVERLAYOUTCORR_COLOR],"coral"); 3748: (void)strcpy(color[PALEOMAG_COLOR],"red"); 3749: (void)strcpy(color[DIATOM_COLOR],"GreenYellow"); 3750: (void)strcpy(color[RAD_COLOR],"white"); 3751: (void)strcpy(color[FORAM_COLOR],"DarkOrange"); 3752: (void)strcpy(color[NANNO_COLOR],"turquoise"); 3753: (void)strcpy(color[CORRCOEF_COLOR],"LightSkyBlue"); 3754: (void)strcpy(color[BESTCORR_COLOR],"yellow"); 3755: (void)strcpy(color[DEPOFFLINE_COLOR],"white"); 3756: (void)strcpy(color[DEPOFFHOLE1_COLOR],"pink"); 3757: (void)strcpy(color[DEPOFFHOLE2_COLOR],"green"); 3758: (void)strcpy(color[DEPOFFHOLE3_COLOR],"yellow"); 3759: (void)strcpy(color[DEPOFFHOLE4_COLOR],"blue"); 3760: (void)strcpy(color[DEPOFFHOLE5_COLOR],"orange"); 3761: (void)strcpy(color[DEPOFFHOLE6_COLOR],"violet"); 3762: (void)strcpy(color[DEPOFFHOLE7_COLOR],"red"); 3763: (void)strcpy(color[DEPOFFHOLE8_COLOR],"brown"); 3764: (void)strcpy(color[DEPOFFHOLE9_COLOR],"turquoise"); 3765: (void)strcpy(color[DEPOFFHOLE10_COLOR],"DarkGreen"); 3766: (void)strcpy(color[DEPOFFHOLE11_COLOR],"lightBlue"); 3767: (void)strcpy(color[AGEDEPHANDPICK_COLOR], "yellow"); 3768: (void)strcpy(color[AGEDEPLINE_COLOR], "red"); 3769: (void)strcpy(color[SEDRATE_COLOR], "green"); 3770: (void)strcpy(color[DATUMLOC_COLOR], "yellow"); 3771: (void)strcpy(color[TIMESERIES_COLOR], "DarkOrange"); 3772: } 3773: else if(colorset == SANTAFE_COLORSET) { 3774: (void)strcpy(color[BG_COLOR],"IndianRed"); 3775: (void)strcpy(color[LABEL_COLOR],"black"); 3776: (void)strcpy(color[MBSF_COLOR],"DarkGreen"); 3777: (void)strcpy(color[MCD_COLOR],"SteelBlue"); 3778: (void)strcpy(color[SMOOTH_COLOR],"MistyRose"); 3779: (void)strcpy(color[SPLICE_COLOR],"HotPink"); 3780: (void)strcpy(color[SPLICELOCATION_COLOR],"yellow"); 3781: (void)strcpy(color[TIEPTFIXED_COLOR],"red"); 3782: (void)strcpy(color[TIEPTSHIFT_COLOR],"green"); 3783: (void)strcpy(color[TIELINE_COLOR],"purple"); 3784: (void)strcpy(color[OVERLAYINCORR_COLOR],"red"); 3785: (void)strcpy(color[OVERLAYOUTCORR_COLOR],"LightPink"); 3786: (void)strcpy(color[PALEOMAG_COLOR],"red"); 3787: (void)strcpy(color[DIATOM_COLOR],"white"); 3788: (void)strcpy(color[RAD_COLOR],"DarkSeaGreen"); 3789: (void)strcpy(color[FORAM_COLOR],"DeepPink"); 3790: (void)strcpy(color[NANNO_COLOR],"CornflowerBlue"); 3791: (void)strcpy(color[CORRCOEF_COLOR],"blue"); 3792: (void)strcpy(color[BESTCORR_COLOR],"yellow"); 3793: (void)strcpy(color[DEPOFFLINE_COLOR],"black"); 3794: (void)strcpy(color[DEPOFFHOLE1_COLOR],"DarkTurquoise"); 3795: (void)strcpy(color[DEPOFFHOLE2_COLOR],"LimeGreen"); 3796: (void)strcpy(color[DEPOFFHOLE3_COLOR],"yellow"); 3797: (void)strcpy(color[DEPOFFHOLE4_COLOR],"blue"); 3798: (void)strcpy(color[DEPOFFHOLE5_COLOR],"orange"); 3799: (void)strcpy(color[DEPOFFHOLE6_COLOR],"violet"); 3800: (void)strcpy(color[DEPOFFHOLE7_COLOR],"red"); 3801: (void)strcpy(color[DEPOFFHOLE8_COLOR],"brown"); 3802: (void)strcpy(color[DEPOFFHOLE9_COLOR],"purple"); 3803: (void)strcpy(color[DEPOFFHOLE10_COLOR],"darkgreen"); 3804: (void)strcpy(color[DEPOFFHOLE11_COLOR],"DarkKhaki"); 3805: (void)strcpy(color[AGEDEPHANDPICK_COLOR], "yellow"); 3806: (void)strcpy(color[AGEDEPLINE_COLOR], "black"); 3807: (void)strcpy(color[SEDRATE_COLOR], "MediumSeaGreen"); 3808: (void)strcpy(color[DATUMLOC_COLOR], "gold"); 3809: (void)strcpy(color[TIMESERIES_COLOR], "turquoise"); 3810: } 3811: else if(colorset == CUSTOME_COLORSET) { 3812: for(i=0; i<NCOLOR; ++i) { 3813: (void)sprintf(color[i], ""); 3814: (void)strcpy(color[i], cust_color[i]); 3815: } 3816: } 3817: else { 3818: 3819: } 3820: } 3821: 3822: void SetColorSetBGandFG() 3823: { 3824: Pixel fgP, bgP; 3825: 3826: /* get the custom color dialog's foreground and background colors 3827: */ 3828: XtVaGetValues(formSetColor, XmNbackground, &bgP, NULL); 3829: XtVaGetValues(formSetColor, XmNforeground, &fgP, NULL); 3830: 3831: /* set all the color set buttons to the parents background and 3832: foreground colors 3833: */ 3834: XtVaSetValues(pushButtonColorSetEarth, XmNbackground, bgP, NULL); 3835: XtVaSetValues(pushButtonColorSetCorporate, XmNbackground, bgP, NULL); 3836: XtVaSetValues(pushButtonColorSetMaritime, XmNbackground, bgP, NULL); 3837: XtVaSetValues(pushButtonColorSetSantaFe, XmNbackground, bgP, NULL); 3838: XtVaSetValues(pushButtonColorSetODP, XmNbackground, bgP, NULL); 3839: XtVaSetValues(pushButtonColorSetCustome, XmNbackground, bgP, NULL); 3840: XtVaSetValues(pushButtonColorSetEarth, XmNforeground, fgP, NULL); 3841: XtVaSetValues(pushButtonColorSetCorporate, XmNforeground, fgP, NULL); 3842: XtVaSetValues(pushButtonColorSetMaritime, XmNforeground, fgP, NULL); 3843: XtVaSetValues(pushButtonColorSetSantaFe, XmNforeground, fgP, NULL); 3844: XtVaSetValues(pushButtonColorSetODP, XmNforeground, fgP, NULL); 3845: XtVaSetValues(pushButtonColorSetCustome, XmNforeground, fgP, NULL); 3846: 3847: /* now set the background color of button of current colorset using 3848: to the drawingarea background color abd the button label colors 3849: to the general label color 3850: */ 3851: if(colorset == EARTH_COLORSET) { 3852: XtVaSetValues(pushButtonColorSetEarth, XmNbackground, bgPixel, NULL); 3853: XtVaSetValues(pushButtonColorSetEarth, XmNforeground, fgPixel[LABEL_COLOR], NULL); 3854: } 3855: else if(colorset == CORPORATE_COLORSET) { 3856: XtVaSetValues(pushButtonColorSetCorporate, XmNbackground, bgPixel, NULL); 3857: XtVaSetValues(pushButtonColorSetCorporate, XmNforeground, fgPixel[LABEL_COLOR], NULL); 3858: } 3859: else if(colorset == MARITIME_COLORSET) { 3860: XtVaSetValues(pushButtonColorSetMaritime, XmNbackground, bgPixel, NULL); 3861: XtVaSetValues(pushButtonColorSetMaritime, XmNforeground, fgPixel[LABEL_COLOR], NULL); 3862: } 3863: else if(colorset == SANTAFE_COLORSET) { 3864: XtVaSetValues(pushButtonColorSetSantaFe, XmNbackground, bgPixel, NULL); 3865: XtVaSetValues(pushButtonColorSetSantaFe, XmNforeground, fgPixel[LABEL_COLOR], NULL); 3866: } 3867: else if(colorset == ODP_COLORSET) { 3868: XtVaSetValues(pushButtonColorSetODP, XmNbackground, bgPixel, NULL); 3869: XtVaSetValues(pushButtonColorSetODP, XmNforeground, fgPixel[LABEL_COLOR], NULL); 3870: } 3871: else if(colorset == CUSTOME_COLORSET) { 3872: XtVaSetValues(pushButtonColorSetCustome, XmNbackground, bgPixel, NULL); 3873: XtVaSetValues(pushButtonColorSetCustome, XmNforeground, fgPixel[LABEL_COLOR], NULL); 3874: } 3875: } 3876: 3877: int FindSpliceAveAge(pdt) 3878: float *pdt; 3879: { 3880: int i, j, n; 3881: float sumaveage; 3882: 3883: n = 0; 3884: sumaveage = 0.0; 3885: for(i=0; i<spcomp.numcores; ++i) { 3886: for(j=0; j<spcomp.numpercore[i]-1; ++j) { 3887: sumaveage = sumaveage + spcomp.age[i][j+1] - spcomp.age[i][j]; 3888: ++n; 3889: } 3890: } 3891: if(n > 0 && sumaveage > 0.0) { 3892: *pdt = sumaveage/n; 3893: } 3894: else { 3895: (void)sprintf(buffer,"Warning: could not calculate the average time step for this data set."); 3896: SpManageWarningBox(buffer); 3897: } 3898: return 0; 3899: } 3900: 3901: int InterpolateTiePtValue(n, depth, value, targetdep, intval, place) 3902: int n, *place; 3903: float *depth, *value, targetdep, *intval; 3904: { 3905: int i; 3906: 3907: /* depth type not important 3908: */ 3909: 3910: if(targetdep < depth[0] || targetdep > depth[n-1]) { 3911: } 3912: else { 3913: *place = -1; 3914: if(n > 1) { 3915: for(i=0; i<n-1; ++i) { 3916: if(targetdep >= depth[i] && targetdep <= depth[i+1]) { 3917: *intval = value[i] + (value[i+1] - value[i])/(depth[i+1] - depth[i]) * (targetdep - depth[i]); 3918: *place = i; 3919: break; 3920: } 3921: } 3922: } 3923: if(*place != -1) { 3924: return 0; 3925: } 3926: } 3927: return 1; 3928: } 3929: 3930: int XAxisTimeCorrSetup(lead, dt, len, tic, ntic, perpix, max) 3931: int lead; 3932: float dt; 3933: int *len; 3934: float *tic; 3935: int *ntic; 3936: float *perpix; 3937: float *max; 3938: { 3939: float leadlagmyrs; 3940: double fract, check, ip; 3941: String str; 3942: 3943: str= XmTextGetString(textFieldSpliceToAgeLeadLag); 3944: leadlagmyrs = atof(str); 3945: XtFree(str); 3946: 3947: check = *len; 3948: if(leadlagmyrs <= 0.01){ 3949: fract = modf((check/5.0), &ip); 3950: if(fract == 0.0){ 3951: } 3952: else if(fract < 0.5){ 3953: *len = ip * 5.0; 3954: } 3955: else { 3956: *len = (ip * 5.0) + 5.0; 3957: } 3958: *tic=0.002; 3959: *ntic=10; 3960: *perpix=0.01/(*len); 3961: *max=0.01; 3962: } 3963: else if(leadlagmyrs <= 0.02){ 3964: fract = modf((check/4.0), &ip); 3965: if(fract == 0.0){ 3966: } 3967: else if(fract < 0.5){ 3968: *len = ip * 4.0; 3969: } 3970: else { 3971: *len = (ip * 4.0) + 4.0; 3972: } 3973: *tic=0.005; 3974: *ntic=8; 3975: *perpix=0.02/(*len); 3976: *max=0.02; 3977: } 3978: else if(leadlagmyrs <= 0.03){ 3979: fract = modf((check/6.0), &ip); 3980: if(fract == 0.0){ 3981: } 3982: else if(fract < 0.5){ 3983: *len = ip * 6.0; 3984: } 3985: else { 3986: *len = (ip * 6.0) + 6.0; 3987: } 3988: *tic=0.005; 3989: *ntic=12; 3990: *perpix=0.03/(*len); 3991: *max=0.03; 3992: } 3993: else if(leadlagmyrs <= 0.04){ 3994: fract = modf((check/4.0), &ip); 3995: if(fract == 0.0){ 3996: } 3997: else if(fract < 0.5){ 3998: *len = ip * 4.0; 3999: } 4000: else { 4001: *len = (ip * 4.0) + 4.0; 4002: } 4003: *tic=0.01; 4004: *ntic=8; 4005: *perpix=0.04/(*len); 4006: *max=0.04; 4007: } 4008: else if(leadlagmyrs <= 0.05){ 4009: fract = modf((check/5.0), &ip); 4010: if(fract == 0.0){ 4011: } 4012: else if(fract < 0.5){ 4013: *len = ip * 5.0; 4014: } 4015: else { 4016: *len = (ip * 5.0) + 5.0; 4017: } 4018: *tic=0.01; 4019: *ntic=10; 4020: *perpix=0.05/(*len); 4021: *max=0.05; 4022: } 4023: else if(leadlagmyrs <= 0.06){ 4024: fract = modf((check/3.0), &ip); 4025: if(fract == 0.0){ 4026: } 4027: else if(fract < 0.5){ 4028: *len = ip * 3.0; 4029: } 4030: else { 4031: *len = (ip * 3.0) + 3.0; 4032: } 4033: *tic=0.02; 4034: *ntic=6; 4035: *perpix=0.05/(*len); 4036: *max=0.05; 4037: } 4038: /* 4039: else if(leadlagmyrs <= 0.07){ 4040: fract = modf((check/5.0), &ip); 4041: if(fract == 0.0){ 4042: } 4043: else if(fract < 0.5){ 4044: *len = ip * 5.0; 4045: } 4046: else { 4047: *len = (ip * 5.0) + 5.0; 4048: } 4049: *tic=1.0; 4050: *ntic=10; 4051: *perpix=5.0/(*len); 4052: *max=5.0; 4053: } 4054: else if(leadlagmyrs <= 0.08){ 4055: fract = modf((check/5.0), &ip); 4056: if(fract == 0.0){ 4057: } 4058: else if(fract < 0.5){ 4059: *len = ip * 5.0; 4060: } 4061: else { 4062: *len = (ip * 5.0) + 5.0; 4063: } 4064: *tic=1.0; 4065: *ntic=10; 4066: *perpix=5.0/(*len); 4067: *max=5.0; 4068: } 4069: else if(leadlagmyrs <= 0.09){ 4070: fract = modf((check/5.0), &ip); 4071: if(fract == 0.0){ 4072: } 4073: else if(fract < 0.5){ 4074: *len = ip * 5.0; 4075: } 4076: else { 4077: *len = (ip * 5.0) + 5.0; 4078: } 4079: *tic=1.0; 4080: *ntic=10; 4081: *perpix=5.0/(*len); 4082: *max=5.0; 4083: } 4084: else if(leadlagmyrs <= 0.1){ 4085: fract = modf((check/5.0), &ip); 4086: if(fract == 0.0){ 4087: } 4088: else if(fract < 0.5){ 4089: *len = ip * 5.0; 4090: } 4091: else { 4092: *len = (ip * 5.0) + 5.0; 4093: } 4094: *tic=1.0; 4095: *ntic=10; 4096: *perpix=5.0/(*len); 4097: *max=5.0; 4098: } 4099: else if(leadlagmyrs > 0.1 && leadlagmyrs <= 0.25){ 4100: fract = modf((check/5.0), &ip); 4101: if(fract == 0.0){ 4102: } 4103: else if(fract < 0.5){ 4104: *len = ip * 5.0; 4105: } 4106: else { 4107: *len = (ip * 5.0) + 5.0; 4108: } 4109: *tic=1.0; 4110: *ntic=10; 4111: *perpix=5.0/(*len); 4112: *max=5.0; 4113: } 4114: else if(leadlagmyrs > 0.25 && leadlagmyrs <= 0.5){ 4115: fract = modf((check/5.0), &ip); 4116: if(fract == 0.0){ 4117: } 4118: else if(fract < 0.5){ 4119: *len = ip * 5.0; 4120: } 4121: else { 4122: *len = (ip * 5.0) + 5.0; 4123: } 4124: *tic=1.0; 4125: *ntic=10; 4126: *perpix=5.0/(*len); 4127: *max=5.0; 4128: } 4129: else if(leadlagmyrs <= 1.0){ 4130: fract = modf((check/5.0), &ip); 4131: if(fract == 0.0){ 4132: } 4133: else if(fract < 0.5){ 4134: *len = ip * 5.0; 4135: } 4136: else { 4137: *len = (ip * 5.0) + 5.0; 4138: } 4139: *tic=1.0; 4140: *ntic=10; 4141: *perpix=5.0/(*len); 4142: *max=5.0; 4143: } 4144: */ 4145: else { 4146: return 1; 4147: } 4148: 4149: return 0; 4150: } 4151: