/*
* tkGrid.c --
*
* Grid based geometry manager.
*
* Copyright (c) 1996 by Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* SCCS: @(#) tkGrid.c 1.31 96/12/06 14:43:13
*/
#include "tkInt.h"
/*
* Convenience Macros
*/
#ifdef MAX
#endif
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#ifdef MIN
#endif
#define MIN(x,y) ((x) > (y) ? (y) : (x))
/*
* Pre-allocate enough row and column slots for "typical" sized tables
* this value should be chosen so by the time the extra malloc's are
* required, the layout calculations overwehlm them. [A "slot" contains
* information for either a row or column, depending upon the context.]
*/
/*
* Data structures are allocated dynamically to support arbitrary sized tables.
* However, the space is proportional to the highest numbered slot with
* some non-default property. This limit is used to head off mistakes and
* denial of service attacks by limiting the amount of storage required.
*/
/*
* Special characters to support relative layouts.
*/
/*
* Structure to hold information for grid masters. A slot is either
* a row or column.
*/
typedef struct SlotInfo {
* It is set via the rowconfigure or
* columnconfigure commands. */
* this slot doesn't resize. Extra space in
* the layout is given distributed among slots
* inproportion to their weights. */
* this slot. This amount is "added" to the
* largest slave in the slot. */
* introspection. It is the pixel
* offset of the right or bottom edge
* of this slot from the beginning of the
* layout. */
* calculating adjusted weights when
* shrinking the layout below its
* nominal size. */
} SlotInfo;
/*
* Structure to hold information during layout calculations. There
* is one of these for each slot, an array for each of the rows or columns.
*/
typedef struct GridLayout {
* Each bin contains a list of all
* slaves whose spans are >1 and whose
* right edges fall in this slot. */
* in pixels. This is the space required
* to hold any slaves contained entirely
* in this slot, adjusted for any slot
* constrants, such as size or padding. */
* the beginning of the layout to the
* the beginning of the layout to the
* right-or-bottom edge of the slot calculated
* from bottom-or-right to top-or-left. */
} GridLayout;
/*
* Keep one of these for each geometry master.
*/
typedef struct {
* column constraints. */
* for row constraints. */
* parent. */
* parent. */
} GridMaster;
/*
* For each window that the grid cares about (either because
* the window is managed by the grid or because the window
* has slaves that are managed by the grid), there is a
* structure of the following type:
*/
typedef struct Gridder {
* the window has been deleted, but the
* gridder hasn't had a chance to clean up
* yet because the structure is still in
* use. */
* is managed (NULL means this window
* isn't managed by the gridder). */
* parent. List order doesn't matter. */
* inside this window (NULL means
* no grid slaves). */
* from zero). */
* Should be at least 1. */
* window (half of this space is left on each
* side). This is space *outside* the window:
* we'll allocate extra space in frame but
* won't enlarge window). */
* window (half this amount will appear on
* each side). */
* sticks to. See below for definitions */
* width. If this changes, the window
* must be re-arranged within its parent. */
* call to ArrangeGrid already working on
* this window. *abortPtr may be set to 1 to
* abort that nested call. This happens, for
* example, if tkwin or any of its slaves
* is deleted. */
* for definitions. */
/*
* These fields are used temporarily for layout calculations only.
*/
* of the slave. This includes the padding. */
} Gridder;
/* 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.
* STICK_EAST This window sticks to the right edge of its cavity.
* STICK_SOUTH This window sticks to the bottom of its cavity.
* STICK_WEST This window sticks to the left edge of its cavity.
*/
/*
* Flag values for Grid structures:
*
* REQUESTED_RELAYOUT: 1 means a Tcl_DoWhenIdle request
* has already been made to re-arrange
* all the slaves of this window.
*
* DONT_PROPAGATE: 1 means don't set this window's requested
* size. 0 means if this window is a master
* then Tk will set its requested size to fit
* the needs of its slaves.
*/
/*
* Hash table used to map from Tk_Window tokens to corresponding
* Grid structures:
*/
static int initialized = 0;
/*
* Prototypes for procedures used only in this file:
*/
static void GridStructureProc _ANSI_ARGS_((
int rowOrColumn, int maxOffset));
"grid", /* name */
GridReqProc, /* requestProc */
GridLostSlaveProc, /* lostSlaveProc */
};
/*
*--------------------------------------------------------------
*
* Tk_GridCmd --
*
* This procedure is invoked to process the "grid" Tcl command.
* See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* See the user documentation.
*
*--------------------------------------------------------------
*/
int
* interpreter. */
int argc; /* Number of arguments. */
char **argv; /* Argument strings. */
{
char c; /* 1st character of argument */
}
if (argc < 3) {
return TCL_ERROR;
}
c = argv[1][0];
int x=0, y=0; /* starting pixels for this bounding box */
"must be \"",argv[0],
" bbox master ?column row ?column row??\"",
(char *) NULL);
return TCL_ERROR;
}
return TCL_ERROR;
}
if (argc >= 5) {
return TCL_ERROR;
}
return TCL_ERROR;
}
}
if (argc == 7) {
return TCL_ERROR;
}
return TCL_ERROR;
}
}
return(TCL_OK);
}
return(TCL_OK);
}
if (argc == 3) {
}
}
}
} else if (column > 0) {
}
} else if (row > 0) {
}
if (column2 < 0) {
width = 0;
} else {
}
if (row2 < 0) {
height = 0;
} else {
}
"\": must be name of window", (char *) NULL);
return TCL_ERROR;
}
int i;
for (i = 2; i < argc; i++) {
return TCL_ERROR;
}
/*
* For "forget", reset all the settings to their defaults
*/
if (c == 'f') {
}
(ClientData) NULL);
}
}
if (argc != 3) {
return TCL_ERROR;
}
return TCL_ERROR;
}
return TCL_OK;
}
int x, y; /* Offset in pixels, from edge of parent. */
int i, j; /* Corresponding column and row indeces. */
if (argc != 5) {
return TCL_ERROR;
}
return TCL_ERROR;
}
return TCL_ERROR;
}
return TCL_ERROR;
}
return TCL_OK;
}
/*
* Update any pending requests. This is not always the
* steady state value, as more configure events could be in
* the pipeline, but its as close as its easy to get.
*/
}
i = -1;
} else {
/* null body */
}
}
j = -1;
} else {
/* null body */
}
}
int propagate;
if (argc > 4) {
argv[0], " propagate window ?boolean?\"",
(char *) NULL);
return TCL_ERROR;
}
return TCL_ERROR;
}
if (argc == 3) {
return TCL_OK;
}
return TCL_ERROR;
}
/*
* Re-arrange the master to allow new geometry information to
* propagate upwards to the master's master.
*/
}
}
}
&& (length > 1)) {
if (argc != 3) {
return TCL_ERROR;
}
return TCL_ERROR;
}
} else {
}
&& (length > 1)) {
int i, value;
argv[0], " slaves window ?-option value...?\"",
(char *) NULL);
return TCL_ERROR;
}
argv[0], " slaves window ?-option value...?\"",
(char *) NULL);
return TCL_ERROR;
}
return TCL_ERROR;
}
if (value < 0) {
" is an invalid value: should NOT be < 0",
(char *) NULL);
return TCL_ERROR;
}
} else {
" is an invalid option: should be \"",
"-row, -column\"",
(char *) NULL);
return TCL_ERROR;
}
}
return TCL_ERROR;
}
continue;
}
continue;
}
}
/*
* Sample argument combinations:
* grid columnconfigure <master> <index> -option
* grid columnconfigure <master> <index> -option value -option value
* grid rowconfigure <master> <index>
* grid rowconfigure <master> <index> -option
* grid rowconfigure <master> <index> -option value -option value.
*/
&& (length >= 3)) ||
&& (length >=2))) {
int i;
(char *)NULL);
return TCL_ERROR;
}
return TCL_ERROR;
}
return TCL_ERROR;
}
(char *) NULL);
return TCL_ERROR;
}
/*
* Return all of the options for this row or column. If the
* request is out of range, return all 0's.
*/
return (TCL_OK);
} else if (argc == 4) {
return (TCL_OK);
}
/*
* Loop through each option value pair, setting the values as required.
* If only one option is given, with no value, the current value is
* returned.
*/
argv[i], "\" :expecting -minsize, -pad, or -weight.",
(char *) NULL);
return TCL_ERROR;
}
if (argc == 5) {
!= TCL_OK) {
return TCL_ERROR;
} else {
}
}
int wt;
if (argc == 5) {
return TCL_ERROR;
} else if (wt < 0) {
"\": should be non-negative", (char *) NULL);
return TCL_ERROR;
} else {
}
}
if (argc == 5) {
!= TCL_OK) {
return TCL_ERROR;
} else if (size < 0) {
"\": should be non-negative", (char *) NULL);
return TCL_ERROR;
} else {
}
} else {
argv[i], "\": expecting -minsize, -pad, or -weight.",
(char *) NULL);
return TCL_ERROR;
}
}
/*
* If we changed a property, re-arrange the table,
* and check for constraint shrinkage.
*/
if (argc != 5) {
last--;
}
} else {
last--;
}
}
}
}
}
} else {
"\": must be bbox, columnconfigure, configure, forget, info, ",
"location, propagate, remove, rowconfigure, size, or slaves.",
(char *) NULL);
return TCL_ERROR;
}
return TCL_OK;
}
/*
*--------------------------------------------------------------
*
* GridReqProc --
*
* This procedure is invoked by Tk_GeometryRequest for
* windows managed by the grid.
*
* Results:
* None.
*
* Side effects:
* Arranges for tkwin, and all its managed siblings, to
* be re-arranged at the next idle point.
*
*--------------------------------------------------------------
*/
static void
* window that got new preferred
* geometry. */
* about the window. */
{
}
}
/*
*--------------------------------------------------------------
*
* GridLostSlaveProc --
*
* This procedure 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 grid-related information about the slave.
*
*--------------------------------------------------------------
*/
static void
* was stolen away. */
{
}
}
/*
*--------------------------------------------------------------
*
* AdjustOffsets --
*
* This procedure adjusts the size of the layout to fit in the
* space provided. If it needs more space, the extra is added
* according to the weights. If it needs less, the space is removed
* according to the weights, but at no time does the size drop below
* the minsize specified for that slot.
*
* Results:
* The initial offset of the layout,
* if all the weights are zero, else 0.
*
* Side effects:
* The slot offsets are modified to shrink the layout.
*
*--------------------------------------------------------------
*/
static int
int size; /* The total layout size (in pixels). */
int slots; /* Number of slots. */
{
* the current pass. */
/*
* The layout is already the correct size; all done.
*/
if (diff == 0) {
return(0);
}
/*
* If all the weights are zero, center the layout in its parent if
*/
}
if (totalWeight == 0 ) {
}
/*
* Add extra space according to the slot weights. This is done
* cumulatively to prevent round-off error accumulation.
*/
if (diff > 0) {
}
return(0);
}
/*
* The layout must shrink below its requested size. Compute the
* minimum possible size by looking at the slot minSizes.
*/
} else if (slot > 0) {
} else {
}
}
/*
* If the requested size is less than the minimum required size,
* set the slot sizes to their minimum values, then clip on the
*/
int offset = 0;
} else if (slot > 0) {
} else {
}
}
return(0);
}
/*
* Remove space from slots according to their weights. The weights
* get renormalized anytime a slot shrinks to its minimum size.
*/
while (diff < 0) {
/*
* Find the total weight for the shrinkable slots.
*/
} else {
}
}
if (totalWeight == 0) {
break;
}
/*
* Find the maximum amount of space we can distribute this pass.
*/
* this slot to equal its minsize */
continue;
}
}
}
/*
* Now distribute the space.
*/
}
}
return(0);
}
/*
*--------------------------------------------------------------
*
* AdjustForSticky --
*
* This procedure adjusts the size of a slave in its cavity based
* on its "sticky" flags.
*
* Results:
* The input x, y, width, and height are changed to represent the
* desired coordinates of the slave.
*
* Side effects:
* None.
*
*--------------------------------------------------------------
*/
static void
int *xPtr; /* Pixel location of the left edge of the cavity. */
int *yPtr; /* Pixel location of the top edge of the cavity. */
int *widthPtr; /* Width of the cavity (in pixels). */
int *heightPtr; /* Height of the cavity (in pixels). */
{
}
}
}
}
if (!(sticky&STICK_WEST)) {
}
if (!(sticky&STICK_NORTH)) {
}
}
/*
*--------------------------------------------------------------
*
* ArrangeGrid --
*
* This procedure is invoked (using the Tcl_DoWhenIdle
* mechanism) to re-layout a set of windows managed by
* the grid. It is invoked at idle time so that a
* series of grid requests can be merged into a single
* layout operation.
*
* Results:
* None.
*
* Side effects:
* The slaves of masterPtr may get resized or moved.
*
*--------------------------------------------------------------
*/
static void
* are to be re-layed out. */
{
int abort;
/*
* 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.
*/
return;
}
return;
}
/*
* Abort any nested call to ArrangeGrid for this window, since
* we'll do everything necessary here, and set up so this call
* can be aborted if necessary.
*/
}
abort = 0;
/*
* Call the constraint engine to fill in the row and column offsets.
*/
}
return;
}
/*
* If the currently requested layout size doesn't match the parent's
* window size, then adjust the slot offsets according to the
* weights. If all of the weights are zero, center the layout in
* its parent. I haven't decided what to do if the parent is smaller
* than the requested size.
*/
/*
* Now adjust the actual size of the slave to its cavity by
* computing the cavity size, and adjusting the widget according
* to its stickyness.
*/
int x, y; /* top left coordinate */
/*
* Now put the window in the proper spot. (This was taken directly
* from tkPack.c.) If the slave is a child of the master, then
* do this here. Otherwise let Tk_MaintainGeometry do the work.
*/
} else {
}
if (abort) {
break;
}
/*
* Don't map the slave if the master isn't mapped: wait
* until the master gets mapped later.
*/
}
}
} else {
} else {
}
}
}
}
/*
*--------------------------------------------------------------
*
* ResolveConstraints --
*
* Resolve all of the column and row boundaries. Most of
* the calculations are identical for rows and columns, so this procedure
* is called twice, once for rows, and again for columns.
*
* Results:
* returned.
*
* Side effects:
* The slot offsets are copied into the SlotInfo structure for the
* geometry master.
*
*--------------------------------------------------------------
*/
static int
int slotType; /* Either ROW or COLUMN. */
int maxOffset; /* The actual maximum size of this layout
* in pixels, or 0 (not currently used). */
{
* constraints. */
*/
* This is the minimum size needed to
* accomodate all of the slaves at their
* requested sizes. */
* current slot from the beginning of the
* layout. */
* constraints are not yet fully resolved. */
* constraints are not yet fully resolved. */
/*
* For typical sized tables, we'll use stack space for the layout data
* to avoid the overhead of a malloc and free for every layout.
*/
} else {
}
/*
* Make sure there is enough memory for the layout.
*/
if (gridCount >= TYPICAL_SIZE) {
} else {
}
/*
* the 0th slot to make it easier to calculate slot widths from
* offsets without special case code.
* This slot avoids special casing the first slot.
*/
layoutPtr++;
/*
* Step 1.
* Copy the slot constraints into the layout structure,
* and initialize the rest of the fields.
*/
}
}
/*
* Step 2.
* Slaves with a span of 1 are used to determine the minimum size of
* each slot. Slaves whose span is two or more slots don't
* contribute to the minimum size of each slot directly, but can cause
* slots to grow if their size exceeds the the sizes of the slots they
* span.
*
* Bin all slaves whose spans are > 1 by their right edges. This
* allows the computation on minimum and maximum possible layout
* sizes at each slot boundary, without the need to re-sort the slaves.
*/
switch (slotType) {
case COLUMN:
} else {
}
}
}
break;
case ROW:
} else {
}
}
}
break;
}
/*
* Step 3.
* Determine the minimum slot offsets going from left to right
* that would fit all of the slaves. This determines the minimum
*/
}
}
}
/*
* At this point, we know the minimum required size of the entire layout.
* It might be prudent to stop here if our "master" will resize itself
* to this size.
*/
}
/*
* Step 4.
* Determine the minimum slot offsets going from right to left,
* bounding the pixel range of each slot boundary.
* Pre-fill all of the right offsets with the actual size of the table;
* they will be reduced as required.
*/
}
}
}
slot--;
} else {
}
}
/*
* Step 5.
* At this point, each slot boundary has a range of values that
* will satisfy the overall layout size.
* Make repeated passes over the layout structure looking for
* spans of slot boundaries where the minOffsets are less than
* the maxOffsets, and adjust the offsets according to the slot
* weights. At each pass, at least one slot boundary will have
* its range of possible values fixed at a single value.
*/
* slots in this span. */
* this span. */
* be taken up by this span. */
* this span. */
/*
* Find a span by identifying ranges of slots whose edges are
* already constrained at fixed offsets, but whose internal
* slot boundaries have a range of possible positions.
*/
start++;
continue;
}
break;
}
}
/*
* We found a span. Compute the total weight, minumum space required,
* for this span, and the actual amount of space the span should
* use.
*/
}
/*
* If all the weights in the span are zero, then distribute the
* extra space evenly.
*/
if (totalWeight == 0) {
noWeights++;
}
/*
* It might not be possible to give the span all of the space
* available on this pass without violating the size constraints
* of one or more of the internal slot boundaries.
* Determine the maximum amount of space that when added to the
* entire span, would cause a slot boundary to have its possible
* range reduced to one value, and reduce the amount of extra
* space allocated on this pass accordingly.
*
* The calculation is done cumulatively to avoid accumulating
* roundoff errors.
*/
}
}
/*
* Now distribute the extra space among the slots by
* adjusting the minSizes and minOffsets.
*/
}
/*
* to propagate the new space allocation.
*/
}
}
/*
* Step 6.
* All of the space has been apportioned; copy the
* layout information back into the master.
*/
}
--layoutPtr;
if (layoutPtr != layoutData) {
}
return requiredSize;
}
/*
*--------------------------------------------------------------
*
* GetGrid --
*
* This internal procedure is used to locate a Grid
* structure for a given window, creating one if one
* doesn't exist already.
*
* Results:
* The return value is a pointer to the Grid structure
* corresponding to tkwin.
*
* Side effects:
* A new grid structure may be created. If so, then
* a callback is set up to clean things up when the
* window is deleted.
*
*--------------------------------------------------------------
*/
static Gridder *
* grid structure is desired. */
{
int new;
if (!initialized) {
initialized = 1;
}
/*
* See if there's already grid for this window. If not,
* then create a new one.
*/
if (!new) {
}
return gridPtr;
}
/*
*--------------------------------------------------------------
*
* SetGridSize --
*
* This internal procedure sets the size of the grid occupied
* by slaves.
*
* Results:
* none
*
* Side effects:
* The width and height arguments are filled in the master data structure.
* Additional space is allocated for the constraints to accomodate
* the offsets.
*
*--------------------------------------------------------------
*/
static void
{
}
}
/*
*--------------------------------------------------------------
*
* CheckSlotData --
*
* This internal procedure is used to manage the storage for
* row and column (slot) constraints.
*
* Results:
* TRUE if the index is OK, False otherwise.
*
* Side effects:
* A new master grid structure may be created. If so, then
* it is initialized. In addition, additional storage for
* a row or column constraints may be allocated, and the constraint
* maximums are (sometimes incorrectly) adjusted.
*
*--------------------------------------------------------------
*/
static int
int slot; /* which slot to look at */
int slotType; /* ROW or COLUMN */
int checkOnly; /* don't allocate new space if true */
{
/*
* If slot is out of bounds, return immediately.
*/
return TCL_ERROR;
}
return TCL_ERROR;
}
/*
* If we need to allocate more space, allocate a little extra to avoid
* repeated re-alloc's for large tables. We need enough space to
* hold all of the offsets as well.
*/
if (checkOnly==CHECK_ONLY) {
} else {
} else {
}
}
} else {
}
}
return TCL_OK;
}
}
/*
*--------------------------------------------------------------
*
* InitMasterData --
*
* This internal procedure is used to allocate and initialize
* the data for a geometry master, if the data
* doesn't exist already.
*
* Results:
* none
*
* Side effects:
* A new master grid structure may be created. If so, then
* it is initialized.
*
*--------------------------------------------------------------
*/
static void
{
gridPtr->columnSpace = 0;
}
}
/*
*----------------------------------------------------------------------
*
* Unlink --
*
* Remove a grid from its parent's list of slaves.
*
* Results:
* None.
*
* Side effects:
* The parent will be scheduled for re-arranging, and the size of the
* grid will be adjusted accordingly
*
*----------------------------------------------------------------------
*/
static void
{
return;
}
}
else {
panic("Unlink couldn't find previous window");
}
break;
}
}
}
}
}
}
}
/*
*----------------------------------------------------------------------
*
* DestroyGrid --
*
* This procedure is invoked by Tk_EventuallyFree or Tcl_Release
* to clean up the internal structure of a grid at a safe time
* (when no-one is using it anymore). Cleaning up the grid involves
* freeing the main structure for all windows. and the master structure
* for geometry managers.
*
* Results:
* None.
*
* Side effects:
* Everything associated with the grid is freed up.
*
*----------------------------------------------------------------------
*/
static void
char *memPtr; /* Info about window that is now dead. */
{
}
}
}
}
/*
*----------------------------------------------------------------------
*
* GridStructureProc --
*
* This procedure is invoked by the Tk event dispatcher in response
* to StructureNotify events.
*
* Results:
* None.
*
* Side effects:
* If a window was just deleted, clean up all its grid-related
* information. If it was just resized, re-configure its slaves, if
* any.
*
*----------------------------------------------------------------------
*/
static void
* referred to by eventPtr. */
{
}
}
}
}
}
}
}
}
}
}
/*
*----------------------------------------------------------------------
*
* ConfigureSlaves --
*
* This implements the guts of the "grid configure" command. Given
* a list of slaves and configuration options, it arranges for the
* grid to manage the slaves and sets the specified options.
* arguments consist of windows or window shortcuts followed by
* "-option value" pairs.
*
* Results:
* TCL_OK is returned if all went well. Otherwise, TCL_ERROR is
* returned and interp->result is set to contain an error message.
*
* Side effects:
* Slave windows get taken over by the grid.
*
*----------------------------------------------------------------------
*/
static int
* slaves. Used to look up slave names. */
int argc; /* Number of elements in argv. */
char *argv[]; /* Argument strings: contains one or more
* window names followed by any number
* of "option value" pairs. Caller must
* make sure that there is at least one
* window name. */
{
int numWindows = 0;
int width;
/*
* Count the number of windows, or window short-cuts.
*/
for(numWindows=i=0;i<argc;i++) {
if (firstChar == '.') {
numWindows++;
continue;
}
break;
}
if (length > 1) {
argv[i], "\", in configure list. ",
"Should be window name or option", (char *) NULL);
return TCL_ERROR;
}
"Must specify window before shortcut '-'.",
(char *) NULL);
return TCL_ERROR;
}
continue;
}
return TCL_ERROR;
}
numWindows = i;
" option with no value", (char *) NULL);
return TCL_ERROR;
}
/*
* Iterate over all of the slave windows and short-cuts, parsing
* options for each slave. It's a bit wasteful to re-parse the
* options for each slave, but things get too messy if we try to
* parse the arguments just once at the beginning. For example,
* if a slave already is managed we want to just change a few
* existing values without resetting everything. If there are
* multiple windows, the -in option only gets processed for the
* first window.
*/
for (j = 0; j < numWindows; j++) {
/*
* '^' and 'x' cause us to skip a column. '-' is processed
* as part of its preceeding slave.
*/
continue;
}
continue;
}
for (defaultColumnSpan=1;
j+defaultColumnSpan < numWindows &&
defaultColumnSpan++) {
/* null body */
}
return TCL_ERROR;
}
if (Tk_IsTopLevel(slave)) {
"\": it's a top-level window", (char *) NULL);
return TCL_ERROR;
}
/*
* The following statement is taken from tkPack.c:
*
* "If the slave isn't currently managed, reset all of its
* configuration information to default values (there could
* be old values left from a previous packer)."
*
* I [D.S.] disagree with this statement. If a slave is disabled (using
* "forget") and then re-enabled, I submit that 90% of the time the
* programmer will want it to retain its old configuration information.
* If the programmer doesn't want this behavior, then the
* defaults can be reestablished by hand, without having to worry
* about keeping track of the old state.
*/
c = argv[i][1];
if (length < 2) {
argv[i], "\": must be ",
"-column, -columnspan, -in, -ipadx, -ipady, ",
"-padx, -pady, -row, -rowspan, or -sticky",
(char *) NULL);
return TCL_ERROR;
}
"\": must be a non-negative integer", (char *)NULL);
return TCL_ERROR;
}
"\": must be a positive integer", (char *)NULL);
return TCL_ERROR;
}
return TCL_ERROR;
}
return TCL_ERROR;
}
|| (tmp < 0)) {
"\": must be positive screen distance",
(char *) NULL);
return TCL_ERROR;
}
|| (tmp< 0)) {
"\": must be positive screen distance",
(char *) NULL);
return TCL_ERROR;
}
|| (tmp< 0)) {
"\": must be positive screen distance",
(char *) NULL);
return TCL_ERROR;
}
|| (tmp< 0)) {
"\": must be positive screen distance",
(char *) NULL);
return TCL_ERROR;
}
"\": must be a non-negative integer", (char *)NULL);
return TCL_ERROR;
}
"\": must be a positive integer", (char *)NULL);
return TCL_ERROR;
}
if (sticky == -1) {
(char *)NULL);
return TCL_ERROR;
}
} else {
argv[i], "\": must be ",
"-column, -columnspan, -in, -ipadx, -ipady, ",
"-padx, -pady, -row, -rowspan, or -sticky",
(char *) NULL);
return TCL_ERROR;
}
}
/*
* Make sure we have a geometry master. We look at:
* 1) the -in flag
* 2) the geometry master of the first slave (if specified)
* 3) the parent of the first slave.
*/
}
}
}
}
/*
* Make sure that the slave's parent is either the master or
* an ancestor of the master, and that the master and slave
* aren't the same.
*/
break;
}
if (Tk_IsTopLevel(ancestor)) {
(char *) NULL);
return TCL_ERROR;
}
}
/*
* Try to make sure our master isn't managed by us.
*/
", would cause management loop.",
(char *) NULL);
return TCL_ERROR;
}
/*
* Assign default position information.
*/
}
} else {
}
}
defaultColumnSpan = 1;
/*
* Arrange for the parent to be re-arranged at the first
* idle moment.
*/
}
}
}
/* Now look for all the "^"'s. */
lastWindow = NULL;
for (j = 0; j < numWindows; j++) {
if (*argv[j] == '.') {
lastWindow = argv[j];
}
continue;
}
(char *) NULL);
return TCL_ERROR;
}
width++) {
/* Null Body */
}
/*
* Find the implied grid location of the ^
*/
if (lastWindow == NULL) {
} else {
lastRow = 0;
}
lastColumn = 0;
} else {
}
match++;
}
}
if (!match) {
(char *) NULL);
return TCL_ERROR;
}
j += width - 1;
}
(char *) NULL);
return TCL_ERROR;
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* StickyToString
*
* Converts the internal boolean combination of "sticky" bits onto
* a TCL list element containing zero or mor of n, s, e, or w.
*
* Results:
* A string is placed into the "result" pointer.
*
* Side effects:
* none.
*
*----------------------------------------------------------------------
*/
static void
int flags; /* the sticky flags */
char *result; /* where to put the result */
{
int count = 0;
if (flags&STICK_NORTH) {
}
if (flags&STICK_EAST) {
}
if (flags&STICK_SOUTH) {
}
if (flags&STICK_WEST) {
}
if (count) {
} else {
}
}
/*
*----------------------------------------------------------------------
*
* StringToSticky --
*
* Converts an ascii string representing a widgets stickyness
* into the boolean result.
*
* Results:
* The boolean combination of the "sticky" bits is retuned. If an
* error occurs, such as an invalid character, -1 is returned instead.
*
* Side effects:
* none
*
*----------------------------------------------------------------------
*/
static int
char *string;
{
int sticky = 0;
char c;
while ((c = *string++) != '\0') {
switch (c) {
case ' ': case ',': case '\t': case '\r': case '\n': break;
default: return -1;
}
}
return sticky;
}