summaryrefslogtreecommitdiffstats
path: root/generic/tkPack.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-01-11 10:46:37 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-01-11 10:46:37 (GMT)
commitb394b866b6cf9b57b603d95b820570b119439fee (patch)
tree5c852c4af5d1b9344503dd2d99590fe03b4ae485 /generic/tkPack.c
parent81d9c06d1ce5cfb61913049037b3f03977cb7cc7 (diff)
downloadtk-b394b866b6cf9b57b603d95b820570b119439fee.zip
tk-b394b866b6cf9b57b603d95b820570b119439fee.tar.gz
tk-b394b866b6cf9b57b603d95b820570b119439fee.tar.bz2
Improved version of Michael Kirkham's fix for parsing pad values. [1098779]
Diffstat (limited to 'generic/tkPack.c')
-rw-r--r--generic/tkPack.c82
1 files changed, 1 insertions, 81 deletions
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 5ea54cc..6a57384 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPack.c,v 1.16.2.1 2003/07/17 03:17:08 dgp Exp $
+ * RCS: @(#) $Id: tkPack.c,v 1.16.2.2 2005/01/11 10:46:39 dkf Exp $
*/
#include "tkPort.h"
@@ -1046,86 +1046,6 @@ GetPacker(tkwin)
/*
*--------------------------------------------------------------
*
- * TkParsePadAmount --
- *
- * This procedure parses a padding specification and returns
- * the appropriate padding values. A padding specification can
- * be either a single pixel width, or a list of two pixel widths.
- * If a single pixel width, the amount specified is used for
- * padding on both sides. If two amounts are specified, then
- * they specify the left/right or top/bottom padding.
- *
- * Results:
- * A standard Tcl return value.
- *
- * Side effects:
- * An error message is written to the interpreter is something
- * is not right.
- *
- *--------------------------------------------------------------
- */
-
-int
-TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* A window. Needed by Tk_GetPixels() */
- Tcl_Obj *specObj; /* The argument to "-padx", "-pady", "-ipadx",
- * or "-ipady". The thing to be parsed. */
- int *halfPtr; /* Write the left/top part of padding here */
- int *allPtr; /* Write the total padding here */
-{
- char *secondPart; /* The second pixel amount of the list */
- char *separator = 0; /* Separator between 1st and 2nd pixel widths */
- int sepChar = 0; /* Character used as the separator */
- int firstInt, secondInt; /* The two components of the padding */
- char *padSpec = Tcl_GetString(specObj);
-
- for (secondPart=padSpec;
- (*secondPart != '\0') && !isspace(UCHAR(*secondPart));
- secondPart++)
- { /* Do nothing */ }
- if (*secondPart != '\0') {
- separator = secondPart;
- sepChar = *secondPart;
- *secondPart = '\0';
- secondPart++;
- while ( isspace(UCHAR(*secondPart)) ) {
- secondPart++;
- }
- if (*secondPart == '\0'){
- secondPart = 0;
- *separator = sepChar;
- }
- } else {
- secondPart = 0;
- }
- if ((Tk_GetPixels(interp, tkwin, padSpec, &firstInt) != TCL_OK) ||
- (firstInt < 0)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad pad value \"", padSpec,
- "\": must be positive screen distance", (char *) NULL);
- return TCL_ERROR;
- }
- if (secondPart) {
- if ((Tk_GetPixels(interp, tkwin, secondPart, &secondInt) != TCL_OK) ||
- (secondInt < 0)) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad 2nd pad value \"", secondPart,
- "\": must be positive screen distance", (char *) NULL);
- return TCL_ERROR;
- }
- *separator = sepChar;
- } else {
- secondInt = firstInt;
- }
- if (halfPtr != 0) *halfPtr = firstInt;
- *allPtr = firstInt + secondInt;
- return TCL_OK;
-}
-
-/*
- *--------------------------------------------------------------
- *
* PackAfter --
*
* This procedure does most of the real work of adding