From 5cfdc8fc60e6e2729f7ec6752916edc06b408984 Mon Sep 17 00:00:00 2001 From: joye Date: Thu, 5 Sep 2013 18:55:38 +0000 Subject: *** empty log message *** --- src/bltGrAxis.C | 208 ----------------------------- src/bltGrBind.C | 22 --- src/bltGrElemLine.C | 124 +---------------- src/bltGrLegd.C | 103 -------------- src/bltGrMarker.C | 204 ---------------------------- src/bltGrMisc.C | 377 ---------------------------------------------------- src/bltGrPSOutput.C | 3 - src/bltGrText.C | 2 - src/bltGraph.C | 47 ------- src/bltSwitch.C | 16 --- 10 files changed, 1 insertion(+), 1105 deletions(-) diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index 34fd676..57821ee 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -2136,18 +2136,12 @@ AxisOffsets( if (axisPtr->lineWidth > 0) { tickLabel -= axisPtr->tickLength; } -#ifdef notdef - fprintf(stderr, "axisLine=%d, axisPad=%d plotBW=%d axisPtr->lineWidth/2=%d\n", axisLine, axisPad, graphPtr->plotBW, axisPtr->lineWidth /2 ); -#endif } else { if (graphPtr->plotRelief == TK_RELIEF_SOLID) { axisLine--; } axisLine -= axisPad + axisPtr->lineWidth / 2; tickLabel = graphPtr->top - graphPtr->plotBW - 2; -#ifdef notdef - fprintf(stderr, "axisLine=%d, axisPad=%d plotBW=%d axisPtr->lineWidth/2=%d\n", axisLine, axisPad, graphPtr->plotBW, axisPtr->lineWidth /2 ); -#endif } mark = graphPtr->top - offset - pad; axisPtr->tickAnchor = TK_ANCHOR_S; @@ -5565,208 +5559,6 @@ Blt_MakeAxisTag(Graph *graphPtr, const char *tagName) static void TimeScaleAxis(Axis *axisPtr, double min, double max) { -#ifdef notdef - double step; - double tickMin, tickMax; - double axisMin, axisMax; - unsigned int nTicks; - - range = max - min; - - -#define SECONDS_MIN (60) -#define SECONDS_HOUR (SECONDS_MIN * 60) -#define SECONDS_DAY (SECONDS_HOUR * 24) -#define SECONDS_MONTH (SECONDS_DAY * 30) -#define SECONDS_YEAR (SECONDS_MONTH * 12) - div = nTicks - 1; - if (range > (SECONDS_MONTH * 6 * div)) { - unit = TICK_YEAR; - } else if (range > (SECONDS_MONTH * 3 * div)) { - unit = TICKS_6MONTH; - first = timefloor(min, unit); - last = timeceil(max, unit); - } else if (range > (SECONDS_MONTH * 2 * div)) { - unit = TICKS_3MONTH; - first = timefloor(min, unit); - last = timeceil(max, unit); - } else if (range > (SECONDS_MONTH * div)) { - unit = TICKS_2MONTH; - first = timefloor(min, unit); - last = timeceil(max, unit); - } else if (range > (SECONDS_DAY * 15 * div)) { - unit = TICKS_1MONTH; - } else if (range > (SECONDS_DAY * 10 * div)) { - unit = TICKS_15DAY; - } else if (range > (SECONDS_DAY * div)) { - unit = TICKS_10DAY; - } else if (range > (SECONDS_HOUR * 12 * div)) { - unit = TICKS_1DAY; - } else if (range > (SECONDS_HOUR * 6 * div)) { - unit = TICKS_12HOUR; - } else if (range > (SECONDS_HOUR * 3 * div)) { - unit = TICKS_6HOUR; - } else if (range > (SECONDS_HOUR * div)) { - unit = TICKS_3HOUR; - } else if (range > (SECONDS_MIN * 30 * div)) { - unit = TICKS_HOUR; - } else if (range > (SECONDS_MIN * 20 * div)) { - unit = TICKS_30MIN; - } else if (range > (SECONDS_MIN * 15 * div)) { - unit = TICKS_20MIN; - } else if (range > (SECONDS_MIN * 10 * div)) { - unit = TICKS_15MIN; - } else if (range > (SECONDS_MIN * div)) { - unit = TICKS_10MIN; - } else if (range > (SECONDS_SEC * 30 * div)) { - unit = TICKS_1MIN; - } else if (range > (SECONDS_SEC * 20 * div)) { - unit = TICKS_30SEC; - } else if (range > (SECONDS_SEC * 15 * div)) { - unit = TICKS_20SEC; - } else if (range > (SECONDS_SEC * 10 * div)) { - unit = TICKS_15SEC; - } else if (range > (SECONDS_SEC * div)) { - unit = TICKS_10SEC; - } else { - unit = TICKS_1SEC; - } - - } else { - unit = TICKS_SECS; - } - nTicks = 0; - step = 1.0; - /* Suppress compiler warning. */ - axisMin = axisMax = tickMin = tickMax = NAN; - if (min < max) { - double range; - - range = max - min; - /* Calculate the major tick stepping. */ - if (axisPtr->reqStep > 0.0) { - /* An interval was designated by the user. Keep scaling it until - * it fits comfortably within the current range of the axis. */ - step = axisPtr->reqStep; - while ((2 * step) >= range) { - step *= 0.5; - } - } else { - range = NiceNum(range, 0); - step = NiceNum(range / axisPtr->reqNumMajorTicks, 1); - } - - /* Find the outer tick values. Add 0.0 to prevent getting -0.0. */ - axisMin = tickMin = floor(min / step) * step + 0.0; - axisMax = tickMax = ceil(max / step) * step + 0.0; - - nTicks = Round((tickMax - tickMin) / step) + 1; - } - axisPtr->majorSweep.step = step; - axisPtr->majorSweep.initial = tickMin; - axisPtr->majorSweep.nSteps = nTicks; - - /* - * The limits of the axis are either the range of the data ("tight") or at - * the next outer tick interval ("loose"). The looseness or tightness has - * to do with how the axis fits the range of data values. This option is - * overridden when the user sets an axis limit (by either -min or -max - * option). The axis limit is always at the selected limit (otherwise we - * assume that user would have picked a different number). - */ - if ((axisPtr->looseMin == AXIS_TIGHT) || - ((axisPtr->looseMin == AXIS_LOOSE) && - (isnormal(axisPtr->reqMin)))) { - axisMin = min; - } - if ((axisPtr->looseMax == AXIS_TIGHT) || - ((axisPtr->looseMax == AXIS_LOOSE) && - (isnormal(axisPtr->reqMax)))) { - axisMax = max; - } - SetAxisRange(&axisPtr->axisRange, axisMin, axisMax); - - /* Now calculate the minor tick step and number. */ - - if ((axisPtr->reqNumMinorTicks > 0) && (axisPtr->flags & AXIS_AUTO_MAJOR)) { - nTicks = axisPtr->reqNumMinorTicks - 1; - step = 1.0 / (nTicks + 1); - } else { - nTicks = 0; /* No minor ticks. */ - step = 0.5; /* Don't set the minor tick interval to - * 0.0. It makes the GenerateTicks - * routine * create minor log-scale tick - * marks. */ - } - axisPtr->minorSweep.initial = axisPtr->minorSweep.step = step; - axisPtr->minorSweep.nSteps = nTicks; -#endif -} - -#ifdef notdef -static Ticks * -TimeGenerateTicks(TickSweep *sweepPtr) -{ - Ticks *ticksPtr; - - ticksPtr = malloc(sizeof(Ticks) + - (sweepPtr->nSteps * sizeof(double))); - ticksPtr->nTicks = 0; - - if (sweepPtr->step == 0.0) { - /* Hack: A zero step indicates to use log values. */ - int i; - /* Precomputed log10 values [1..10] */ - static double logTable[] = { - 0.0, - 0.301029995663981, - 0.477121254719662, - 0.602059991327962, - 0.698970004336019, - 0.778151250383644, - 0.845098040014257, - 0.903089986991944, - 0.954242509439325, - 1.0 - }; - for (i = 0; i < sweepPtr->nSteps; i++) { - ticksPtr->values[i] = logTable[i]; - } - } else { - double value; - int i; - - value = sweepPtr->initial; /* Start from smallest axis tick */ - for (i = 0; i < sweepPtr->nSteps; i++) { - value = UROUND(value, sweepPtr->step); - ticksPtr->values[i] = value; - value += sweepPtr->step; - } - } - ticksPtr->nTicks = sweepPtr->nSteps; - return ticksPtr; -} - -static double -TimeFloor(double min, int unit) -{ - unsigned long ticks; - - ticks = (long)floor(min); - localtime_r(&ticks, &tm); - switch(unit) { - case TICK_6MONTHS: - tm.sec = 0; - tm.min = 0; - tm.day = 0; - tm. - } -} -static double -TimeCeil(double max, int unit) -{ - } -#endif diff --git a/src/bltGrBind.C b/src/bltGrBind.C index fbdbc22..d4160b6 100644 --- a/src/bltGrBind.C +++ b/src/bltGrBind.C @@ -261,17 +261,6 @@ PickCurrentItem( */ return; } -#if FULLY_SIMULATE_GRAB - if (((newItem != bindPtr->currentItem) || - (newContext != bindPtr->currentContext)) && - (buttonDown)) { - bindPtr->flags |= LEFT_GRABBED_ITEM; -#ifdef notdef - fprintf(stderr, "pickcurrentitem: simulate grab.\n"); -#endif - return; - } -#endif /* * Simulate a LeaveNotify event on the previous current item and an * EnterNotify event on the new current item. Remove the "current" tag @@ -360,17 +349,6 @@ PickCurrentItem( event.type = EnterNotify; event.xcrossing.detail = NotifyAncestor; DoEvent(bindPtr, &event, newItem, newContext); -#ifdef notdef - if ((eventPtr->type == MotionNotify) || - (eventPtr->type == ButtonRelease)) { - fprintf(stderr, "pickcurrentitem: DoEvent Button buttondown=%d.\n", - buttonDown); - event.type = eventPtr->type; - event.xbutton.button = eventPtr->xbutton.button; - DoEvent(bindPtr, &event, newItem, newContext); - fprintf(stderr, "pickcurrentitem: done.\n"); - } -#endif } done: Tcl_Release(newItem); diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C index 675ac3d..18c63c6 100644 --- a/src/bltGrElemLine.C +++ b/src/bltGrElemLine.C @@ -789,15 +789,12 @@ static int tkpWinRopModes[] = #endif -#ifndef notdef INLINE static int Round(double x) { return (int) (x + ((x < 0.0) ? -0.5 : 0.5)); } -#else -#define Round Round -#endif + /* *--------------------------------------------------------------------------- * Custom configuration option (parse and print) routines @@ -1616,11 +1613,6 @@ ReducePoints(MapInfo *mapPtr, double tolerance) screenPts[i] = mapPtr->screenPts[k]; map[i] = mapPtr->map[k]; } -#ifdef notdef - if (np < mapPtr->nScreenPts) { - fprintf(stderr, "reduced from %d to %d\n", mapPtr->nScreenPts, np); - } -#endif free(mapPtr->screenPts); free(mapPtr->map); free(simple); @@ -5232,117 +5224,3 @@ Blt_LineElement(Graph *graphPtr, const char *name, ClassId classId) return (Element *)elemPtr; } -#ifdef notdef -/* - *--------------------------------------------------------------------------- - * - * MapLineProc -- - * - * Calculates the actual window coordinates of the line element. The - * window coordinates are saved in an allocated point array. - * - * Results: - * None. - * - * Side effects: - * Memory is (re)allocated for the point array. - * - *--------------------------------------------------------------------------- - */ -static void -MapLineProc(Graph *graphPtr, Element *basePtr) -{ - LineElement *elemPtr = (LineElement *)basePtr; - MapInfo mi; - int size, np; - LineStyle **styleMap; - Blt_ChainLink link; - - ResetLine(elemPtr); - np = NUMBEROFPOINTS(elemPtr); - if (np < 1) { - return; /* No data points */ - } - GetScreenPoints(graphPtr, elemPtr, &mi); - MapSymbols(graphPtr, elemPtr, &mi); - - if ((elemPtr->flags & ACTIVE_PENDING) && (elemPtr->nActiveIndices > 0)) { - MapActiveSymbols(graphPtr, elemPtr); - } - /* - * Map connecting line segments if they are to be displayed. - */ - elemPtr->smooth = elemPtr->reqSmooth; - if ((np > 1) && ((graphPtr->classId == CID_ELEM_STRIP) || - (elemPtr->builtinPen.traceWidth > 0))) { - - /* - * Do smoothing if necessary. This can extend the coordinate array, - * so both mi.points and mi.nPoints may change. - */ - switch (elemPtr->smooth) { - case PEN_SMOOTH_STEP: - GenerateSteps(&mi); - break; - - case PEN_SMOOTH_NATURAL: - case PEN_SMOOTH_QUADRATIC: - if (mi.nScreenPts < 3) { - /* Can't interpolate with less than three points. */ - elemPtr->smooth = PEN_SMOOTH_LINEAR; - } else { - GenerateSpline(graphPtr, elemPtr, &mi); - } - break; - - case PEN_SMOOTH_CATROM: - if (mi.nScreenPts < 3) { - /* Can't interpolate with less than three points. */ - elemPtr->smooth = PEN_SMOOTH_LINEAR; - } else { - GenerateParametricSpline(graphPtr, elemPtr, &mi); - } - break; - - default: - break; - } - if (elemPtr->rTolerance > 0.0) { - ReducePoints(&mi, elemPtr->rTolerance); - } - if (elemPtr->fillBg != NULL) { - MapFillArea(graphPtr, elemPtr, &mi); - } - if (graphPtr->classId == CID_ELEM_STRIP) { - MapStrip(graphPtr, elemPtr, &mi); - } else { - MapTraces(graphPtr, elemPtr, &mi); - } - } - free(mi.screenPts); - free(mi.map); - - /* Set the symbol size of all the pen styles. */ - for (link = Blt_Chain_FirstLink(elemPtr->styles); link != NULL; - link = Blt_Chain_NextLink(link)) { - LineStyle *stylePtr; - LinePen *penPtr; - - stylePtr = Blt_Chain_GetValue(link); - penPtr = (LinePen *)stylePtr->penPtr; - size = ScaleSymbol(elemPtr, penPtr->symbol.size); - stylePtr->symbolSize = size; - stylePtr->errorBarCapWidth = (penPtr->errorBarCapWidth > 0) - ? penPtr->errorBarCapWidth : Round(size * 0.6666666); - stylePtr->errorBarCapWidth /= 2; - } - styleMap = (LineStyle **)Blt_StyleMap((Element *)elemPtr); - if (((elemPtr->yHigh.nValues > 0) && (elemPtr->yLow.nValues > 0)) || - ((elemPtr->xHigh.nValues > 0) && (elemPtr->xLow.nValues > 0)) || - (elemPtr->xError.nValues > 0) || (elemPtr->yError.nValues > 0)) { - MapErrorBars(graphPtr, elemPtr, styleMap); - } - MergePens(elemPtr, styleMap); - free(styleMap); -} -#endif diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 04c24aa..9bd2f57 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -1005,59 +1005,6 @@ SelectEntry(Legend *legendPtr, Element *elemPtr) } } -#ifdef notdef -static Element * -PointerToElement(Legend *legendPtr, int x, int y) -{ - Graph *graphPtr = legendPtr->graphPtr; - int w, h; - int n; - - w = legendPtr->width; - h = legendPtr->height; - - x -= legendPtr->x + legendPtr->borderWidth; - y -= legendPtr->y + legendPtr->borderWidth; - w -= 2 * legendPtr->borderWidth + PADDING(legendPtr->xPad); - h -= 2 * legendPtr->borderWidth + PADDING(legendPtr->yPad); - - if ((x < 0) || (x >= w) || (y < 0) || (y >= h)) { - return NULL; - } - - /* It's in the bounding box, so compute the index. */ - { - int row, column; - - row = y / legendPtr->entryHeight; - column = x / legendPtr->entryWidth; - n = (column * legendPtr->nRows) + row; - } - if (n < legendPtr->nEntries) { - Blt_ChainLink link; - int count; - - count = 0; - for (link = Blt_Chain_FirstLink(graphPtr->elements.displayList); - link != NULL; link = Blt_Chain_NextLink(link)) { - Element *elemPtr; - - elemPtr = Blt_Chain_GetValue(link); - if (elemPtr->label == NULL) { - continue; - } - if (count > n) { - return NULL; - } else if (count == n) { - return elemPtr; - } - count++; - } - } - return NULL; -} -#endif - /*ARGSUSED*/ static ClientData PickEntryProc(ClientData clientData, int x, int y, ClientData *contextPtr) @@ -2069,56 +2016,6 @@ SelectRange(Legend *legendPtr, Element *fromPtr, Element *toPtr) } -#ifdef notdef -/* - *--------------------------------------------------------------------------- - * - * SelectText -- - * - * Modify the selection by moving its un-anchored end. This could make - * the selection either larger or smaller. - * - * Results: - * None. - * - * Side effects: - * The selection changes. - * - *--------------------------------------------------------------------------- - */ -static int -SelectText(Legend *legendPtr, Element *elemPtr) -{ - Element *firstPtr, *lastPtr; - Graph *graphPtr = legendPtr->graphPtr; - - /* Grab the selection if we don't own it already. */ - if ((legendPtr->flags&SELECT_EXPORT) && (legendPtr->selFirstPtr == NULL)) { - Tk_OwnSelection(legendPtr->tkwin, XA_PRIMARY, LostSelectionProc, - legendPtr); - } - /* If the anchor hasn't been set, assume the beginning of the legend. */ - if (legendPtr->selAnchorPtr == NULL) { - legendPtr->selAnchorPtr = GetFirstElement(graphPtr); - } - if (legendPtr->selAnchorPtr != elemPtr) { - firstPtr = legendPtr->selAnchorPtr; - lastPtr = elemPtr; - } else { - firstPtr = elemPtr; - lastPtr = legendPtr->selAnchorPtr; - } - if ((legendPtr->selFirstPtr != firstPtr) || - (legendPtr->selLastPtr != lastPtr)) { - legendPtr->selFirstPtr = firstPtr; - legendPtr->selLastPtr = lastPtr; - SelectRange(legendPtr, firstPtr, lastPtr); - Blt_Legend_EventuallyRedraw(graphPtr); - } - return TCL_OK; -} -#endif - /* *--------------------------------------------------------------------------- * diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C index 2364d86..2df1be6 100644 --- a/src/bltGrMarker.C +++ b/src/bltGrMarker.C @@ -762,11 +762,6 @@ typedef struct { int state; /* Fields specific to text markers. */ -#ifdef notdef - const char *textVarName; /* Name of variable (malloc'ed) or - * NULL. If non-NULL, graph displays the - * contents of this variable. */ -#endif const char *string; /* Text string to be display. The * string make contain newlines. */ Tk_Anchor anchor; /* Indicates how to translate the given @@ -975,30 +970,6 @@ static Tk_ImageChangedProc ImageChangedProc; -#ifdef notdef -static MarkerClass rectangleMarkerClass = { - rectangleConfigSpecs, - ConfigureRectangleProc, - DrawRectangleProc, - FreeRectangleProc, - MapRectangleProc, - PointInRectangleProc, - RegionInRectangleProc, - RectangleToPostscriptProc, -}; - -static MarkerClass ovalMarkerClass = { - ovalConfigSpecs, - ConfigureOvalProc, - DrawOvalProc, - FreeOvalProc, - MapOvalProc, - PointInOvalProc, - RegionInOvalProc, - OvalToPostscriptProc, -}; -#endif - /* *--------------------------------------------------------------------------- * @@ -1937,19 +1908,6 @@ ConfigureBitmapProc(Marker *markerPtr) return TCL_OK; } -#ifdef notdef -static void -PrintPolyPoint(char *mesg, Point2d *points, int nPoints) -{ - int i; - - fprintf(stderr, "%s:\t\tpoint[0]=%g,%g\n", mesg, points[0].x, points[0].y); - for (i = 1; i < nPoints; i++) { - fprintf(stderr, "\t\tpoint[%d]=%g,%g\n", i, points[i].x, points[i].y); - } -} -#endif - /* *--------------------------------------------------------------------------- * @@ -5034,165 +4992,3 @@ Blt_MakeMarkerTag(Graph *graphPtr, const char *tagName) } -#ifdef notdef -/* - *--------------------------------------------------------------------------- - * - * ConfigureArrows -- - * - * If arrowheads have been requested for a line, this procedure makes - * arrangements for the arrowheads. - * - * Results: - * Always returns TCL_OK. - * - * Side effects: - * Information in linePtr is set up for one or two arrowheads. the - * firstArrowPtr and lastArrowPtr polygons are allocated and initialized, - * if need be, and the end points of the line are adjusted so that a - * thick line doesn't stick out past the arrowheads. - * - *--------------------------------------------------------------------------- - */ - - /* ARGSUSED */ -static int -ConfigureArrows(canvas, linePtr) - Tk_Canvas canvas; /* Canvas in which arrows will be - * displayed (interp and tkwin fields - * are needed). */ - LineItem *linePtr; /* Item to configure for arrows. */ -{ - double *poly, *coordPtr; - double dx, dy, length, sinTheta, cosTheta, temp; - double fracHeight; /* Line width as fraction of arrowhead - * width. */ - double backup; /* Distance to backup end points so - * the line ends in the middle of the - * arrowhead. */ - double vertX, vertY; /* Position of arrowhead vertex. */ - double shapeA, shapeB, shapeC; /* Adjusted coordinates (see - * explanation below). */ - double width; - Tk_State state = linePtr->header.state; - - if (linePtr->numPoints <2) { - return TCL_OK; - } - - if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; - } - - width = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) { - if (linePtr->outline.activeWidth>width) { - width = linePtr->outline.activeWidth; - } - } else if (state==TK_STATE_DISABLED) { - if (linePtr->outline.disabledWidth>0) { - width = linePtr->outline.disabledWidth; - } - } - - /* - * The code below makes a tiny increase in the shape parameters for the - * line. This is a bit of a hack, but it seems to result in displays that - * more closely approximate the specified parameters. Without the - * adjustment, the arrows come out smaller than expected. - */ - - shapeA = linePtr->arrowShapeA + 0.001; - shapeB = linePtr->arrowShapeB + 0.001; - shapeC = linePtr->arrowShapeC + width/2.0 + 0.001; - - /* - * If there's an arrowhead on the first point of the line, compute its - * polygon and adjust the first point of the line so that the line doesn't - * stick out past the leading edge of the arrowhead. - */ - - fracHeight = (width/2.0)/shapeC; - backup = fracHeight*shapeB + shapeA*(1.0 - fracHeight)/2.0; - if (linePtr->arrow != ARROWS_LAST) { - poly = linePtr->firstArrowPtr; - if (poly == NULL) { - poly = (double *) ckalloc((unsigned) - (2*PTS_IN_ARROW*sizeof(double))); - poly[0] = poly[10] = linePtr->coordPtr[0]; - poly[1] = poly[11] = linePtr->coordPtr[1]; - linePtr->firstArrowPtr = poly; - } - dx = poly[0] - linePtr->coordPtr[2]; - dy = poly[1] - linePtr->coordPtr[3]; - length = hypot(dx, dy); - if (length == 0) { - sinTheta = cosTheta = 0.0; - } else { - sinTheta = dy/length; - cosTheta = dx/length; - } - vertX = poly[0] - shapeA*cosTheta; - vertY = poly[1] - shapeA*sinTheta; - temp = shapeC*sinTheta; - poly[2] = poly[0] - shapeB*cosTheta + temp; - poly[8] = poly[2] - 2*temp; - temp = shapeC*cosTheta; - poly[3] = poly[1] - shapeB*sinTheta - temp; - poly[9] = poly[3] + 2*temp; - poly[4] = poly[2]*fracHeight + vertX*(1.0-fracHeight); - poly[5] = poly[3]*fracHeight + vertY*(1.0-fracHeight); - poly[6] = poly[8]*fracHeight + vertX*(1.0-fracHeight); - poly[7] = poly[9]*fracHeight + vertY*(1.0-fracHeight); - - /* - * Polygon done. Now move the first point towards the second so that - * the corners at the end of the line are inside the arrowhead. - */ - - linePtr->coordPtr[0] = poly[0] - backup*cosTheta; - linePtr->coordPtr[1] = poly[1] - backup*sinTheta; - } - - /* - * Similar arrowhead calculation for the last point of the line. - */ - - if (linePtr->arrow != ARROWS_FIRST) { - coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2); - poly = linePtr->lastArrowPtr; - if (poly == NULL) { - poly = (double *) ckalloc((unsigned) - (2*PTS_IN_ARROW*sizeof(double))); - poly[0] = poly[10] = coordPtr[2]; - poly[1] = poly[11] = coordPtr[3]; - linePtr->lastArrowPtr = poly; - } - dx = poly[0] - coordPtr[0]; - dy = poly[1] - coordPtr[1]; - length = hypot(dx, dy); - if (length == 0) { - sinTheta = cosTheta = 0.0; - } else { - sinTheta = dy/length; - cosTheta = dx/length; - } - vertX = poly[0] - shapeA*cosTheta; - vertY = poly[1] - shapeA*sinTheta; - temp = shapeC*sinTheta; - poly[2] = poly[0] - shapeB*cosTheta + temp; - poly[8] = poly[2] - 2*temp; - temp = shapeC*cosTheta; - poly[3] = poly[1] - shapeB*sinTheta - temp; - poly[9] = poly[3] + 2*temp; - poly[4] = poly[2]*fracHeight + vertX*(1.0-fracHeight); - poly[5] = poly[3]*fracHeight + vertY*(1.0-fracHeight); - poly[6] = poly[8]*fracHeight + vertX*(1.0-fracHeight); - poly[7] = poly[9]*fracHeight + vertY*(1.0-fracHeight); - coordPtr[2] = poly[0] - backup*cosTheta; - coordPtr[3] = poly[1] - backup*sinTheta; - } - - return TCL_OK; -} -#endif diff --git a/src/bltGrMisc.C b/src/bltGrMisc.C index ea3cdf7..47fa77a 100644 --- a/src/bltGrMisc.C +++ b/src/bltGrMisc.C @@ -720,96 +720,6 @@ typedef struct { (c)->green = (int)((g) * 65535.0), \ (c)->blue = (int)((b) * 65535.0)) -#ifdef notdef -void -Blt_XColorToHSV(XColor *colorPtr, HSV *hsvPtr) -{ - unsigned short max, min; - double range; - unsigned short *colorValues; - - /* Find the minimum and maximum RGB intensities */ - colorValues = (unsigned short *)&colorPtr->red; - max = MAX3(colorValues[0], colorValues[1], colorValues[2]); - min = MIN3(colorValues[0], colorValues[1], colorValues[2]); - - hsvPtr->val = (double)max / 65535.0; - hsvPtr->hue = hsvPtr->sat = 0.0; - - range = (double)(max - min); - if (max != min) { - hsvPtr->sat = range / (double)max; - } - if (hsvPtr->sat > 0.0) { - double red, green, blue; - - /* Normalize the RGB values */ - red = (double)(max - colorPtr->red) / range; - green = (double)(max - colorPtr->green) / range; - blue = (double)(max - colorPtr->blue) / range; - - if (colorPtr->red == max) { - hsvPtr->hue = (blue - green); - } else if (colorPtr->green == max) { - hsvPtr->hue = 2 + (red - blue); - } else if (colorPtr->blue == max) { - hsvPtr->hue = 4 + (green - red); - } - hsvPtr->hue *= 60.0; - } else { - hsvPtr->sat = 0.5; - } - if (hsvPtr->hue < 0.0) { - hsvPtr->hue += 360.0; - } -} - -void -Blt_HSVToXColor(HSV *hsvPtr, XColor *colorPtr) -{ - double hue, p, q, t; - double frac; - int quadrant; - - if (hsvPtr->val < 0.0) { - hsvPtr->val = 0.0; - } else if (hsvPtr->val > 1.0) { - hsvPtr->val = 1.0; - } - if (hsvPtr->sat == 0.0) { - SetColor(colorPtr, hsvPtr->val, hsvPtr->val, hsvPtr->val); - return; - } - hue = fmod(hsvPtr->hue, 360.0) / 60.0; - quadrant = (int)floor(hue); - frac = hsvPtr->hue - quadrant; - p = hsvPtr->val * (1 - (hsvPtr->sat)); - q = hsvPtr->val * (1 - (hsvPtr->sat * frac)); - t = hsvPtr->val * (1 - (hsvPtr->sat * (1 - frac))); - - switch (quadrant) { - case 0: - SetColor(colorPtr, hsvPtr->val, t, p); - break; - case 1: - SetColor(colorPtr, q, hsvPtr->val, p); - break; - case 2: - SetColor(colorPtr, p, hsvPtr->val, t); - break; - case 3: - SetColor(colorPtr, p, q, hsvPtr->val); - break; - case 4: - SetColor(colorPtr, t, p, hsvPtr->val); - break; - case 5: - SetColor(colorPtr, hsvPtr->val, p, q); - break; - } -} -#endif - /* *--------------------------------------------------------------------------- * @@ -1312,7 +1222,6 @@ Blt_Fill3DRectangle( int relief) /* Indicates 3D effect: TK_RELIEF_FLAT, * TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */ { -#ifndef notdef if ((borderWidth > 1) && (width > 2) && (height > 2) && ((relief == TK_RELIEF_SUNKEN) || (relief == TK_RELIEF_RAISED))) { GC lightGC, darkGC; @@ -1325,15 +1234,9 @@ Blt_Fill3DRectangle( if (relief == TK_RELIEF_RAISED) { lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); -#ifdef notdef - darkGC = DefaultGC(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)); -#endif } else { lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); -#ifdef notdef - lightGC = DefaultGC(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)); -#endif darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); } XDrawLine(Tk_Display(tkwin), drawable, lightGC, x, y, x2, y); @@ -1342,7 +1245,6 @@ Blt_Fill3DRectangle( XDrawLine(Tk_Display(tkwin), drawable, lightGC, x, y, x, y2); x++, y++, width -= 2, height -= 2, borderWidth--; } -#endif Tk_Fill3DRectangle(tkwin, drawable, border, x, y, width, height, borderWidth, relief); } @@ -1361,7 +1263,6 @@ Blt_Draw3DRectangle( int relief) /* Indicates 3D effect: TK_RELIEF_FLAT, * TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */ { -#ifndef notdef if ((borderWidth > 1) && (width > 2) && (height > 2) && ((relief == TK_RELIEF_SUNKEN) || (relief == TK_RELIEF_RAISED))) { GC lightGC, darkGC; @@ -1372,14 +1273,8 @@ Blt_Draw3DRectangle( if (relief == TK_RELIEF_RAISED) { lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); -#ifdef notdef - darkGC = DefaultGC(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)); -#endif } else { lightGC = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); -#ifdef notdef - lightGC = DefaultGC(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)); -#endif darkGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); } XDrawLine(Tk_Display(tkwin), drawable, darkGC, x2, y2, x2, y); @@ -1388,282 +1283,10 @@ Blt_Draw3DRectangle( XDrawLine(Tk_Display(tkwin), drawable, lightGC, x, y, x, y2); x++, y++, width -= 2, height -= 2, borderWidth--; } -#endif Tk_Draw3DRectangle(tkwin, drawable, border, x, y, width, height, borderWidth, relief); } -#ifdef notdef -typedef struct { - Screen *screen; - Visual *visual; - Colormap colormap; - Tk_Uid nameUid; -} BorderKey; - -typedef struct { - Screen *screen; /* Screen on which the border will be used. */ - Visual *visual; /* Visual for all windows and pixmaps using - * the border. */ - int depth; /* Number of bits per pixel of drawables where - * the border will be used. */ - Colormap colormap; /* Colormap out of which pixels are - * allocated. */ - int refCount; /* Number of active uses of this color (each - * active use corresponds to a call to - * Blt_Get3DBorder). If this count is 0, then - * this structure is no longer valid and it - * isn't present in borderTable: it is being - * kept around only because there are objects - * referring to it. The structure is freed - * when refCount is 0. */ - - XColor *bgColorPtr; /* Color of face. */ - XColor *shadows[4]; - - Pixmap darkStipple; /* Stipple pattern to use for drawing shadows - * areas. Used for displays with <= 64 colors - * or where colormap has filled up. */ - Pixmap lightStipple; /* Stipple pattern to use for drawing shadows - * areas. Used for displays with <= 64 colors - * or where colormap has filled up. */ - GC bgGC; /* Used (if necessary) to draw areas in the - * background color. */ - GC lightGC, darkGC; - Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in order to - * delete structure). */ - - struct _Blt_3DBorder *nextPtr; -} Border, *Blt_3DBorder; - - -void -Blt_Draw3DRectangle(tkwin, drawable, border, x, y, width, - height, borderWidth, relief) - Tk_Window tkwin; /* Window for which border was allocated. */ - Drawable drawable; /* X window or pixmap in which to draw. */ - Blt_3DBorder *borderPtr; /* Border to draw. */ - int x, y, width, height; /* Outside area of rectangular region. */ - int borderWidth; /* Desired width for border, in - * pixels. Border will be *inside* region. */ - int relief; /* Indicates 3D effect: TK_RELIEF_FLAT, - * TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */ -{ - if ((width > (2 * borderWidth)) && (height > (2 * borderWidth))) { - int x2, y2; - int i; - - x2 = x + width - 1; - y2 = y + height - 1; - - XSetForeground(borderPtr->lightGC, borderPtr->shadows[0]); - XSetForeground(borderPtr->darkGC, borderPtr->shadows[3]); - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->lightGC, - x, y, x2, y); - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->lightGC, - x, y, x, y2); - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->darkGC, - x2, y, x2, y2); - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->darkGC, - x2, y2, x, y2); - XSetForeground(borderPtr->lightGC, borderPtr->shadows[1]); - XSetForeground(borderPtr->darkGC, borderPtr->shadows[2]); - for (i = 1; i < (borderWidth - 1); i++) { - - /* - * +---------- - * |+------- - * ||+----- - * ||| - * ||| - * || - * | - */ - x++, y++, x2--, y2--; - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->lightGC, - x, y, x2, y); - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->lightGC, - x, y, x, y2); - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->darkGC, - x2, y, x2, y2); - XDrawLine(Tk_Display(tkwin), drawable, borderPtr->darkGC, - x2, y2, x, y2); - } - } -} - -void -Blt_Fill3DRectangle(tkwin, drawable, border, x, y, width, height, borderWidth, - relief) - Tk_Window tkwin; /* Window for which border was allocated. */ - Drawable drawable; /* X window or pixmap in which to draw. */ - Tk_3DBorder border; /* Token for border to draw. */ - int x, y, width, height; /* Outside area of rectangular region. */ - int borderWidth; /* Desired width for border, in - * pixels. Border will be *inside* region. */ - int relief; /* Indicates 3D effect: TK_RELIEF_FLAT, - * TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */ -{ - Blt_3DBorder *borderPtr; - - XFillRectangle(Tk_Display(tkwin), drawable, borderPtr->bgGC, x, y, width, - height); - if ((borderWidth > 0) && (relief != BLT_RELIEF_FLAT)) { - Blt_Draw3DRectangle(tkwin, drawable, borderPtr, x, y, width, height, - borderWidth, relief); - } -} - - -void -FreeBorder(display, borderPtr) - Display *display; - Border *borderPtr; -{ - int i; - - if (borderPtr->bgColorPtr != NULL) { - Tk_FreeColor(display, borderPtr->bgColorPtr); - } - for (i = 0; i < 4; i++) { - Tk_FreeColor(display, borderPtr->shadows[i]); - } - if (borderPtr->darkGC != NULL) { - Blt_FreePrivateGC(display, borderPtr->darkGC); - } - if (borderPtr->lightGC != NULL) { - Blt_FreePrivateGC(tkwin, borderPtr->lightGC); - } - if (borderPtr->bgGC != NULL) { - Blt_FreePrivateGC(tkwin, borderPtr->bgGC); - } - free(borderPtr); -} - -void -Blt_Free3DBorder(display, border) - Display *display; - Blt_3DBorder border; -{ - Border *borderPtr = (Border *)border; - - borderPtr->refCount--; - if (borderPtr->refCount >= 0) { - /* Search for the border in the bucket. Start at the head. */ - headPtr = Blt_GetHashValue(borderPtr->hashPtr); - lastPtr = NULL; - while ((headPtr != borderPtr) && (headPtr != NULL)) { - lastPtr = headPtr; - headPtr = headPtr->next; - } - if (headPtr == NULL) { - return; /* This can't happen. It means that we could - * not find the border. */ - } - if (lastPtr != NULL) { - lastPtr->next = borderPtr->next; - } else { - Tcl_DeleteHashEntry(borderPtr->hashPtr); - } - FreeBorder(display, borderPtr); - } -} - -Blt_3DBorder * -Blt_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin, const char *borderName) -{ - Blt_3DBorder *borderPtr, *lastBorderPtr; - Blt_HashEntry *hPtr; - XColor *bgColorPtr; - char **argv; - const char *colorName; - int argc; - int isNew; - - lastBorderPtr = NULL; - hPtr = Tcl_CreateHashEntry(&dataPtr->borderTable, borderName, &isNew); - if (!isNew) { - borderPtr = lastBorderPtr = Blt_GetHashValue(hPtr); - while (borderPtr != NULL) { - if ((Tk_Screen(tkwin) == borderPtr->screen) && - (Tk_Colormap(tkwin) == borderPtr->colormap)) { - borderPtr->refCount++; - return borderPtr; - } - borderPtr = borderPtr->nextPtr; - } - } - /* Create a new border. */ - argv = NULL; - bgColorPtr = NULL; - - if (Tcl_SplitList(interp, borderName, &argc, &argv) != TCL_OK) { - goto error; - } - colorName = borderName; - bgColorPtr = Tk_GetColor(interp, tkwin, colorName); - if (bgColorPtr == NULL) { - goto error; - } - - /* Create a new border */ - borderPtr = calloc(1, sizeof(Blt_3DBorder)); - borderPtr->screen = Tk_Screen(tkwin); - borderPtr->visual = Tk_Visual(tkwin); - borderPtr->depth = Tk_Depth(tkwin); - borderPtr->colormap = Tk_Colormap(tkwin); - borderPtr->refCount = 1; - borderPtr->bgColorPtr = bgColorPtr; - borderPtr->darkGC = Blt_GetPrivateGC(tkwin, 0, NULL); - borderPtr->lightGC = Blt_GetPrivateGC(tkwin, 0, NULL); - borderPtr->hashPtr = lastBorderPtr->hashPtr; - lastBorderPtr->nextPtr = lastBorderPtr; - { - HSV hsv; - XColor color; - double sat, sat0, diff, step, hstep; - int count; - - /* Convert the face (background) color to HSV */ - Blt_XColorToHSV(borderPtr->bgColorPtr, &hsv); - - /* Using the color as the baseline intensity, pick a set of colors - * around the intensity. */ -#define UFLOOR(x,u) (floor((x)*(u))/(u)) - diff = hsv.sat - UFLOOR(hsv.sat, 0.2); - sat = 0.1 + (diff - 0.1); - sat0 = hsv.sat; - count = 0; - for (sat = 0.1 + (diff - 0.1); sat <= 1.0; sat += 0.2) { - if (fabs(sat0 - sat) >= 0.1) { - hsv.sat = sat; - Blt_HSVToXColor(&hsv, &color); - borderPtr->shadows[count] = Tk_GetColorByValue(tkwin, &color); - count++; - } - } - } - Blt_SetHashValue(hPtr, borderPtr); - if (argv != NULL) { - free(argv); - } - return TCL_OK; - - error: - if (argv != NULL) { - free(argv); - } - if (bgColorPtr != NULL) { - Tk_FreeColor(bgColorPtr); - } - if (isNew) { - Blt_DeleteHashEntry(&borderTable, hPtr); - } - return NULL; -} - - -#endif typedef struct { float x, y, z; diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C index f764b8f..80794ff 100644 --- a/src/bltGrPSOutput.C +++ b/src/bltGrPSOutput.C @@ -1170,9 +1170,6 @@ AsciiHexEncode(Blt_DBuffer dBuffer, Tcl_DString *resultPtr) } } *dp++ = '\0'; -#ifdef notdef - Tcl_DStringSetLength(resultPtr, n + oldLength); -#endif } } diff --git a/src/bltGrText.C b/src/bltGrText.C index 2959c88..73ad39f 100644 --- a/src/bltGrText.C +++ b/src/bltGrText.C @@ -37,8 +37,6 @@ #include "bltText.h" #include "bltBgStyle.h" -#define WINDEBUG 0 - static Blt_HashTable bitmapGCTable; static int initialized; diff --git a/src/bltGraph.C b/src/bltGraph.C index 0e44353..aba18c1 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -1825,50 +1825,6 @@ DrawMargins(Graph *graphPtr, Drawable drawable) graphPtr->flags &= ~DRAW_MARGINS; } -#ifdef notdef -/* - *--------------------------------------------------------------------------- - * - * DrawPlotRegion -- - * - * Draws the contents of the plotting area. This consists of the - * elements, markers (draw under elements), axis limits, and possibly the - * legend. Typically, the output will be cached into a backing store - * pixmap, so that redraws can occur quickly. - * - * Results: - * None. - * - *--------------------------------------------------------------------------- - */ -static void -DrawPlotRegion(Graph *graphPtr, Drawable drawable) -{ - int site; - - /* Clear the background of the plotting area. */ - Blt_FillBackgroundRectangle(graphPtr->tkwin, drawable, graphPtr->plotBg, - graphPtr->left, graphPtr->top, graphPtr->right - graphPtr->left + 1, - graphPtr->bottom - graphPtr->top + 1, TK_RELIEF_FLAT, 0); - - /* Draw the elements, markers, legend, and axis limits. */ - - Blt_DrawGrids(graphPtr, drawable); - Blt_DrawMarkers(graphPtr, drawable, MARKER_UNDER); - site = Blt_Legend_Site(graphPtr); - if ((site & LEGEND_PLOTAREA_MASK) && - (!Blt_Legend_IsRaised(graphPtr))) { - Blt_DrawLegend(graphPtr, drawable); - } else if (site == LEGEND_WINDOW) { - Blt_Legend_EventuallyRedraw(graphPtr); - } - Blt_DrawAxisLimits(graphPtr, drawable); - DrawMargins(graphPtr, drawable); - Blt_DrawElements(graphPtr, drawable); - Blt_DrawAxes(graphPtr, drawable); -} -#endif - /* *--------------------------------------------------------------------------- * @@ -2019,9 +1975,6 @@ DisplayGraph(ClientData clientData) * should not get here) */ } tkwin = graphPtr->tkwin; -#ifdef notdef - fprintf(stderr, "Calling DisplayGraph(%s)\n", Tk_PathName(tkwin)); -#endif if ((Tk_Width(tkwin) <= 1) || (Tk_Height(tkwin) <= 1)) { /* Don't bother computing the layout until the size of the window is * something reasonable. */ diff --git a/src/bltSwitch.C b/src/bltSwitch.C index 7dca359..9250328 100644 --- a/src/bltSwitch.C +++ b/src/bltSwitch.C @@ -275,22 +275,6 @@ DoSwitch( } *(char **)ptr = value; } -#ifdef notdef - { - char *old, *new, **strPtr; - char *string; - - string = Tcl_GetString(objPtr); - strPtr = (char **)ptr; - new = ((*string == '\0') && (sp->flags & BLT_SWITCH_NULL_OK)) - ? NULL : Blt_Strdup(string); - old = *strPtr; - if (old != NULL) { - free(old); - } - *strPtr = new; - } -#endif break; case BLT_SWITCH_CUSTOM: -- cgit v0.12