summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkCanvBmap.c4
-rw-r--r--generic/tkCanvImg.c4
-rw-r--r--generic/tkCanvPs.c16
-rw-r--r--generic/tkCanvText.c37
-rw-r--r--generic/tkCanvWind.c4
-rw-r--r--generic/tkPack.c4
-rw-r--r--generic/tkPlace.c2
-rw-r--r--generic/tkUtil.c32
-rw-r--r--generic/ttk/ttkButton.c14
-rw-r--r--generic/ttk/ttkLayout.c3
-rw-r--r--win/tkWinGDI.c2
11 files changed, 55 insertions, 67 deletions
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index 18618b3..69a37bd 100644
--- a/generic/tkCanvBmap.c
+++ b/generic/tkCanvBmap.c
@@ -540,7 +540,7 @@ ComputeBitmapBbox(
break;
case TK_ANCHOR_NW:
break;
- case TK_ANCHOR_CENTER:
+ default:
x -= width/2;
y -= height/2;
break;
@@ -945,7 +945,7 @@ BitmapToPostscript(
case TK_ANCHOR_S: x -= width/2.0; break;
case TK_ANCHOR_SW: break;
case TK_ANCHOR_W: y -= height/2.0; break;
- case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
+ default: x -= width/2.0; y -= height/2.0; break;
}
/*
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index fcdebf0..16b8345 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -491,7 +491,7 @@ ComputeImageBbox(
break;
case TK_ANCHOR_NW:
break;
- case TK_ANCHOR_CENTER:
+ default:
x -= width/2;
y -= height/2;
break;
@@ -747,7 +747,7 @@ ImageToPostscript(
case TK_ANCHOR_S: x -= width/2.0; break;
case TK_ANCHOR_SW: break;
case TK_ANCHOR_W: y -= height/2.0; break;
- case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
+ default: x -= width/2.0; y -= height/2.0; break;
}
if (!prepass) {
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index b1e7b72..8266536 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -285,16 +285,14 @@ TkCanvPostscriptCmd(
case TK_ANCHOR_SW:
deltaX = 0;
break;
- case TK_ANCHOR_N:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_S:
- deltaX = -psInfo.width/2;
- break;
case TK_ANCHOR_NE:
case TK_ANCHOR_E:
case TK_ANCHOR_SE:
deltaX = -psInfo.width;
break;
+ default:
+ deltaX = -psInfo.width/2;
+ break;
}
switch (psInfo.pageAnchor) {
case TK_ANCHOR_NW:
@@ -302,16 +300,14 @@ TkCanvPostscriptCmd(
case TK_ANCHOR_NE:
deltaY = - psInfo.height;
break;
- case TK_ANCHOR_W:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_E:
- deltaY = -psInfo.height/2;
- break;
case TK_ANCHOR_SW:
case TK_ANCHOR_S:
case TK_ANCHOR_SE:
deltaY = 0;
break;
+ default:
+ deltaY = -psInfo.height/2;
+ break;
}
if (psInfo.colorMode == NULL) {
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 4a928ad..ef3932c 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -755,15 +755,6 @@ ComputeTextBbox(
case TK_ANCHOR_NE:
break;
- case TK_ANCHOR_W:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_E:
- topY -= height / 2;
- for (i=0 ; i<4 ; i++) {
- dy[i] = -height / 2;
- }
- break;
-
case TK_ANCHOR_SW:
case TK_ANCHOR_S:
case TK_ANCHOR_SE:
@@ -772,6 +763,13 @@ ComputeTextBbox(
dy[i] = -height;
}
break;
+
+ default:
+ topY -= height / 2;
+ for (i=0 ; i<4 ; i++) {
+ dy[i] = -height / 2;
+ }
+ break;
}
switch (textPtr->anchor) {
case TK_ANCHOR_NW:
@@ -779,15 +777,6 @@ ComputeTextBbox(
case TK_ANCHOR_SW:
break;
- case TK_ANCHOR_N:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_S:
- leftX -= width / 2;
- for (i=0 ; i<4 ; i++) {
- dx[i] = -width / 2;
- }
- break;
-
case TK_ANCHOR_NE:
case TK_ANCHOR_E:
case TK_ANCHOR_SE:
@@ -796,6 +785,13 @@ ComputeTextBbox(
dx[i] = -width;
}
break;
+
+ default:
+ leftX -= width / 2;
+ for (i=0 ; i<4 ; i++) {
+ dx[i] = -width / 2;
+ }
+ break;
}
textPtr->actualWidth = width;
@@ -1734,7 +1730,6 @@ TextToPostscript(
Tcl_GetString(Tcl_GetObjResult(interp)));
}
- x = 0; y = 0; justify = NULL;
switch (textPtr->anchor) {
case TK_ANCHOR_NW: x = 0; y = 0; break;
case TK_ANCHOR_N: x = 1; y = 0; break;
@@ -1744,12 +1739,12 @@ TextToPostscript(
case TK_ANCHOR_S: x = 1; y = 2; break;
case TK_ANCHOR_SW: x = 0; y = 2; break;
case TK_ANCHOR_W: x = 0; y = 1; break;
- case TK_ANCHOR_CENTER: x = 1; y = 1; break;
+ default: x = 1; y = 1; break;
}
switch (textPtr->justify) {
- case TK_JUSTIFY_LEFT: justify = "0"; break;
case TK_JUSTIFY_CENTER: justify = "0.5"; break;
case TK_JUSTIFY_RIGHT: justify = "1"; break;
+ default: justify = "0"; break;
}
Tk_GetFontMetrics(textPtr->tkfont, &fm);
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index 9de843a..3031a94 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -518,7 +518,7 @@ ComputeWindowBbox(
break;
case TK_ANCHOR_NW:
break;
- case TK_ANCHOR_CENTER:
+ default:
x -= width/2;
y -= height/2;
break;
@@ -826,7 +826,7 @@ WinItemToPostscript(
case TK_ANCHOR_S: x -= width/2.0; break;
case TK_ANCHOR_SW: break;
case TK_ANCHOR_W: y -= height/2.0; break;
- case TK_ANCHOR_CENTER: x -= width/2.0; y -= height/2.0; break;
+ default: x -= width/2.0; y -= height/2.0; break;
}
return CanvasPsWindow(interp, tkwin, canvas, x, y, width, height);
diff --git a/generic/tkPack.c b/generic/tkPack.c
index ac5d73f..dd8977c 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -826,12 +826,10 @@ ArrangePacking(
x = frameX + borderLeft;
y = frameY + borderTop;
break;
- case TK_ANCHOR_CENTER:
+ default:
x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
y = frameY + (borderTop + frameHeight - height - borderBtm)/2;
break;
- default:
- Tcl_Panic("bad frame factor in ArrangePacking");
}
width -= contentPtr->doubleBw;
height -= contentPtr->doubleBw;
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 8e26c71..7818976 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -1010,7 +1010,7 @@ RecomputePlacement(
break;
case TK_ANCHOR_NW:
break;
- case TK_ANCHOR_CENTER:
+ default:
x -= width/2;
y -= height/2;
break;
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index e83731d..41ac565 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -820,17 +820,17 @@ TkComputeAnchor(
*xPtr = Tk_InternalBorderLeft(tkwin) + padX;
break;
- case TK_ANCHOR_N:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_S:
- *xPtr = (Tk_Width(tkwin) - innerWidth - Tk_InternalBorderLeft(tkwin) -
- Tk_InternalBorderRight(tkwin)) / 2 +
- Tk_InternalBorderLeft(tkwin);
+ case TK_ANCHOR_NE:
+ case TK_ANCHOR_E:
+ case TK_ANCHOR_SE:
+ *xPtr = Tk_Width(tkwin) - Tk_InternalBorderRight(tkwin) - padX
+ - innerWidth;
break;
default:
- *xPtr = Tk_Width(tkwin) - Tk_InternalBorderRight(tkwin) - padX
- - innerWidth;
+ *xPtr = (Tk_Width(tkwin) - innerWidth - Tk_InternalBorderLeft(tkwin) -
+ Tk_InternalBorderRight(tkwin)) / 2 +
+ Tk_InternalBorderLeft(tkwin);
break;
}
@@ -845,17 +845,17 @@ TkComputeAnchor(
*yPtr = Tk_InternalBorderTop(tkwin) + padY;
break;
- case TK_ANCHOR_W:
- case TK_ANCHOR_CENTER:
- case TK_ANCHOR_E:
- *yPtr = (Tk_Height(tkwin) - innerHeight- Tk_InternalBorderTop(tkwin) -
- Tk_InternalBorderBottom(tkwin)) / 2 +
- Tk_InternalBorderTop(tkwin);
+ case TK_ANCHOR_SW:
+ case TK_ANCHOR_S:
+ case TK_ANCHOR_SE:
+ *yPtr = Tk_Height(tkwin) - Tk_InternalBorderBottom(tkwin) - padY
+ - innerHeight;
break;
default:
- *yPtr = Tk_Height(tkwin) - Tk_InternalBorderBottom(tkwin) - padY
- - innerHeight;
+ *yPtr = (Tk_Height(tkwin) - innerHeight- Tk_InternalBorderTop(tkwin) -
+ Tk_InternalBorderBottom(tkwin)) / 2 +
+ Tk_InternalBorderTop(tkwin);
break;
}
}
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index f8a59a8..c98e7e6 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -57,8 +57,8 @@ typedef struct
static const Tk_OptionSpec BaseOptionSpecs[] =
{
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
- "left", offsetof(Base,base.justifyObj), TCL_INDEX_NONE,
- TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ "left", offsetof(Base,base.justifyObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-text", "text", "Text", "",
offsetof(Base,base.textObj), TCL_INDEX_NONE,
0,0,GEOMETRY_CHANGED },
@@ -83,9 +83,9 @@ static const Tk_OptionSpec BaseOptionSpecs[] =
* Compound base/image options
*/
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
- NULL, offsetof(Base,base.compoundObj), TCL_INDEX_NONE,
- TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
- GEOMETRY_CHANGED },
+ NULL, offsetof(Base,base.compoundObj), TCL_INDEX_NONE,
+ TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
+ GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Pad",
NULL, offsetof(Base,base.paddingObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED},
@@ -94,8 +94,8 @@ static const Tk_OptionSpec BaseOptionSpecs[] =
* Compatibility/legacy options
*/
{TK_OPTION_STRING, "-state", "state", "State",
- "normal", offsetof(Base,base.stateObj), TCL_INDEX_NONE,
- 0,0,STATE_CHANGED },
+ "normal", offsetof(Base,base.stateObj), TCL_INDEX_NONE,
+ 0,0,STATE_CHANGED },
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
};
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index b91c24d..a0be383 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -220,8 +220,7 @@ static Ttk_Sticky AnchorToSticky(Tk_Anchor anchor)
case TK_ANCHOR_SW: return TTK_STICK_S | TTK_STICK_W;
case TK_ANCHOR_W: return TTK_STICK_W;
case TK_ANCHOR_NW: return TTK_STICK_N | TTK_STICK_W;
- default:
- case TK_ANCHOR_CENTER: return 0;
+ default: return 0;
}
}
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c
index 7c6705a..9daca0f 100644
--- a/win/tkWinGDI.c
+++ b/win/tkWinGDI.c
@@ -1628,7 +1628,7 @@ int GdiText(
case TK_ANCHOR_SW:
y = (sizerect.bottom - sizerect.top);
break;
- case TK_ANCHOR_CENTER:
+ default:
x = (sizerect.right - sizerect.left) / 2;
y = (sizerect.bottom - sizerect.top) / 2;
break;