summaryrefslogtreecommitdiffstats
path: root/generic/tkPanedWindow.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkPanedWindow.c')
-rw-r--r--generic/tkPanedWindow.c972
1 files changed, 498 insertions, 474 deletions
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index e4a6625..36002b4 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -1,25 +1,26 @@
/*
* tkPanedWindow.c --
*
- * This module implements "paned window" widgets that are object
- * based. A "paned window" is a widget that manages the geometry for
- * some number of other widgets, placing a movable "sash" between them,
- * which can be used to alter the relative sizes of adjacent widgets.
+ * This module implements "paned window" widgets that are object based. A
+ * "paned window" is a widget that manages the geometry for some number
+ * of other widgets, placing a movable "sash" between them, which can be
+ * used to alter the relative sizes of adjacent widgets.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
* Copyright (c) 2000 Ajuba Solutions.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPanedWindow.c,v 1.23 2005/05/31 05:23:44 hobbs Exp $
+ * RCS: @(#) $Id: tkPanedWindow.c,v 1.24 2005/11/15 15:18:22 dkf Exp $
*/
#include "tkPort.h"
#include "default.h"
#include "tkInt.h"
-/* Flag values for "sticky"ness The 16 combinations subsume the packer's
+/*
+ * Flag values for "sticky"ness. The 16 combinations subsume the packer's
* notion of anchor and fill.
*
* STICK_NORTH This window sticks to the top of its cavity.
@@ -38,7 +39,7 @@
*/
static char *orientStrings[] = {
- "horizontal", "vertical", (char *) NULL
+ "horizontal", "vertical", NULL
};
enum orient { ORIENT_HORIZONTAL, ORIENT_VERTICAL };
@@ -48,7 +49,7 @@ enum orient { ORIENT_HORIZONTAL, ORIENT_VERTICAL };
*/
static char *stretchStrings[] = {
- "always", "first", "last", "middle", "never", (char *) NULL
+ "always", "first", "last", "middle", "never", NULL
};
enum stretch {
@@ -81,37 +82,38 @@ typedef struct {
*/
typedef struct Slave {
- Tk_Window tkwin; /* Window being managed. */
-
- int minSize; /* Minimum size of this pane, on the
- * relevant axis, in pixels. */
- int padx; /* Additional padding requested for
- * slave, in the x dimension. */
- int pady; /* Additional padding requested for
- * slave, in the y dimension. */
- Tcl_Obj *widthPtr, *heightPtr; /* Tcl_Obj rep's of slave width/height,
- * to allow for null values. */
- int width; /* Slave width. */
- int height; /* Slave height. */
- int sticky; /* Sticky string. */
- int x, y; /* Coordinates of the widget. */
- int paneWidth, paneHeight; /* Pane dimensions (may be different
- * from slave width/height). */
- int sashx, sashy; /* Coordinates of the sash of the
- * right or bottom of this pane. */
- int markx, marky; /* Coordinates of the last mark set
- * for the sash. */
- int handlex, handley; /* Coordinates of the sash handle. */
- enum stretch stretch; /* Controls how slave grows/shrinks */
- int hide; /* Controls visibility of pane */
- struct PanedWindow *masterPtr; /* Paned window managing the window. */
- Tk_Window after; /* Placeholder for parsing options. */
- Tk_Window before; /* Placeholder for parsing options. */
+ Tk_Window tkwin; /* Window being managed. */
+ int minSize; /* Minimum size of this pane, on the relevant
+ * axis, in pixels. */
+ int padx; /* Additional padding requested for slave, in
+ * the x dimension. */
+ int pady; /* Additional padding requested for slave, in
+ * the y dimension. */
+ Tcl_Obj *widthPtr, *heightPtr;
+ /* Tcl_Obj rep's of slave width/height, to
+ * allow for null values. */
+ int width; /* Slave width. */
+ int height; /* Slave height. */
+ int sticky; /* Sticky string. */
+ int x, y; /* Coordinates of the widget. */
+ int paneWidth, paneHeight; /* Pane dimensions (may be different from
+ * slave width/height). */
+ int sashx, sashy; /* Coordinates of the sash of the right or
+ * bottom of this pane. */
+ int markx, marky; /* Coordinates of the last mark set for the
+ * sash. */
+ int handlex, handley; /* Coordinates of the sash handle. */
+ enum stretch stretch; /* Controls how slave grows/shrinks */
+ int hide; /* Controls visibility of pane */
+ struct PanedWindow *masterPtr;
+ /* Paned window managing the window. */
+ Tk_Window after; /* Placeholder for parsing options. */
+ Tk_Window before; /* Placeholder for parsing options. */
} Slave;
/*
- * A data structure of the following type is kept for each paned window
- * widget managed by this file:
+ * A data structure of the following type is kept for each paned window widget
+ * managed by this file:
*/
typedef struct PanedWindow {
@@ -133,7 +135,6 @@ typedef struct PanedWindow {
Tk_Cursor cursor; /* Current cursor for window, or None. */
int resizeOpaque; /* Boolean indicating whether resize should be
* opaque or rubberband style. */
-
int sashRelief; /* Relief used to draw sash. */
int sashWidth; /* Width of each sash, in pixels. */
Tcl_Obj *sashWidthPtr; /* Tcl_Obj rep for sash width. */
@@ -146,7 +147,6 @@ typedef struct PanedWindow {
int handlePad; /* Distance from border to draw handle. */
Tcl_Obj *handleSizePtr; /* Tcl_Obj rep for handle size. */
Tk_Cursor sashCursor; /* Cursor used when mouse is above a sash. */
-
GC gc; /* Graphics context for copying from
* off-screen pixmap onto screen. */
int proxyx, proxyy; /* Proxy x,y coordinates. */
@@ -159,11 +159,11 @@ typedef struct PanedWindow {
/*
* Flags used for paned windows:
*
- * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has
- * been queued to redraw this window.
+ * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has been
+ * queued to redraw this window.
*
- * WIDGET_DELETED: Non-zero means that the paned window has
- * been, or is in the process of being, deleted.
+ * WIDGET_DELETED: Non-zero means that the paned window has been,
+ * or is in the process of being, deleted.
*
* RESIZE_PENDING: Non-zero means that the window might need to
* change its size (or the size of its panes)
@@ -179,59 +179,63 @@ typedef struct PanedWindow {
#define RESIZE_PENDING 0x0020
/*
- * Forward declarations for procedures defined later in this file:
+ * Forward declarations for functions defined later in this file:
*/
-int Tk_PanedWindowObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static void PanedWindowCmdDeletedProc _ANSI_ARGS_((ClientData clientData));
-static int ConfigurePanedWindow _ANSI_ARGS_((Tcl_Interp *interp,
- PanedWindow *pwPtr, int objc, Tcl_Obj *CONST objv[]));
-static void DestroyPanedWindow _ANSI_ARGS_((PanedWindow *pwPtr));
-static void DisplayPanedWindow _ANSI_ARGS_((ClientData clientData));
-static void PanedWindowEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void ProxyWindowEventProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void DisplayProxyWindow _ANSI_ARGS_((ClientData clientData));
-static void PanedWindowWorldChanged _ANSI_ARGS_((ClientData instanceData));
-static int PanedWindowWidgetObjCmd _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]));
-static void PanedWindowLostSlaveProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void PanedWindowReqProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void ArrangePanes _ANSI_ARGS_((ClientData clientData));
-static void Unlink _ANSI_ARGS_((Slave *slavePtr));
-static Slave * GetPane _ANSI_ARGS_((PanedWindow *pwPtr, Tk_Window tkwin));
-static void SlaveStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static int PanedWindowSashCommand _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static int PanedWindowProxyCommand _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static void ComputeGeometry _ANSI_ARGS_((PanedWindow *pwPtr));
-static int ConfigureSlaves _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]));
-static void DestroyOptionTables _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp));
-static int SetSticky _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, Tk_Window tkwin,
- Tcl_Obj **value, char *recordPtr, int internalOffset,
- char *oldInternalPtr, int flags));
-static Tcl_Obj *GetSticky _ANSI_ARGS_((ClientData clientData, Tk_Window tkwin,
- char *recordPtr, int internalOffset));
-static void RestoreSticky _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin, char *internalPtr,
- char *oldInternalPtr));
-static void AdjustForSticky _ANSI_ARGS_((int sticky, int cavityWidth,
- int cavityHeight, int *xPtr, int *yPtr,
- int *slaveWidthPtr, int *slaveHeightPtr));
-static void MoveSash _ANSI_ARGS_((PanedWindow *pwPtr, int sash, int diff));
-static int ObjectIsEmpty _ANSI_ARGS_((Tcl_Obj *objPtr));
-static char * ComputeSlotAddress _ANSI_ARGS_((char *recordPtr, int offset));
-static int PanedWindowIdentifyCoords _ANSI_ARGS_((PanedWindow *pwPtr,
- Tcl_Interp *interp, int x, int y));
+int Tk_PanedWindowObjCmd(ClientData clientData,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *CONST objv[]);
+static void PanedWindowCmdDeletedProc(ClientData clientData);
+static int ConfigurePanedWindow(Tcl_Interp *interp,
+ PanedWindow *pwPtr, int objc,
+ Tcl_Obj *CONST objv[]);
+static void DestroyPanedWindow(PanedWindow *pwPtr);
+static void DisplayPanedWindow(ClientData clientData);
+static void PanedWindowEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void ProxyWindowEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void DisplayProxyWindow(ClientData clientData);
+static void PanedWindowWorldChanged(ClientData instanceData);
+static int PanedWindowWidgetObjCmd(ClientData clientData,
+ Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]);
+static void PanedWindowLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
+static void PanedWindowReqProc(ClientData clientData,
+ Tk_Window tkwin);
+static void ArrangePanes(ClientData clientData);
+static void Unlink(Slave *slavePtr);
+static Slave * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
+static void SlaveStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static int PanedWindowSashCommand(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
+static int PanedWindowProxyCommand(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
+static void ComputeGeometry(PanedWindow *pwPtr);
+static int ConfigureSlaves(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj * CONST objv[]);
+static void DestroyOptionTables(ClientData clientData,
+ Tcl_Interp *interp);
+static int SetSticky(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj **value, char *recordPtr,
+ int internalOffset, char *oldInternalPtr,
+ int flags);
+static Tcl_Obj * GetSticky(ClientData clientData, Tk_Window tkwin,
+ char *recordPtr, int internalOffset);
+static void RestoreSticky(ClientData clientData, Tk_Window tkwin,
+ char *internalPtr, char *oldInternalPtr);
+static void AdjustForSticky(int sticky, int cavityWidth,
+ int cavityHeight, int *xPtr, int *yPtr,
+ int *slaveWidthPtr, int *slaveHeightPtr);
+static void MoveSash(PanedWindow *pwPtr, int sash, int diff);
+static int ObjectIsEmpty(Tcl_Obj *objPtr);
+static char * ComputeSlotAddress(char *recordPtr, int offset);
+static int PanedWindowIdentifyCoords(PanedWindow *pwPtr,
+ Tcl_Interp *interp, int x, int y);
/*
* Sashes are between panes only, so there is one less sash than slaves
@@ -258,11 +262,11 @@ static Tk_GeomMgr panedWindowMgrType = {
*/
static Tk_ObjCustomOption stickyOption = {
- "sticky", /* name */
- SetSticky, /* setProc */
- GetSticky, /* getProc */
- RestoreSticky, /* restoreProc */
- (Tk_CustomOptionFreeProc *)NULL, /* freeProc */
+ "sticky", /* name */
+ SetSticky, /* setProc */
+ GetSticky, /* getProc */
+ RestoreSticky, /* restoreProc */
+ NULL, /* freeProc */
0
};
@@ -270,10 +274,10 @@ static Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_PANEDWINDOW_BG_COLOR, -1, Tk_Offset(PanedWindow, background), 0,
(ClientData) DEF_PANEDWINDOW_BG_MONO},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth"},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background"},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth"},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background"},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_PANEDWINDOW_BORDERWIDTH, -1, Tk_Offset(PanedWindow, borderWidth),
0, 0, GEOMETRY},
@@ -319,43 +323,42 @@ static Tk_OptionSpec optionSpecs[] = {
};
static Tk_OptionSpec slaveOptionSpecs[] = {
- {TK_OPTION_WINDOW, "-after", (char *) NULL, (char *) NULL,
+ {TK_OPTION_WINDOW, "-after", NULL, NULL,
DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Slave, after),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_WINDOW, "-before", (char *) NULL, (char *) NULL,
+ {TK_OPTION_WINDOW, "-before", NULL, NULL,
DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Slave, before),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-height", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-height", NULL, NULL,
DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Slave, heightPtr),
Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Slave, hide), 0,0,GEOMETRY},
- {TK_OPTION_PIXELS, "-minsize", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-minsize", NULL, NULL,
DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Slave, minSize), 0, 0, 0},
- {TK_OPTION_PIXELS, "-padx", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-padx", NULL, NULL,
DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Slave, padx), 0, 0, 0},
- {TK_OPTION_PIXELS, "-pady", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-pady", NULL, NULL,
DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Slave, pady), 0, 0, 0},
- {TK_OPTION_CUSTOM, "-sticky", (char *) NULL, (char *) NULL,
+ {TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Slave, sticky), 0,
(ClientData) &stickyOption, 0},
{TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Slave, stretch), 0,
(ClientData) stretchStrings, 0},
- {TK_OPTION_PIXELS, "-width", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-width", NULL, NULL,
DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Slave, widthPtr),
Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END}
};
-
/*
*--------------------------------------------------------------
*
* Tk_PanedWindowObjCmd --
*
- * This procedure is invoked to process the "panedwindow" Tcl
- * command. It creates a new "panedwindow" widget.
+ * This function is invoked to process the "panedwindow" Tcl command. It
+ * creates a new "panedwindow" widget.
*
* Results:
* A standard Tcl result.
@@ -367,11 +370,11 @@ static Tk_OptionSpec slaveOptionSpecs[] = {
*/
int
-Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+Tk_PanedWindowObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj * CONST objv[]) /* Argument objects. */
{
PanedWindow *pwPtr;
Tk_Window tkwin, parent;
@@ -384,7 +387,7 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL);
+ Tcl_GetStringFromObj(objv[1], NULL), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -393,17 +396,25 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
Tcl_GetAssocData(interp, "PanedWindowOptionTables", NULL);
if (pwOpts == NULL) {
/*
- * The first time this procedure is invoked, the option tables will
- * be NULL. We then create the option tables from the templates
- * and store a pointer to the tables as the command's clinical so
- * we'll have easy access to it in the future.
+ * The first time this function is invoked, the option tables will be
+ * NULL. We then create the option tables from the templates and store
+ * a pointer to the tables as the command's clinical so we'll have
+ * easy access to it in the future.
*/
+
pwOpts = (OptionTables *) ckalloc(sizeof(OptionTables));
- /* Set up an exit handler to free the optionTables struct */
+
+ /*
+ * Set up an exit handler to free the optionTables struct.
+ */
+
Tcl_SetAssocData(interp, "PanedWindowOptionTables",
DestroyOptionTables, (ClientData) pwOpts);
- /* Create the paned window option tables. */
+ /*
+ * Create the paned window option tables.
+ */
+
pwOpts->pwOptions = Tk_CreateOptionTable(interp, optionSpecs);
pwOpts->slaveOpts = Tk_CreateOptionTable(interp, slaveOptionSpecs);
}
@@ -416,18 +427,18 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
pwPtr = (PanedWindow *) ckalloc(sizeof(PanedWindow));
memset((void *)pwPtr, 0, (sizeof(PanedWindow)));
- pwPtr->tkwin = tkwin;
- pwPtr->display = Tk_Display(tkwin);
- pwPtr->interp = interp;
- pwPtr->widgetCmd = Tcl_CreateObjCommand(interp,
+ pwPtr->tkwin = tkwin;
+ pwPtr->display = Tk_Display(tkwin);
+ pwPtr->interp = interp;
+ pwPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd,
(ClientData) pwPtr, PanedWindowCmdDeletedProc);
- pwPtr->optionTable = pwOpts->pwOptions;
- pwPtr->slaveOpts = pwOpts->slaveOpts;
- pwPtr->relief = TK_RELIEF_RAISED;
- pwPtr->gc = None;
- pwPtr->cursor = None;
- pwPtr->sashCursor = None;
+ pwPtr->optionTable = pwOpts->pwOptions;
+ pwPtr->slaveOpts = pwOpts->slaveOpts;
+ pwPtr->relief = TK_RELIEF_RAISED;
+ pwPtr->gc = None;
+ pwPtr->cursor = None;
+ pwPtr->sashCursor = None;
/*
* Keep a hold of the associated tkwin until we destroy the widget,
@@ -446,10 +457,11 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
PanedWindowEventProc, (ClientData) pwPtr);
/*
- * Find the toplevel ancestor of the panedwindow, and make a proxy
- * win as a child of that window; this way the proxy can always float
- * above slaves in the panedwindow.
+ * Find the toplevel ancestor of the panedwindow, and make a proxy win as
+ * a child of that window; this way the proxy can always float above
+ * slaves in the panedwindow.
*/
+
parent = Tk_Parent(pwPtr->tkwin);
while (!(Tk_IsTopLevel(parent))) {
parent = Tk_Parent(parent);
@@ -459,15 +471,16 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
}
}
- pwPtr->proxywin = Tk_CreateAnonymousWindow(interp, parent, (char *) NULL);
+ pwPtr->proxywin = Tk_CreateAnonymousWindow(interp, parent, NULL);
+
/*
- * The proxy window has to be able to share GCs with the main
- * panedwindow despite being children of windows with potentially
- * different characteristics, and it looks better that way too.
- * [Bug 702230]
- * Also Set the X window save under attribute to avoid expose events as
- * the proxy sash is dragged across the panes. [Bug 1036963]
+ * The proxy window has to be able to share GCs with the main panedwindow
+ * despite being children of windows with potentially different
+ * characteristics, and it looks better that way too. [Bug 702230] Also
+ * set the X window save under attribute to avoid expose events as the
+ * proxy sash is dragged across the panes. [Bug 1036963]
*/
+
Tk_SetWindowVisual(pwPtr->proxywin,
Tk_Visual(tkwin), Tk_Depth(tkwin), Tk_Colormap(tkwin));
Tk_CreateEventHandler(pwPtr->proxywin, ExposureMask, ProxyWindowEventProc,
@@ -490,9 +503,9 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
*
* PanedWindowWidgetObjCmd --
*
- * This procedure is invoked to process the Tcl command
- * that corresponds to a widget managed by this module.
- * See the user documentation for details on what it does.
+ * This function is invoked to process the Tcl command that corresponds
+ * to a widget managed by this module. See the user documentation for
+ * details on what it does.
*
* Results:
* A standard Tcl result.
@@ -504,17 +517,17 @@ Tk_PanedWindowObjCmd(clientData, interp, objc, objv)
*/
static int
-PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about square widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+PanedWindowWidgetObjCmd(
+ ClientData clientData, /* Information about square widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj * CONST objv[]) /* Argument objects. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
int result = TCL_OK;
static CONST char *optionStrings[] = {
"add", "cget", "configure", "forget", "identify", "panecget",
- "paneconfigure", "panes", "proxy", "sash", (char *) NULL
+ "paneconfigure", "panes", "proxy", "sash", NULL
};
enum options {
PW_ADD, PW_CGET, PW_CONFIGURE, PW_FORGET, PW_IDENTIFY, PW_PANECGET,
@@ -567,7 +580,7 @@ PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
if (objc <= 3) {
resultObj = Tk_GetOptionInfo(interp, (char *) pwPtr,
pwPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL, pwPtr->tkwin);
+ (objc == 3) ? objv[2] : NULL, pwPtr->tkwin);
if (resultObj == NULL) {
result = TCL_ERROR;
} else {
@@ -599,7 +612,7 @@ PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
slavePtr = GetPane(pwPtr, slave);
if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
count++;
- Tk_ManageGeometry(slave, (Tk_GeomMgr *)NULL, (ClientData)NULL);
+ Tk_ManageGeometry(slave, NULL, (ClientData)NULL);
Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
SlaveStructureProc, (ClientData) slavePtr);
@@ -672,7 +685,7 @@ PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
if (pwPtr->slaves[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionInfo(interp,
(char *) pwPtr->slaves[i], pwPtr->slaveOpts,
- (objc == 4) ? objv[3] : (Tcl_Obj *) NULL,
+ (objc == 4) ? objv[3] : NULL,
pwPtr->tkwin);
if (resultObj == NULL) {
result = TCL_ERROR;
@@ -717,25 +730,24 @@ PanedWindowWidgetObjCmd(clientData, interp, objc, objv)
*
* ConfigureSlaves --
*
- * Add or alter the configuration options of a slave in a paned
- * window.
+ * Add or alter the configuration options of a slave in a paned window.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Depends on options; may add a slave to the paned window, may
- * alter the geometry management options of a slave.
+ * Depends on options; may add a slave to the paned window, may alter the
+ * geometry management options of a slave.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(pwPtr, interp, objc, objv)
- PanedWindow *pwPtr; /* Information about paned window. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+ConfigureSlaves(
+ PanedWindow *pwPtr, /* Information about paned window. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc;
int insertIndex;
@@ -745,11 +757,11 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
char *arg;
/*
- * Find the non-window name arguments; these are the configure options
- * for the slaves. Also validate that the window names given are
- * legitimate (ie, they are real windows, they are not the panedwindow
- * itself, etc.).
+ * Find the non-window name arguments; these are the configure options for
+ * the slaves. Also validate that the window names given are legitimate
+ * (ie, they are real windows, they are not the panedwindow itself, etc.).
*/
+
for (i = 2; i < objc; i++) {
arg = Tcl_GetString(objv[i]);
if (arg[0] == '-') {
@@ -761,28 +773,32 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
* Just a plain old bad window; Tk_NameToWindow filled in an
* error message for us.
*/
+
return TCL_ERROR;
} else if (tkwin == pwPtr->tkwin) {
/*
* A panedwindow cannot manage itself.
*/
+
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "can't add ", arg, " to itself",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
} else if (Tk_IsTopLevel(tkwin)) {
/*
* A panedwindow cannot manage a toplevel.
*/
+
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "can't add toplevel ", arg, " to ",
- Tk_PathName(pwPtr->tkwin), (char *) NULL);
+ Tk_PathName(pwPtr->tkwin), NULL);
return TCL_ERROR;
} else {
/*
* Make sure the panedwindow is the parent of the slave,
* or a descendant of the slave's parent.
*/
+
parent = Tk_Parent(tkwin);
for (ancestor = pwPtr->tkwin;;ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
@@ -790,9 +806,8 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
}
if (Tk_IsTopLevel(ancestor)) {
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "can't add ", arg,
- " to ", Tk_PathName(pwPtr->tkwin),
- (char *) NULL);
+ Tcl_AppendResult(interp, "can't add ", arg, " to ",
+ Tk_PathName(pwPtr->tkwin), NULL);
return TCL_ERROR;
}
}
@@ -803,10 +818,11 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Pre-parse the configuration options, to get the before/after specifiers
- * into an easy-to-find location (a local variable). Also, check the
+ * into an easy-to-find location (a local variable). Also, check the
* return from Tk_SetOptions once, here, so we can save a little bit of
* extra testing in the for loop below.
*/
+
memset((void *)&options, 0, sizeof(Slave));
if (Tk_SetOptions(interp, (char *) &options, pwPtr->slaveOpts,
objc - firstOptionArg, objv + firstOptionArg,
@@ -816,9 +832,10 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* If either -after or -before was given, find the numerical index that
- * corresponds to the given window. If both -after and -before are
- * given, the option precedence is: -after, then -before.
+ * corresponds to the given window. If both -after and -before are given,
+ * the option precedence is: -after, then -before.
*/
+
index = -1;
haveLoc = 0;
if (options.after != None) {
@@ -842,14 +859,14 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
}
/*
- * If a window was given for -after/-before, but it's not a window
- * managed by the panedwindow, throw an error
+ * If a window was given for -after/-before, but it's not a window managed
+ * by the panedwindow, throw an error
*/
+
if (haveLoc && index == -1) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "window \"", Tk_PathName(tkwin),
- "\" is not managed by ", Tk_PathName(pwPtr->tkwin),
- (char *) NULL);
+ "\" is not managed by ", Tk_PathName(pwPtr->tkwin), NULL);
Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts,
pwPtr->tkwin);
return TCL_ERROR;
@@ -857,23 +874,26 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Allocate an array to hold, in order, the pointers to the slave
- * structures corresponding to the windows specified. Some of those
+ * structures corresponding to the windows specified. Some of those
* structures may already have existed, some may be new.
*/
+
inserts = (Slave **)ckalloc(sizeof(Slave *) * (firstOptionArg - 2));
insertIndex = 0;
/*
* Populate the inserts array, creating new slave structures as necessary,
* applying the options to each structure as we go, and, if necessary,
- * marking the spot in the original slaves array as empty (for pre-existing
- * slave structures).
+ * marking the spot in the original slaves array as empty (for
+ * pre-existing slave structures).
*/
+
for (i = 0, numNewSlaves = 0; i < firstOptionArg - 2; i++) {
/*
* We don't check that tkwin is NULL here, because the pre-pass above
* guarantees that the input at this stage is good.
*/
+
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i + 2]),
pwPtr->tkwin);
@@ -907,8 +927,8 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Make sure this slave wasn't already put into the inserts array,
- * ie, when the user specifies the same window multiple times in
- * a single add commaned.
+ * i.e., when the user specifies the same window multiple times in a
+ * single add commaned.
*/
for (j = 0; j < insertIndex; j++) {
if (inserts[j]->tkwin == tkwin) {
@@ -921,8 +941,8 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
}
/*
- * Create a new slave structure and initialize it. All slaves
- * start out with their "natural" dimensions.
+ * Create a new slave structure and initialize it. All slaves start
+ * out with their "natural" dimensions.
*/
slavePtr = (Slave *) ckalloc(sizeof(Slave));
@@ -932,8 +952,8 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
Tk_SetOptions(interp, (char *)slavePtr, pwPtr->slaveOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL);
- slavePtr->tkwin = tkwin;
- slavePtr->masterPtr = pwPtr;
+ slavePtr->tkwin = tkwin;
+ slavePtr->masterPtr = pwPtr;
doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
if (slavePtr->width > 0) {
slavePtr->paneWidth = slavePtr->width;
@@ -962,9 +982,9 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
}
/*
- * Allocate the new slaves array, then copy the slaves into it, in
- * order.
+ * Allocate the new slaves array, then copy the slaves into it, in order.
*/
+
i = sizeof(Slave *) * (pwPtr->numSlaves+numNewSlaves);
new = (Slave **)ckalloc((unsigned) i);
memset(new, 0, (size_t) i);
@@ -981,11 +1001,12 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* If some of the existing slaves were moved, the old slaves array
* will be partially populated, with some valid and some invalid
- * entries. Walk through it, copying valid entries to the new slaves
+ * entries. Walk through it, copying valid entries to the new slaves
* array as we go; when we get to the insert location for the new
* slaves, copy the inserts array over, then finish off the old slaves
* array.
*/
+
for (i = 0, j = 0; i < index; i++) {
if (pwPtr->slaves[i] != NULL) {
new[j] = pwPtr->slaves[i];
@@ -1007,6 +1028,7 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Make the new slaves array the paned window's slave array, and clean up.
*/
+
ckfree((void *)pwPtr->slaves);
ckfree((void *)inserts);
pwPtr->slaves = new;
@@ -1014,6 +1036,7 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
/*
* Set the paned window's slave count to the new value.
*/
+
pwPtr->numSlaves += numNewSlaves;
Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts, pwPtr->tkwin);
@@ -1027,7 +1050,7 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
*
* PanedWindowSashCommand --
*
- * Implementation of the panedwindow sash subcommand. See the user
+ * Implementation of the panedwindow sash subcommand. See the user
* documentation for details on what it does.
*
* Results:
@@ -1040,14 +1063,14 @@ ConfigureSlaves(pwPtr, interp, objc, objv)
*/
static int
-PanedWindowSashCommand(pwPtr, interp, objc, objv)
- PanedWindow *pwPtr; /* Pointer to paned window information. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+PanedWindowSashCommand(
+ PanedWindow *pwPtr, /* Pointer to paned window information. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
static CONST char *sashOptionStrings[] = {
- "coord", "dragto", "mark", "place", (char *) NULL
+ "coord", "dragto", "mark", "place", NULL
};
enum sashOptions {
SASH_COORD, SASH_DRAGTO, SASH_MARK, SASH_PLACE
@@ -1061,8 +1084,8 @@ PanedWindowSashCommand(pwPtr, interp, objc, objv)
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[2], sashOptionStrings,
- "option", 0, &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], sashOptionStrings, "option", 0,
+ &index) != TCL_OK) {
return TCL_ERROR;
}
@@ -1175,28 +1198,27 @@ PanedWindowSashCommand(pwPtr, interp, objc, objv)
*
* ConfigurePanedWindow --
*
- * This procedure is called to process an argv/argc list in
- * conjunction with the Tk option database to configure (or
- * reconfigure) a paned window widget.
+ * This function is called to process an argv/argc list in conjunction
+ * with the Tk option database to configure (or reconfigure) a paned
+ * window widget.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message.
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message.
*
* Side effects:
- * Configuration information, such as colors, border width,
- * etc. get set for pwPtr; old resources get freed,
- * if there were any.
+ * Configuration information, such as colors, border width, etc. get set
+ * for pwPtr; old resources get freed, if there were any.
*
*----------------------------------------------------------------------
*/
static int
-ConfigurePanedWindow(interp, pwPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- PanedWindow *pwPtr; /* Information about widget. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument values. */
+ConfigurePanedWindow(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ PanedWindow *pwPtr, /* Information about widget. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument values. */
{
Tk_SavedOptions savedOptions;
int typemask = 0;
@@ -1212,7 +1234,7 @@ ConfigurePanedWindow(interp, pwPtr, objc, objv)
PanedWindowWorldChanged((ClientData) pwPtr);
/*
- * If an option that affects geometry has changed, make a relayout
+ * If an option that affects geometry has changed, make a re-layout
* request.
*/
@@ -1228,9 +1250,9 @@ ConfigurePanedWindow(interp, pwPtr, objc, objv)
*
* PanedWindowWorldChanged --
*
- * This procedure is invoked anytime a paned window's world has
- * changed in some way that causes the widget to have to recompute
- * graphics contexts and geometry.
+ * This function is invoked anytime a paned window's world has changed in
+ * some way that causes the widget to have to recompute graphics contexts
+ * and geometry.
*
* Results:
* None.
@@ -1242,8 +1264,8 @@ ConfigurePanedWindow(interp, pwPtr, objc, objv)
*/
static void
-PanedWindowWorldChanged(instanceData)
- ClientData instanceData; /* Information about the paned window. */
+PanedWindowWorldChanged(
+ ClientData instanceData) /* Information about the paned window. */
{
XGCValues gcValues;
GC newGC;
@@ -1286,23 +1308,23 @@ PanedWindowWorldChanged(instanceData)
*
* PanedWindowEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on paned windows.
+ * This function is invoked by the Tk dispatcher for various events on
+ * paned windows.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+PanedWindowEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
@@ -1327,9 +1349,9 @@ PanedWindowEventProc(clientData, eventPtr)
*
* PanedWindowCmdDeletedProc --
*
- * This procedure is invoked when a widget command is deleted. If
- * the widget isn't already in the process of being destroyed,
- * this command destroys it.
+ * This function is invoked when a widget command is deleted. If the
+ * widget isn't already in the process of being destroyed, this command
+ * destroys it.
*
* Results:
* None.
@@ -1341,16 +1363,16 @@ PanedWindowEventProc(clientData, eventPtr)
*/
static void
-PanedWindowCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+PanedWindowCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
/*
- * This procedure could be invoked either because the window was
- * destroyed and the command was then deleted or because the command was
- * deleted, and then this procedure destroys the widget. The
- * WIDGET_DELETED flag distinguishes these cases.
+ * This function could be invoked either because the window was destroyed
+ * and the command was then deleted or because the command was deleted,
+ * and then this function destroys the widget. The WIDGET_DELETED flag
+ * distinguishes these cases.
*/
if (!(pwPtr->flags & WIDGET_DELETED)) {
@@ -1364,9 +1386,9 @@ PanedWindowCmdDeletedProc(clientData)
*
* DisplayPanedWindow --
*
- * This procedure redraws the contents of a paned window widget.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This function redraws the contents of a paned window widget. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
*
* Results:
* None.
@@ -1378,8 +1400,8 @@ PanedWindowCmdDeletedProc(clientData)
*/
static void
-DisplayPanedWindow(clientData)
- ClientData clientData; /* Information about window. */
+DisplayPanedWindow(
+ ClientData clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
Slave *slavePtr;
@@ -1446,13 +1468,12 @@ DisplayPanedWindow(clientData)
}
/*
- * Copy the information from the off-screen pixmap onto the screen,
- * then delete the pixmap.
+ * Copy the information from the off-screen pixmap onto the screen, then
+ * delete the pixmap.
*/
- XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc,
- 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
- 0, 0);
+ XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc, 0, 0,
+ (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0);
Tk_FreePixmap(Tk_Display(tkwin), pixmap);
}
@@ -1461,8 +1482,8 @@ DisplayPanedWindow(clientData)
*
* DestroyPanedWindow --
*
- * This procedure is invoked by PanedWindowEventProc to free the
- * internal structure of a paned window.
+ * This function is invoked by PanedWindowEventProc to free the internal
+ * structure of a paned window.
*
* Results:
* None.
@@ -1474,23 +1495,23 @@ DisplayPanedWindow(clientData)
*/
static void
-DestroyPanedWindow(pwPtr)
- PanedWindow *pwPtr; /* Info about paned window widget. */
+DestroyPanedWindow(
+ PanedWindow *pwPtr) /* Info about paned window widget. */
{
int i;
/*
- * First mark the widget as in the process of being deleted,
- * so that any code that causes calls to other paned window procedures
- * will abort.
+ * First mark the widget as in the process of being deleted, so that any
+ * code that causes calls to other paned window functions will abort.
*/
pwPtr->flags |= WIDGET_DELETED;
/*
- * Cancel idle callbacks for redrawing the widget and for rearranging
- * the panes.
+ * Cancel idle callbacks for redrawing the widget and for rearranging the
+ * panes.
*/
+
if (pwPtr->flags & REDRAW_PENDING) {
Tcl_CancelIdleCall(DisplayPanedWindow, (ClientData) pwPtr);
}
@@ -1540,26 +1561,25 @@ DestroyPanedWindow(pwPtr)
*
* PanedWindowReqProc --
*
- * This procedure is invoked by Tk_GeometryRequest for
- * windows managed by a paned window.
+ * This function is invoked by Tk_GeometryRequest for windows managed by
+ * a paned window.
*
* Results:
* None.
*
* Side effects:
- * Arranges for tkwin, and all its managed siblings, to
- * be re-arranged at the next idle point.
+ * Arranges for tkwin, and all its managed siblings, to be re-arranged at
+ * the next idle point.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowReqProc(clientData, tkwin)
- ClientData clientData; /* Paned window's information about
- * window that got new preferred
- * geometry. */
- Tk_Window tkwin; /* Other Tk-related information
- * about the window. */
+PanedWindowReqProc(
+ ClientData clientData, /* Paned window's information about window
+ * that got new preferred geometry. */
+ Tk_Window tkwin) /* Other Tk-related information about the
+ * window. */
{
Slave *slavePtr = (Slave *) clientData;
PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr);
@@ -1570,6 +1590,7 @@ PanedWindowReqProc(clientData, tkwin)
}
} else {
int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
+
if (slavePtr->width <= 0) {
slavePtr->paneWidth = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
}
@@ -1585,27 +1606,28 @@ PanedWindowReqProc(clientData, tkwin)
*
* PanedWindowLostSlaveProc --
*
- * This procedure is invoked by Tk whenever some other geometry
- * claims control over a slave that used to be managed by us.
+ * This function is invoked by Tk whenever some other geometry claims
+ * control over a slave that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all information about the slave. Causes geometry to
- * be recomputed for the panedwindow.
+ * Forgets all information about the slave. Causes geometry to be
+ * recomputed for the panedwindow.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Grid structure for slave window that
- * was stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+PanedWindowLostSlaveProc(
+ ClientData clientData, /* Grid structure for slave window that was
+ * stolen away. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
register Slave *slavePtr = (Slave *) clientData;
PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr);
+
if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
}
@@ -1623,11 +1645,10 @@ PanedWindowLostSlaveProc(clientData, tkwin)
*
* ArrangePanes --
*
- * This procedure is invoked (using the Tcl_DoWhenIdle
- * mechanism) to re-layout a set of windows managed by
- * a paned window. It is invoked at idle time so that a
- * series of pane requests can be merged into a single
- * layout operation.
+ * This function is invoked (using the Tcl_DoWhenIdle mechanism) to
+ * re-layout a set of windows managed by a paned window. It is invoked at
+ * idle time so that a series of pane requests can be merged into a
+ * single layout operation.
*
* Results:
* None.
@@ -1639,8 +1660,8 @@ PanedWindowLostSlaveProc(clientData, tkwin)
*/
static void
-ArrangePanes(clientData)
- ClientData clientData; /* Structure describing parent whose slaves
+ArrangePanes(
+ ClientData clientData) /* Structure describing parent whose slaves
* are to be re-layed out. */
{
register PanedWindow *pwPtr = (PanedWindow *) clientData;
@@ -1660,10 +1681,10 @@ ArrangePanes(clientData)
pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING);
/*
- * If the parent has no slaves anymore, then don't do anything
- * at all: just leave the parent's size as-is. Otherwise there is
- * no way to "relinquish" control over the parent so another geometry
- * manager can take over.
+ * If the parent has no slaves anymore, then don't do anything at all:
+ * just leave the parent's size as-is. Otherwise there is no way to
+ * "relinquish" control over the parent so another geometry manager can
+ * take over.
*/
if (pwPtr->numSlaves == 0) {
@@ -1697,8 +1718,8 @@ ArrangePanes(clientData)
stretchReserve = (horizontal ? pwWidth : pwHeight);
/*
- * Calculate the sash width, including handle and padding,
- * and the sash and handle offsets.
+ * Calculate the sash width, including handle and padding, and the sash
+ * and handle offsets.
*/
sashOffset = handleOffset = pwPtr->sashPad;
@@ -1720,8 +1741,8 @@ ArrangePanes(clientData)
}
/*
- * Compute the total size needed by all the slaves and the
- * left-over, or shortage of space available.
+ * Compute the total size needed by all the slaves and the left-over,
+ * or shortage of space available.
*/
if (horizontal) {
@@ -1756,15 +1777,14 @@ ArrangePanes(clientData)
}
/*
- * Compute the size of this slave. The algorithm (assuming a
+ * Compute the size of this slave. The algorithm (assuming a
* horizontal paned window) is:
*
- * 1. Get "base" dimensions. If a width or height is specified
- * for this slave, use those values; else use the
- * ReqWidth/ReqHeight.
+ * 1. Get "base" dimensions. If a width or height is specified for
+ * this slave, use those values; else use the ReqWidth/ReqHeight.
* 2. Using base dimensions, pane dimensions, and sticky values,
- * determine the x and y, and actual width and height of the
- * widget.
+ * determine the x and y, and actual width and height of the
+ * widget.
*/
doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
@@ -1787,11 +1807,13 @@ ArrangePanes(clientData)
}
if (IsStretchable(slavePtr->stretch, i, first, last)) {
double frac;
+
if (paneDynSize > 0) {
frac = (double)paneSize / (double)paneDynSize;
} else {
frac = (double)paneSize / (double)pwSize;
}
+
paneDynSize -= paneSize;
paneDynMinSize -= slavePtr->minSize;
stretchAmount = (int) (frac * stretchReserve);
@@ -1868,8 +1890,8 @@ ArrangePanes(clientData)
if (x < internalBW) {
x = internalBW;
}
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
+ slavePtr->sashx = x + sashOffset;
+ slavePtr->sashy = y;
slavePtr->handlex = x + handleOffset;
slavePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
@@ -1878,8 +1900,8 @@ ArrangePanes(clientData)
if (y < internalBW) {
y = internalBW;
}
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
+ slavePtr->sashx = x;
+ slavePtr->sashy = y + sashOffset;
slavePtr->handlex = x + pwPtr->handlePad;
slavePtr->handley = y + handleOffset;
y += sashWidth;
@@ -1932,8 +1954,8 @@ ArrangePanes(clientData)
*/
static void
-Unlink(slavePtr)
- register Slave *slavePtr; /* Window to unlink. */
+Unlink(
+ register Slave *slavePtr) /* Window to unlink. */
{
register PanedWindow *masterPtr;
int i, j;
@@ -1960,6 +1982,7 @@ Unlink(slavePtr)
/*
* Clean out any -after or -before references to this slave
*/
+
for (i = 0; i < masterPtr->numSlaves; i++) {
if (masterPtr->slaves[i]->before == slavePtr->tkwin) {
masterPtr->slaves[i]->before = None;
@@ -1976,9 +1999,10 @@ Unlink(slavePtr)
}
/*
- * Set the slave's masterPtr to NULL, so that we can tell that the
- * slave is no longer attached to any panedwindow.
+ * Set the slave's masterPtr to NULL, so that we can tell that the slave
+ * is no longer attached to any panedwindow.
*/
+
slavePtr->masterPtr = NULL;
masterPtr->numSlaves--;
@@ -1989,12 +2013,12 @@ Unlink(slavePtr)
*
* GetPane --
*
- * Given a token to a Tk window, find the pane that corresponds to
- * that token in a given paned window.
+ * Given a token to a Tk window, find the pane that corresponds to that
+ * token in a given paned window.
*
* Results:
- * Pointer to the slave structure, or NULL if the window is not
- * managed by this paned window.
+ * Pointer to the slave structure, or NULL if the window is not managed
+ * by this paned window.
*
* Side effects:
* None.
@@ -2003,11 +2027,12 @@ Unlink(slavePtr)
*/
static Slave *
-GetPane(pwPtr, tkwin)
- PanedWindow *pwPtr; /* Pointer to the paned window info. */
- Tk_Window tkwin; /* Window to search for. */
+GetPane(
+ PanedWindow *pwPtr, /* Pointer to the paned window info. */
+ Tk_Window tkwin) /* Window to search for. */
{
int i;
+
for (i = 0; i < pwPtr->numSlaves; i++) {
if (pwPtr->slaves[i]->tkwin == tkwin) {
return pwPtr->slaves[i];
@@ -2021,10 +2046,9 @@ GetPane(pwPtr, tkwin)
*
* SlaveStructureProc --
*
- * This procedure is invoked whenever StructureNotify events
- * occur for a window that's managed by a paned window. This
- * procedure's only purpose is to clean up when windows are
- * deleted.
+ * This function is invoked whenever StructureNotify events occur for a
+ * window that's managed by a paned window. This function's only purpose
+ * is to clean up when windows are deleted.
*
* Results:
* None.
@@ -2038,9 +2062,9 @@ GetPane(pwPtr, tkwin)
*/
static void
-SlaveStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to record describing window item. */
- XEvent *eventPtr; /* Describes what just happened. */
+SlaveStructureProc(
+ ClientData clientData, /* Pointer to record describing window item. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
Slave *slavePtr = (Slave *) clientData;
PanedWindow *pwPtr = slavePtr->masterPtr;
@@ -2058,8 +2082,8 @@ SlaveStructureProc(clientData, eventPtr)
*
* ComputeGeometry --
*
- * Compute geometry for the paned window, including coordinates of
- * all slave windows and each sash.
+ * Compute geometry for the paned window, including coordinates of all
+ * slave windows and each sash.
*
* Results:
* None.
@@ -2071,8 +2095,8 @@ SlaveStructureProc(clientData, eventPtr)
*/
static void
-ComputeGeometry(pwPtr)
- PanedWindow *pwPtr; /* Pointer to the Paned Window structure. */
+ComputeGeometry(
+ PanedWindow *pwPtr) /* Pointer to the Paned Window structure. */
{
int i, x, y, doubleBw, internalBw;
int sashWidth, sashOffset, handleOffset;
@@ -2086,10 +2110,10 @@ ComputeGeometry(pwPtr)
reqWidth = reqHeight = 0;
/*
- * Sashes and handles share space on the display. To simplify
- * processing below, precompute the x and y offsets of the handles and
- * sashes within the space occupied by their combination; later, just add
- * those offsets blindly (avoiding the extra showHandle, etc, checks).
+ * Sashes and handles share space on the display. To simplify processing
+ * below, precompute the x and y offsets of the handles and sashes within
+ * the space occupied by their combination; later, just add those offsets
+ * blindly (avoiding the extra showHandle, etc, checks).
*/
sashOffset = handleOffset = pwPtr->sashPad;
@@ -2119,9 +2143,9 @@ ComputeGeometry(pwPtr)
slavePtr->y = y;
/*
- * Make sure the pane's paned dimension is at least minsize.
- * This check may be redundant, since the only way to change a pane's
- * size is by moving a sash, and that code checks the minsize.
+ * Make sure the pane's paned dimension is at least minsize. This
+ * check may be redundant, since the only way to change a pane's size
+ * is by moving a sash, and that code checks the minsize.
*/
if (horizontal) {
@@ -2141,15 +2165,15 @@ ComputeGeometry(pwPtr)
if (horizontal) {
x += slavePtr->paneWidth + (2 * slavePtr->padx);
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
+ slavePtr->sashx = x + sashOffset;
+ slavePtr->sashy = y;
slavePtr->handlex = x + handleOffset;
slavePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
y += slavePtr->paneHeight + (2 * slavePtr->pady);
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
+ slavePtr->sashx = x;
+ slavePtr->sashy = y + sashOffset;
slavePtr->handlex = x + pwPtr->handlePad;
slavePtr->handley = y + handleOffset;
y += sashWidth;
@@ -2161,7 +2185,6 @@ ComputeGeometry(pwPtr)
*/
if (horizontal) {
-
/*
* If the slave has an explicit height set, use that; otherwise,
* use the slave's requested height.
@@ -2178,10 +2201,9 @@ ComputeGeometry(pwPtr)
reqHeight = dim;
}
} else {
-
/*
- * If the slave has an explicit width set use that; otherwise,
- * use the slave's requested width.
+ * If the slave has an explicit width set use that; otherwise, use
+ * the slave's requested width.
*/
if (slavePtr->width > 0) {
@@ -2198,21 +2220,21 @@ ComputeGeometry(pwPtr)
}
/*
- * The loop above should have left x (or y) equal to the sum of the
- * widths (or heights) of the widgets, plus the size of one sash and
- * the sash padding for each widget, plus the width of the left (or top)
- * border of the paned window.
+ * The loop above should have left x (or y) equal to the sum of the widths
+ * (or heights) of the widgets, plus the size of one sash and the sash
+ * padding for each widget, plus the width of the left (or top) border of
+ * the paned window.
*
* The requested width (or height) is therefore x (or y) minus the size of
- * one sash and padding, plus the width of the right (or bottom) border
- * of the paned window.
+ * one sash and padding, plus the width of the right (or bottom) border of
+ * the paned window.
*
- * The height (or width) is equal to the maximum height (or width) of
- * the slaves, plus the width of the border of the top and bottom (or left
- * and right) of the paned window.
+ * The height (or width) is equal to the maximum height (or width) of the
+ * slaves, plus the width of the border of the top and bottom (or left and
+ * right) of the paned window.
*
- * If the panedwindow has an explicit width/height set use that; otherwise,
- * use the requested width/height.
+ * If the panedwindow has an explicit width/height set use that;
+ * otherwise, use the requested width/height.
*/
if (horizontal) {
@@ -2238,8 +2260,8 @@ ComputeGeometry(pwPtr)
*
* DestroyOptionTables --
*
- * This procedure is registered as an exit callback when the paned window
- * command is first called. It cleans up the OptionTables structure
+ * This function is registered as an exit callback when the paned window
+ * command is first called. It cleans up the OptionTables structure
* allocated by that command.
*
* Results:
@@ -2252,9 +2274,9 @@ ComputeGeometry(pwPtr)
*/
static void
-DestroyOptionTables(clientData, interp)
- ClientData clientData; /* Pointer to the OptionTables struct */
- Tcl_Interp *interp; /* Pointer to the calling interp */
+DestroyOptionTables(
+ ClientData clientData, /* Pointer to the OptionTables struct */
+ Tcl_Interp *interp) /* Pointer to the calling interp */
{
ckfree((char *)clientData);
return;
@@ -2265,8 +2287,8 @@ DestroyOptionTables(clientData, interp)
*
* GetSticky -
*
- * Converts an internal boolean combination of "sticky" bits into a
- * a Tcl string obj containing zero or mor of n, s, e, or w.
+ * Converts an internal boolean combination of "sticky" bits into a Tcl
+ * string obj containing zero or more of n, s, e, or w.
*
* Results:
* Tcl_Obj containing the string representation of the sticky value.
@@ -2278,11 +2300,11 @@ DestroyOptionTables(clientData, interp)
*/
static Tcl_Obj *
-GetSticky(clientData, tkwin, recordPtr, internalOffset)
- ClientData clientData;
- Tk_Window tkwin;
- char *recordPtr; /* Pointer to widget record. */
- int internalOffset; /* Offset within *recordPtr containing the
+GetSticky(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *recordPtr, /* Pointer to widget record. */
+ int internalOffset) /* Offset within *recordPtr containing the
* sticky value. */
{
int sticky = *(int *)(recordPtr + internalOffset);
@@ -2311,34 +2333,33 @@ GetSticky(clientData, tkwin, recordPtr, internalOffset)
*
* SetSticky --
*
- * Converts a Tcl_Obj representing a widgets stickyness into an
- * integer value.
+ * Converts a Tcl_Obj representing a widgets stickyness into an integer
+ * value.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * May store the integer value into the internal representation
- * pointer. May change the pointer to the Tcl_Obj to NULL to indicate
- * that the specified string was empty and that is acceptable.
+ * May store the integer value into the internal representation pointer.
+ * May change the pointer to the Tcl_Obj to NULL to indicate that the
+ * specified string was empty and that is acceptable.
*
*----------------------------------------------------------------------
*/
static int
-SetSticky(clientData, interp, tkwin, value, recordPtr, internalOffset,
- oldInternalPtr, flags)
- ClientData clientData;
- Tcl_Interp *interp; /* Current interp; may be used for errors. */
- Tk_Window tkwin; /* Window for which option is being set. */
- Tcl_Obj **value; /* Pointer to the pointer to the value object.
- * We use a pointer to the pointer because
- * we may need to return a value (NULL). */
- char *recordPtr; /* Pointer to storage for the widget record. */
- int internalOffset; /* Offset within *recordPtr at which the
- internal value is to be stored. */
- char *oldInternalPtr; /* Pointer to storage for the old value. */
- int flags; /* Flags for the option, set Tk_SetOptions. */
+SetSticky(
+ ClientData clientData,
+ Tcl_Interp *interp, /* Current interp; may be used for errors. */
+ Tk_Window tkwin, /* Window for which option is being set. */
+ Tcl_Obj **value, /* Pointer to the pointer to the value object.
+ * We use a pointer to the pointer because we
+ * may need to return a value (NULL). */
+ char *recordPtr, /* Pointer to storage for the widget record. */
+ int internalOffset, /* Offset within *recordPtr at which the
+ * internal value is to be stored. */
+ char *oldInternalPtr, /* Pointer to storage for the old value. */
+ int flags) /* Flags for the option, set Tk_SetOptions. */
{
int sticky = 0;
char c, *string, *internalPtr;
@@ -2374,8 +2395,7 @@ SetSticky(clientData, interp, tkwin, value, recordPtr, internalOffset,
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad stickyness value \"",
Tcl_GetString(*value), "\": must be a string ",
- "containing zero or more of n, e, s, and w",
- (char *)NULL);
+ "containing zero or more of n, e, s, and w", NULL);
return TCL_ERROR;
}
}
@@ -2405,11 +2425,11 @@ SetSticky(clientData, interp, tkwin, value, recordPtr, internalOffset,
*/
static void
-RestoreSticky(clientData, tkwin, internalPtr, oldInternalPtr)
- ClientData clientData;
- Tk_Window tkwin;
- char *internalPtr; /* Pointer to storage for value. */
- char *oldInternalPtr; /* Pointer to old value. */
+RestoreSticky(
+ ClientData clientData,
+ Tk_Window tkwin,
+ char *internalPtr, /* Pointer to storage for value. */
+ char *oldInternalPtr) /* Pointer to old value. */
{
*(int *)internalPtr = *(int *)oldInternalPtr;
}
@@ -2419,14 +2439,13 @@ RestoreSticky(clientData, tkwin, internalPtr, oldInternalPtr)
*
* AdjustForSticky --
*
- * Given the x,y coords of the top-left corner of a pane, the
- * dimensions of that pane, and the dimensions of a slave, compute
- * the x,y coords and actual dimensions of the slave based on the slave's
- * sticky value.
+ * Given the x,y coords of the top-left corner of a pane, the dimensions
+ * of that pane, and the dimensions of a slave, compute the x,y coords
+ * and actual dimensions of the slave based on the slave's sticky value.
*
* Results:
- * No direct return; sets the x, y, slaveWidth and slaveHeight to
- * correct values.
+ * No direct return; sets the x, y, slaveWidth and slaveHeight to correct
+ * values.
*
* Side effects:
* None.
@@ -2435,17 +2454,16 @@ RestoreSticky(clientData, tkwin, internalPtr, oldInternalPtr)
*/
static void
-AdjustForSticky(sticky, cavityWidth, cavityHeight, xPtr, yPtr,
- slaveWidthPtr, slaveHeightPtr)
- int sticky; /* Sticky value; see top of file for
+AdjustForSticky(
+ int sticky, /* Sticky value; see top of file for
* definition. */
- int cavityWidth; /* Width of the cavity. */
- int cavityHeight; /* Height of the cavity. */
- int *xPtr, *yPtr; /* Initially, coordinates of the top-left
+ int cavityWidth, /* Width of the cavity. */
+ int cavityHeight, /* Height of the cavity. */
+ int *xPtr, int *yPtr, /* Initially, coordinates of the top-left
* corner of cavity; also return values for
* actual x, y coords of slave. */
- int *slaveWidthPtr; /* Slave width. */
- int *slaveHeightPtr; /* Slave height. */
+ int *slaveWidthPtr, /* Slave width. */
+ int *slaveHeightPtr) /* Slave height. */
{
int diffx = 0; /* Cavity width - slave width. */
int diffy = 0; /* Cavity hight - slave height. */
@@ -2489,10 +2507,10 @@ AdjustForSticky(sticky, cavityWidth, cavityHeight, xPtr, yPtr,
*/
static void
-MoveSash(pwPtr, sash, diff)
- PanedWindow *pwPtr;
- int sash;
- int diff;
+MoveSash(
+ PanedWindow *pwPtr,
+ int sash,
+ int diff)
{
int i;
int expandPane, reduceFirst, reduceLast, reduceIncr, slaveSize, sashOffset;
@@ -2529,12 +2547,12 @@ MoveSash(pwPtr, sash, diff)
}
/*
- * There must be a next sash since it is only possible to enter
- * this routine when moving an actual sash which implies there
- * exists a visible pane to either side of the sash.
+ * There must be a next sash since it is only possible to enter this
+ * routine when moving an actual sash which implies there exists a visible
+ * pane to either side of the sash.
*/
- while (nextSash < (pwPtr->numSlaves - 1) && pwPtr->slaves[nextSash]->hide) {
+ while (nextSash < pwPtr->numSlaves-1 && pwPtr->slaves[nextSash]->hide) {
nextSash++;
}
@@ -2556,8 +2574,8 @@ MoveSash(pwPtr, sash, diff)
}
/*
- * Calculate how much room we have to stretch in
- * and adjust diff value accordingly.
+ * Calculate how much room we have to stretch in and adjust diff value
+ * accordingly.
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
@@ -2623,23 +2641,23 @@ MoveSash(pwPtr, sash, diff)
*
* ProxyWindowEventProc --
*
- * This procedure is invoked by the Tk dispatcher for various
- * events on paned window proxy windows.
+ * This function is invoked by the Tk dispatcher for various events on
+ * paned window proxy windows.
*
* Results:
* None.
*
* Side effects:
- * When the window gets deleted, internal structures get
- * cleaned up. When it gets exposed, it is redisplayed.
+ * When the window gets deleted, internal structures get cleaned up. Whena
+ * it gets exposed, it is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-ProxyWindowEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+ProxyWindowEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
@@ -2656,9 +2674,9 @@ ProxyWindowEventProc(clientData, eventPtr)
*
* DisplayProxyWindow --
*
- * This procedure redraws a paned window proxy window.
- * It is invoked as a do-when-idle handler, so it only runs
- * when there's nothing else for the application to do.
+ * This function redraws a paned window proxy window. It is invoked as a
+ * do-when-idle handler, so it only runs when there's nothing else for
+ * the application to do.
*
* Results:
* None.
@@ -2670,8 +2688,8 @@ ProxyWindowEventProc(clientData, eventPtr)
*/
static void
-DisplayProxyWindow(clientData)
- ClientData clientData; /* Information about window. */
+DisplayProxyWindow(
+ ClientData clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *) clientData;
Pixmap pixmap;
@@ -2691,15 +2709,16 @@ DisplayProxyWindow(clientData)
/*
* Redraw the widget's background and border.
*/
+
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, 0, 0,
Tk_Width(tkwin), Tk_Height(tkwin), 2, pwPtr->sashRelief);
/*
* Copy the pixmap to the display.
*/
- XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc,
- 0, 0, (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin),
- 0, 0);
+
+ XCopyArea(Tk_Display(tkwin), pixmap, Tk_WindowId(tkwin), pwPtr->gc, 0, 0,
+ (unsigned) Tk_Width(tkwin), (unsigned) Tk_Height(tkwin), 0, 0);
Tk_FreePixmap(Tk_Display(tkwin), pixmap);
}
@@ -2708,8 +2727,8 @@ DisplayProxyWindow(clientData)
*
* PanedWindowProxyCommand --
*
- * Handles the panedwindow proxy subcommand. See the user
- * documentation for details.
+ * Handles the panedwindow proxy subcommand. See the user documentation
+ * for details.
*
* Results:
* Standard Tcl result.
@@ -2721,14 +2740,14 @@ DisplayProxyWindow(clientData)
*/
static int
-PanedWindowProxyCommand(pwPtr, interp, objc, objv)
- PanedWindow *pwPtr; /* Pointer to paned window information. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj * CONST objv[]; /* Argument objects. */
+PanedWindowProxyCommand(
+ PanedWindow *pwPtr, /* Pointer to paned window information. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
static CONST char *optionStrings[] = {
- "coord", "forget", "place", (char *) NULL
+ "coord", "forget", "place", NULL
};
enum options {
PROXY_COORD, PROXY_FORGET, PROXY_PLACE
@@ -2809,21 +2828,22 @@ PanedWindowProxyCommand(pwPtr, interp, objc, objv)
pwPtr->proxyy = y;
/*
- * Make sure the proxy window is higher in the stacking order
- * than the slaves, so that it will be visible when drawn.
- * It would be more correct to push the proxy window just high
- * enough to appear above the highest slave, but it's much easier
- * to just force it all the way to the top of the stacking order.
+ * Make sure the proxy window is higher in the stacking order than the
+ * slaves, so that it will be visible when drawn. It would be more
+ * correct to push the proxy window just high enough to appear above
+ * the highest slave, but it's much easier to just force it all the
+ * way to the top of the stacking order.
*/
Tk_RestackWindow(pwPtr->proxywin, Above, NULL);
/*
- * Let Tk_MaintainGeometry take care of placing the window at
- * the right coordinates.
+ * Let Tk_MaintainGeometry take care of placing the window at the
+ * right coordinates.
*/
- Tk_MaintainGeometry(pwPtr->proxywin, pwPtr->tkwin,
- x, y, sashWidth, sashHeight);
+
+ Tk_MaintainGeometry(pwPtr->proxywin, pwPtr->tkwin, x, y,
+ sashWidth, sashHeight);
break;
}
@@ -2835,12 +2855,11 @@ PanedWindowProxyCommand(pwPtr, interp, objc, objv)
*
* ObjectIsEmpty --
*
- * This procedure tests whether the string value of an object is
- * empty.
+ * This function tests whether the string value of an object is empty.
*
* Results:
- * The return value is 1 if the string value of objPtr has length
- * zero, and 0 otherwise.
+ * The return value is 1 if the string value of objPtr has length zero,
+ * and 0 otherwise.
*
* Side effects:
* May cause object shimmering, since this function can force a
@@ -2850,8 +2869,8 @@ PanedWindowProxyCommand(pwPtr, interp, objc, objv)
*/
static int
-ObjectIsEmpty(objPtr)
- Tcl_Obj *objPtr; /* Object to test. May be NULL. */
+ObjectIsEmpty(
+ Tcl_Obj *objPtr) /* Object to test. May be NULL. */
{
int length;
@@ -2874,8 +2893,8 @@ ObjectIsEmpty(objPtr)
* within that record, compute the address of that slot.
*
* Results:
- * If offset is non-negative, returns the computed address; else,
- * returns NULL.
+ * If offset is non-negative, returns the computed address; else, returns
+ * NULL.
*
* Side effects:
* None.
@@ -2884,9 +2903,9 @@ ObjectIsEmpty(objPtr)
*/
static char *
-ComputeSlotAddress(recordPtr, offset)
- char *recordPtr; /* Pointer to the start of a record. */
- int offset; /* Offset of a slot within that record; may be < 0. */
+ComputeSlotAddress(
+ char *recordPtr, /* Pointer to the start of a record. */
+ int offset) /* Offset of a slot within that record; may be < 0. */
{
if (offset >= 0) {
return recordPtr + offset;
@@ -2900,25 +2919,25 @@ ComputeSlotAddress(recordPtr, offset)
*
* PanedWindowIdentifyCoords --
*
- * Given a pair of x,y coordinates, identify the panedwindow component
- * at that point, if any.
+ * Given a pair of x,y coordinates, identify the panedwindow component at
+ * that point, if any.
*
* Results:
* Standard Tcl result.
*
* Side effects:
- * Modifies the interpreter's result to contain either an empty list,
- * or a two element list of the form {sash n} or {handle n} to indicate
- * that the point lies within the n'th sash or handle.
+ * Modifies the interpreter's result to contain either an empty list, or
+ * a two element list of the form {sash n} or {handle n} to indicate that
+ * the point lies within the n'th sash or handle.
*
*----------------------------------------------------------------------
*/
static int
-PanedWindowIdentifyCoords(pwPtr, interp, x, y)
- PanedWindow *pwPtr; /* Information about the widget. */
- Tcl_Interp *interp; /* Interpreter in which to store result. */
- int x, y; /* Coordinates of the point to identify. */
+PanedWindowIdentifyCoords(
+ PanedWindow *pwPtr, /* Information about the widget. */
+ Tcl_Interp *interp, /* Interpreter in which to store result. */
+ int x, int y) /* Coordinates of the point to identify. */
{
Tcl_Obj *list;
int i, sashHeight, sashWidth, thisx, thisy;
@@ -2934,8 +2953,8 @@ PanedWindowIdentifyCoords(pwPtr, interp, x, y)
sashHeight -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashWidth = pwPtr->handleSize;
- lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
- rpad = pwPtr->handleSize - lpad;
+ lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
+ rpad = pwPtr->handleSize - lpad;
lpad += pwPtr->sashPad;
rpad += pwPtr->sashPad;
} else {
@@ -2946,8 +2965,8 @@ PanedWindowIdentifyCoords(pwPtr, interp, x, y)
} else {
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashHeight = pwPtr->handleSize;
- tpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
- bpad = pwPtr->handleSize - tpad;
+ tpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
+ bpad = pwPtr->handleSize - tpad;
tpad += pwPtr->sashPad;
bpad += pwPtr->sashPad;
} else {
@@ -2979,6 +2998,7 @@ PanedWindowIdentifyCoords(pwPtr, interp, x, y)
/*
* Determine if the point is over the handle or the sash.
*/
+
if (pwPtr->showHandle) {
thisx = pwPtr->slaves[i]->handlex;
thisy = pwPtr->slaves[i]->handley;
@@ -2999,17 +3019,21 @@ PanedWindowIdentifyCoords(pwPtr, interp, x, y)
/*
* Set results.
*/
+
if (found != -1) {
Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(found));
- if (isHandle) {
- Tcl_ListObjAppendElement(interp, list,
- Tcl_NewStringObj("handle", -1));
- } else {
- Tcl_ListObjAppendElement(interp, list,
- Tcl_NewStringObj("sash", -1));
- }
+ Tcl_ListObjAppendElement(interp, list, Tcl_NewStringObj(
+ (isHandle ? "handle" : "sash"), -1));
}
Tcl_SetObjResult(interp, list);
return TCL_OK;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */