summaryrefslogtreecommitdiffstats
path: root/generic/tkPack.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-01-11 10:35:25 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-01-11 10:35:25 (GMT)
commitb1247c27b40bfccec96025d912ed063e9280eda0 (patch)
treef702bb5a834d3fedfdb013e68590f374b549a61e /generic/tkPack.c
parent0932cd846593a23540c4c74818684c574159831c (diff)
downloadtk-b1247c27b40bfccec96025d912ed063e9280eda0.zip
tk-b1247c27b40bfccec96025d912ed063e9280eda0.tar.gz
tk-b1247c27b40bfccec96025d912ed063e9280eda0.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.c83
1 files changed, 1 insertions, 82 deletions
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 4519462..269e395 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.20 2005/01/09 17:46:49 chengyemao Exp $
+ * RCS: @(#) $Id: tkPack.c,v 1.21 2005/01/11 10:35:27 dkf Exp $
*/
#include "tkPort.h"
@@ -1046,87 +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);
-
- while(*padSpec && isspace(UCHAR(*padSpec))) padSpec++;
- 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