summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkLayout.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/ttk/ttkLayout.c')
-rw-r--r--generic/ttk/ttkLayout.c65
1 files changed, 30 insertions, 35 deletions
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index ba24589..58c99eb 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -326,9 +326,8 @@ int Ttk_GetPaddingFromObj(
if (padc > 4) {
if (interp) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Wrong #elements in padding spec", -1));
- Tcl_SetErrorCode(interp, "TTK", "VALUE", "PADDING", NULL);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Wrong #elements in padding spec", NULL);
}
goto error;
}
@@ -364,9 +363,8 @@ int Ttk_GetBorderFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Padding *pad)
if (padc > 4) {
if (interp) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "Wrong #elements in padding spec", -1));
- Tcl_SetErrorCode(interp, "TTK", "VALUE", "BORDER", NULL);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Wrong #elements in border spec", NULL);
}
goto error;
}
@@ -478,10 +476,11 @@ int Ttk_GetStickyFromObj(
case 's': case 'S': sticky |= TTK_STICK_S; break;
default:
if (interp) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Bad -sticky specification %s",
- Tcl_GetString(objPtr)));
- Tcl_SetErrorCode(interp, "TTK", "VALUE", "STICKY", NULL);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Bad -sticky specification ",
+ Tcl_GetString(objPtr),
+ NULL);
}
return TCL_ERROR;
}
@@ -525,7 +524,7 @@ struct Ttk_LayoutNode_
static Ttk_LayoutNode *Ttk_NewLayoutNode(
unsigned flags, Ttk_ElementClass *elementClass)
{
- Ttk_LayoutNode *node = ckalloc(sizeof(*node));
+ Ttk_LayoutNode *node = (Ttk_LayoutNode*)ckalloc(sizeof(*node));
node->flags = flags;
node->eclass = elementClass;
@@ -541,7 +540,7 @@ static void Ttk_FreeLayoutNode(Ttk_LayoutNode *node)
while (node) {
Ttk_LayoutNode *next = node->next;
Ttk_FreeLayoutNode(node->child);
- ckfree(node);
+ ckfree((ClientData)node);
node = next;
}
}
@@ -558,7 +557,7 @@ struct Ttk_TemplateNode_ {
static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags)
{
- Ttk_TemplateNode *op = ckalloc(sizeof(*op));
+ Ttk_TemplateNode *op = (Ttk_TemplateNode*)ckalloc(sizeof(*op));
op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name);
op->flags = flags;
op->next = op->child = 0;
@@ -571,7 +570,7 @@ void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate op)
Ttk_LayoutTemplate next = op->next;
Ttk_FreeLayoutTemplate(op->child);
ckfree(op->name);
- ckfree(op);
+ ckfree((ClientData)op);
op = next;
}
}
@@ -636,25 +635,25 @@ Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr)
if (optName[0] != '-')
break;
- if (Tcl_GetIndexFromObjStruct(interp, objv[i], optStrings,
- sizeof(char *), "option", 0, &option)
+ if (Tcl_GetIndexFromObj(
+ interp, objv[i], optStrings, "option", 0, &option)
!= TCL_OK)
{
goto error;
}
if (++i >= objc) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Missing value for option %s",
- Tcl_GetString(objv[i-1])));
- Tcl_SetErrorCode(interp, "TTK", "VALUE", "LAYOUT", NULL);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp,
+ "Missing value for option ",Tcl_GetString(objv[i-1]),
+ NULL);
goto error;
}
switch (option) {
case OP_SIDE: /* <<NOTE-PACKSIDE>> */
- if (Tcl_GetIndexFromObjStruct(interp, objv[i], packSideStrings,
- sizeof(char *), "side", 0, &value) != TCL_OK)
+ if (Tcl_GetIndexFromObj(interp, objv[i], packSideStrings,
+ "side", 0, &value) != TCL_OK)
{
goto error;
}
@@ -791,7 +790,7 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node)
int side = 0;
unsigned sideFlags = flags & _TTK_MASK_PACK;
- while (!(sideFlags & TTK_PACK_LEFT)) {
+ while ((sideFlags & TTK_PACK_LEFT) == 0) {
++side;
sideFlags >>= 1;
}
@@ -800,11 +799,9 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node)
}
}
- /*
- * In Ttk_ParseLayoutTemplate, default -sticky is "nsew", so always
- * include this even if no sticky bits are set.
+ /* In Ttk_ParseLayoutTemplate, default -sticky is "nsew",
+ * so always include this even if no sticky bits are set.
*/
-
APPENDSTR("-sticky");
APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK));
@@ -842,7 +839,7 @@ static Ttk_Layout TTKNewLayout(
void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin,
Ttk_LayoutNode *root)
{
- Ttk_Layout layout = ckalloc(sizeof(*layout));
+ Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout));
layout->style = style;
layout->recordPtr = recordPtr;
layout->optionTable = optionTable;
@@ -854,7 +851,7 @@ static Ttk_Layout TTKNewLayout(
void Ttk_FreeLayout(Ttk_Layout layout)
{
Ttk_FreeLayoutNode(layout->root);
- ckfree(layout);
+ ckfree((ClientData)layout);
}
/*
@@ -878,9 +875,8 @@ Ttk_Layout Ttk_CreateLayout(
Ttk_LayoutNode *bgnode;
if (!layoutTemplate) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Layout %s not found", styleName));
- Tcl_SetErrorCode(interp, "TTK", "LOOKUP", "LAYOUT", styleName, NULL);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Layout ", styleName, " not found", NULL);
return 0;
}
@@ -919,9 +915,8 @@ Ttk_CreateSublayout(
layoutTemplate = Ttk_FindLayoutTemplate(themePtr, styleName);
if (!layoutTemplate) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Layout %s not found", styleName));
- Tcl_SetErrorCode(interp, "TTK", "LOOKUP", "LAYOUT", styleName, NULL);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "Layout ", styleName, " not found", NULL);
return 0;
}