diff options
author | joye <joye> | 2014-03-06 22:25:54 (GMT) |
---|---|---|
committer | joye <joye> | 2014-03-06 22:25:54 (GMT) |
commit | 6ca66801c83e84be48c9b66c5adc4126631b65bb (patch) | |
tree | a4c70d09be439c2f613667b1ba97330cf94c7f4c /src | |
parent | 3ab54df95654741a1dba52d903ab0b17aa8b8453 (diff) | |
download | blt-6ca66801c83e84be48c9b66c5adc4126631b65bb.zip blt-6ca66801c83e84be48c9b66c5adc4126631b65bb.tar.gz blt-6ca66801c83e84be48c9b66c5adc4126631b65bb.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrAxis.C | 14 | ||||
-rw-r--r-- | src/bltGrLegd.C | 63 | ||||
-rw-r--r-- | src/bltGrText.C | 14 |
3 files changed, 39 insertions, 52 deletions
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index f450ed7..7bd27f4 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -2585,7 +2585,6 @@ static void DrawAxis(Axis *axisPtr, Drawable drawable) else Blt_Ts_SetForeground(ts, axisPtr->titleColor); - Blt_Ts_SetForeground(ts, axisPtr->titleColor); if ((axisPtr->titleAngle == 90.0) || (axisPtr->titleAngle == 270.0)) Blt_Ts_SetMaxLength(ts, axisPtr->height); else @@ -2682,14 +2681,9 @@ static void DrawAxis(Axis *axisPtr, Drawable drawable) } } if ((axisPtr->nSegments > 0) && (axisPtr->lineWidth > 0)) { - GC gc; - - if (axisPtr->flags & ACTIVE) - gc = axisPtr->activeTickGC; - else - gc = axisPtr->tickGC; + GC gc = (axisPtr->flags & ACTIVE) ? axisPtr->activeTickGC : axisPtr->tickGC; - /* Draw the tick marks and axis line. */ + // Draw the tick marks and axis line. Blt_Draw2DSegments(graphPtr->display, drawable, gc, axisPtr->segments, axisPtr->nSegments); } @@ -2698,13 +2692,13 @@ static void DrawAxis(Axis *axisPtr, Drawable drawable) static void AxisToPostScript(Blt_Ps ps, Axis *axisPtr) { Blt_Ps_Format(ps, "%% Axis \"%s\"\n", axisPtr->obj.name); - if (axisPtr->normalBg) { + if (axisPtr->normalBg) Blt_Ps_Fill3DRectangle(ps, axisPtr->normalBg, (double)axisPtr->left, (double)axisPtr->top, axisPtr->right - axisPtr->left, axisPtr->bottom - axisPtr->top, axisPtr->borderWidth, axisPtr->relief); - } + if (axisPtr->title) { TextStyle ts; diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 3028091..f36e72b 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -520,7 +520,7 @@ static void LegendEventProc(ClientData clientData, XEvent *eventPtr) Graph* graphPtr = legendPtr->graphPtr; if (legendPtr->site == LEGEND_WINDOW) { - if (legendPtr->cmdToken != NULL) { + if (legendPtr->cmdToken) { Tcl_DeleteCommandFromToken(graphPtr->interp, legendPtr->cmdToken); legendPtr->cmdToken = NULL; @@ -638,7 +638,7 @@ static void ConfigureLegend(Graph* graphPtr) legendPtr->focusDashes.offset = 2; Blt_SetDashes(graphPtr->display, newGC, &legendPtr->focusDashes); } - if (legendPtr->focusGC != NULL) + if (legendPtr->focusGC) Blt_FreePrivateGC(graphPtr->display, legendPtr->focusGC); legendPtr->focusGC = newGC; @@ -811,7 +811,7 @@ static int FocusOp(Graph* graphPtr, Tcl_Interp* interp, CID_LEGEND_ENTRY); Blt_Legend_EventuallyRedraw(graphPtr); } - if (legendPtr->focusPtr != NULL) { + if (legendPtr->focusPtr) { Tcl_SetStringObj(Tcl_GetObjResult(interp), legendPtr->focusPtr->obj.name, -1); } @@ -829,7 +829,7 @@ static int GetOp(Graph* graphPtr, Tcl_Interp* interp, if (GetElementFromObj(graphPtr, objv[3], &elemPtr) != TCL_OK) { return TCL_ERROR; } - if (elemPtr != NULL) { + if (elemPtr) { Tcl_SetStringObj(Tcl_GetObjResult(interp), elemPtr->obj.name,-1); } } @@ -876,7 +876,7 @@ static int SelectionAnchorOp(Graph* graphPtr, Tcl_Interp* interp, * is selected. */ legendPtr->selAnchorPtr = elemPtr; legendPtr->selMarkPtr = NULL; - if (elemPtr != NULL) { + if (elemPtr) { Tcl_SetStringObj(Tcl_GetObjResult(interp), elemPtr->obj.name, -1); } Blt_Legend_EventuallyRedraw(graphPtr); @@ -943,7 +943,7 @@ static int SelectionMarkOp(Graph* graphPtr, Tcl_Interp* interp, legendPtr->selMarkPtr = elemPtr; Blt_Legend_EventuallyRedraw(graphPtr); - if (legendPtr->selectCmd != NULL) { + if (legendPtr->selectCmd) { EventuallyInvokeSelectCmd(legendPtr); } } @@ -1015,7 +1015,7 @@ static int SelectionSetOp(Graph* graphPtr, Tcl_Interp* interp, legendPtr); } Blt_Legend_EventuallyRedraw(graphPtr); - if (legendPtr->selectCmd != NULL) { + if (legendPtr->selectCmd) { EventuallyInvokeSelectCmd(legendPtr); } return TCL_OK; @@ -1076,7 +1076,7 @@ void Blt_Legend_EventuallyRedraw(Graph* graphPtr) { Legend *legendPtr = graphPtr->legend; - if ((legendPtr->tkwin != NULL) && !(legendPtr->flags & REDRAW_PENDING)) { + if ((legendPtr->tkwin) && !(legendPtr->flags & REDRAW_PENDING)) { Tcl_DoWhenIdle(DisplayLegend, legendPtr); legendPtr->flags |= REDRAW_PENDING; } @@ -1088,7 +1088,7 @@ static void SelectCmdProc(ClientData clientData) Tcl_Preserve(legendPtr); legendPtr->flags &= ~SELECT_PENDING; - if (legendPtr->selectCmd != NULL) { + if (legendPtr->selectCmd) { Tcl_Interp* interp; interp = legendPtr->graphPtr->interp; @@ -1113,7 +1113,7 @@ static void ClearSelection(Legend *legendPtr) Tcl_InitHashTable(&legendPtr->selectTable, TCL_ONE_WORD_KEYS); Blt_Chain_Reset(legendPtr->selected); Blt_Legend_EventuallyRedraw(legendPtr->graphPtr); - if (legendPtr->selectCmd != NULL) { + if (legendPtr->selectCmd) { EventuallyInvokeSelectCmd(legendPtr); } } @@ -1181,12 +1181,12 @@ static void SetLegendOrigin(Legend *legendPtr) case LEGEND_TOP: w = graphPtr->right - graphPtr->left; h = graphPtr->topMargin.height - graphPtr->topMargin.axesOffset; - if (graphPtr->title != NULL) { + if (graphPtr->title) { h -= graphPtr->titleHeight; } x = graphPtr->left; y = graphPtr->inset; - if (graphPtr->title != NULL) { + if (graphPtr->title) { y += graphPtr->titleHeight; } break; @@ -1286,35 +1286,28 @@ static void SetLegendOrigin(Legend *legendPtr) static int EntryIsSelected(Legend *legendPtr, Element* elemPtr) { - Tcl_HashEntry *hPtr; - - hPtr = Tcl_FindHashEntry(&legendPtr->selectTable, (char *)elemPtr); + Tcl_HashEntry*hPtr = + Tcl_FindHashEntry(&legendPtr->selectTable, (char *)elemPtr); return (hPtr != NULL); } static void SelectElement(Legend *legendPtr, Element* elemPtr) { int isNew; - Tcl_HashEntry *hPtr; - - hPtr = Tcl_CreateHashEntry(&legendPtr->selectTable, (char *)elemPtr,&isNew); + Tcl_HashEntry *hPtr = + Tcl_CreateHashEntry(&legendPtr->selectTable, (char *)elemPtr,&isNew); if (isNew) { - Blt_ChainLink link; - - link = Blt_Chain_Append(legendPtr->selected, elemPtr); + Blt_ChainLink link = Blt_Chain_Append(legendPtr->selected, elemPtr); Tcl_SetHashValue(hPtr, link); } } static void DeselectElement(Legend *legendPtr, Element* elemPtr) { - Tcl_HashEntry *hPtr; - - hPtr = Tcl_FindHashEntry(&legendPtr->selectTable, (char *)elemPtr); - if (hPtr != NULL) { - Blt_ChainLink link; - - link = Tcl_GetHashValue(hPtr); + Tcl_HashEntry* hPtr = + Tcl_FindHashEntry(&legendPtr->selectTable, (char *)elemPtr); + if (hPtr) { + Blt_ChainLink link = Tcl_GetHashValue(hPtr); Blt_Chain_DeleteLink(legendPtr->selected, link); Tcl_DeleteHashEntry(hPtr); } @@ -1335,7 +1328,7 @@ static void SelectEntry(Legend *legendPtr, Element* elemPtr) case SELECT_TOGGLE: hPtr = Tcl_FindHashEntry(&legendPtr->selectTable, (char *)elemPtr); - if (hPtr != NULL) { + if (hPtr) { DeselectElement(legendPtr, elemPtr); } else { SelectElement(legendPtr, elemPtr); @@ -1384,14 +1377,14 @@ static ClientData PickEntryProc(ClientData clientData, int x, int y, Element* elemPtr; elemPtr = Blt_Chain_GetValue(link); - if (elemPtr->label != NULL) { + if (elemPtr->label) { if (count == n) { return elemPtr; } count++; } } - if (link != NULL) { + if (link) { return Blt_Chain_GetValue(link); } } @@ -1593,7 +1586,7 @@ void Blt_DrawLegend(Graph* graphPtr, Drawable drawable) pixmap = Tk_GetPixmap(graphPtr->display, Tk_WindowId(tkwin), w, h, Tk_Depth(tkwin)); - if (legendPtr->normalBg != NULL) { + if (legendPtr->normalBg) { Tk_Fill3DRectangle(tkwin, pixmap, legendPtr->normalBg, 0, 0, w, h, 0, TK_RELIEF_FLAT); } @@ -1746,7 +1739,7 @@ void Blt_LegendToPostScript(Graph* graphPtr, Blt_Ps ps) Blt_Ps_Append(ps, "% Legend\n"); graphPtr = legendPtr->graphPtr; if (graphPtr->pageSetup->flags & PS_DECORATIONS) { - if (legendPtr->normalBg != NULL) + if (legendPtr->normalBg) Blt_Ps_Fill3DRectangle(ps, legendPtr->normalBg, x, y, width, height, legendPtr->borderWidth, legendPtr->relief); else @@ -1903,7 +1896,7 @@ static Element *GetFirstElement(Graph* graphPtr) Element* elemPtr; elemPtr = Blt_Chain_GetValue(link); - if (elemPtr->label != NULL) { + if (elemPtr->label) { return elemPtr; } } @@ -1919,7 +1912,7 @@ static Element *GetLastElement(Graph* graphPtr) Element* elemPtr; elemPtr = Blt_Chain_GetValue(link); - if (elemPtr->label != NULL) { + if (elemPtr->label) { return elemPtr; } } diff --git a/src/bltGrText.C b/src/bltGrText.C index 5e853d9..6a9986d 100644 --- a/src/bltGrText.C +++ b/src/bltGrText.C @@ -193,7 +193,7 @@ void Blt_GetBoundingBox(int width, int height, float angle, rotHeight = (double)height; break; } - if (bbox != NULL) { + if (bbox) { x = rotWidth * 0.5; y = rotHeight * 0.5; bbox[ll].x = bbox[ul].x = -x; @@ -226,7 +226,7 @@ void Blt_GetBoundingBox(int width, int height, float angle, if (y > yMax) { yMax = y; } - if (bbox != NULL) { + if (bbox) { bbox[i].x = x; bbox[i].y = y; } @@ -399,10 +399,10 @@ void Blt_DrawText(Tk_Window tkwin, Drawable drawable, const char *text, int w1, h1; Point2d rr; - if ((text == NULL) || (*text == '\0')) + if (!text || (*text == '\0')) return; - if ((stylePtr->gc == NULL) || (stylePtr->flags & UPDATE_GC)) + if (!stylePtr->gc || (stylePtr->flags & UPDATE_GC)) Blt_Ts_ResetStyle(tkwin, stylePtr); layout = Tk_ComputeTextLayout(stylePtr->font, text, -1, -1, @@ -420,12 +420,12 @@ void Blt_Ts_ResetStyle(Tk_Window tkwin, TextStyle *stylePtr) gcMask = GCFont; gcValues.font = Tk_FontId(stylePtr->font); - if (stylePtr->color != NULL) { + if (stylePtr->color) { gcMask |= GCForeground; gcValues.foreground = stylePtr->color->pixel; } newGC = Tk_GetGC(tkwin, gcMask, &gcValues); - if (stylePtr->gc != NULL) + if (stylePtr->gc) Tk_FreeGC(Tk_Display(tkwin), stylePtr->gc); stylePtr->gc = newGC; @@ -434,6 +434,6 @@ void Blt_Ts_ResetStyle(Tk_Window tkwin, TextStyle *stylePtr) void Blt_Ts_FreeStyle(Display *display, TextStyle *stylePtr) { - if (stylePtr->gc != NULL) + if (stylePtr->gc) Tk_FreeGC(display, stylePtr->gc); } |