Changes to generic/tkPanedWindow.c.
︙ | | |
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
-
-
-
-
+
+
-
+
-
-
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
-
+
+
|
Tcl_Obj *padXObj; /* Additional padding requested for pane, in
* the x dimension. */
Tcl_Obj *padYObj; /* Additional padding requested for pane, in
* the y dimension. */
Tcl_Obj *widthObj, *heightObj;
/* Tcl_Obj rep's of pane width/height, to
* allow for null values. */
int width; /* Pane width. */
int height; /* Pane height. */
int sticky; /* Sticky string. */
int x, y; /* Coordinates of the widget. */
int paneWidth, paneHeight; /* Pane dimensions (may be different from
* pane 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 pane grows/shrinks */
int hide; /* Controls visibility of pane */
struct PanedWindow *containerPtr;
/* Paned window managing the window. */
Tk_Window after; /* Placeholder for parsing options. */
Tk_Window before; /* Placeholder for parsing options. */
#ifdef BUILD_tk
int padX, padY;
int minSize;
int width; /* Pane width. */
int height; /* Pane height. */
#endif
} Pane;
/*
* A data structure of the following type is kept for each paned window widget
* managed by this file:
*/
typedef struct PanedWindow {
Tk_Window tkwin; /* Window that embodies the paned window. */
Tk_Window proxywin; /* Window for the resizing proxy. */
Display *display; /* X's token for the window's display. */
Tcl_Interp *interp; /* Interpreter associated with widget. */
Tcl_Command widgetCmd; /* Token for square's widget command. */
Tk_OptionTable optionTable; /* Token representing the configuration
* specifications. */
Tk_OptionTable paneOpts; /* Token for pane cget table. */
Tk_3DBorder background; /* Background color. */
int borderWidth; /* Value of -borderwidth option. */
Tcl_Obj *borderWidthObj;
int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */
Tcl_Obj *widthObj; /* Tcl_Obj rep for width. */
Tcl_Obj *heightObj; /* Tcl_Obj rep for height. */
int width, height; /* Width and height of the widget. */
enum orient orient; /* Orientation of the widget. */
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. */
Tcl_Obj *sashWidthObj; /* Tcl_Obj rep for sash width. */
int sashPad; /* Additional padding around each sash. */
Tcl_Obj *sashPadPtr; /* Tcl_Obj rep for sash padding. */
Tcl_Obj *sashPadObj; /* Tcl_Obj rep for sash padding. */
int showHandle; /* Boolean indicating whether sash handles
* should be drawn. */
int handleSize; /* Size of one side of a sash handle (handles
Tcl_Obj *handleSizeObj; /* Size of one side of a sash handle (handles
* are square), in pixels. */
int handlePad; /* Distance from border to draw handle. */
Tcl_Obj *handlePadObj; /* 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. */
Tk_3DBorder proxyBackground;/* Background color used to draw proxy. If NULL, use background. */
Tcl_Obj *proxyBorderWidthPtr; /* Tcl_Obj rep for proxyBorderWidth */
Tcl_Obj *proxyBorderWidthObj; /* Tcl_Obj rep for proxyBorderWidth */
int proxyBorderWidth; /* Borderwidth used to draw proxy. */
int proxyRelief; /* Relief used to draw proxy, if TK_RELIEF_NULL then use relief. */
Pane **panes; /* Pointer to array of Panes. */
int numPanes; /* Number of panes. */
int sizeofPanes; /* Number of elements in the panes array. */
int flags; /* Flags for widget; see below. */
#ifdef BUILD_tk
Tcl_Obj *borderWidthObj;
Tcl_Obj *handlePadPtr;
int width, height; /* Width and height of the widget. */
#endif
} PanedWindow;
/*
* Flags used for paned windows:
*
* REDRAW_PENDING: Non-zero means a DoWhenIdle handler has been
* queued to redraw this window.
|
︙ | | |
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
|
DEF_PANEDWINDOW_BG_COLOR, TCL_INDEX_NONE, offsetof(PanedWindow, background), 0,
DEF_PANEDWINDOW_BG_MONO, 0},
{TK_OPTION_SYNONYM, "-bd", NULL, NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-borderwidth", 0},
{TK_OPTION_SYNONYM, "-bg", NULL, NULL,
NULL, 0, TCL_INDEX_NONE, 0, "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_PANEDWINDOW_BORDERWIDTH, offsetof(PanedWindow, borderWidthObj), offsetof(PanedWindow, borderWidth),
DEF_PANEDWINDOW_BORDERWIDTH, offsetof(PanedWindow, borderWidthObj), TCL_INDEX_NONE,
0, 0, GEOMETRY},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad",
DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadPtr), offsetof(PanedWindow, handlePad),
DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadObj), TCL_INDEX_NONE,
0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize",
DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr),
offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY},
DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizeObj),
TCL_INDEX_NONE, 0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-height", "height", "Height",
DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightObj),
offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize",
DEF_PANEDWINDOW_OPAQUERESIZE, TCL_INDEX_NONE,
offsetof(PanedWindow, resizeOpaque), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
DEF_PANEDWINDOW_ORIENT, TCL_INDEX_NONE, offsetof(PanedWindow, orient),
TK_OPTION_ENUM_VAR, orientStrings, GEOMETRY},
{TK_OPTION_BORDER, "-proxybackground", "proxyBackground", "ProxyBackground",
0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK,
(void *)DEF_PANEDWINDOW_BG_MONO, 0},
{TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth",
DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr),
offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY},
DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthObj),
TCL_INDEX_NONE, 0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief",
0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyRelief),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_PANEDWINDOW_RELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, relief), 0, 0, 0},
{TK_OPTION_CURSOR, "-sashcursor", "sashCursor", "Cursor",
DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad",
DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadPtr), offsetof(PanedWindow, sashPad),
DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadObj), TCL_INDEX_NONE,
0, 0, GEOMETRY},
{TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief",
DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief),
0, 0, 0},
{TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width",
DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr),
offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY},
DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthObj),
TCL_INDEX_NONE, 0, 0, GEOMETRY},
{TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle",
DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle),
0, 0, GEOMETRY},
{TK_OPTION_PIXELS, "-width", "width", "Width",
DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthObj),
offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
|
︙ | | |
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
-
+
-
+
-
+
|
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL,
DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightObj),
offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
{TK_OPTION_PIXELS, "-minsize", NULL, NULL,
DEF_PANEDWINDOW_PANE_MINSIZE, offsetof(Pane, minSizeObj), offsetof(Pane, minSize), 0, 0, 0},
DEF_PANEDWINDOW_PANE_MINSIZE, offsetof(Pane, minSizeObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
DEF_PANEDWINDOW_PANE_PADX, offsetof(Pane, padXObj), offsetof(Pane, padX), 0, 0, 0},
DEF_PANEDWINDOW_PANE_PADX, offsetof(Pane, padXObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
DEF_PANEDWINDOW_PANE_PADY, offsetof(Pane, padYObj), offsetof(Pane, padY), 0, 0, 0},
DEF_PANEDWINDOW_PANE_PADY, offsetof(Pane, padYObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky),
0, &stickyOption, 0},
{TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch),
TK_OPTION_ENUM_VAR, stretchStrings, 0},
{TK_OPTION_PIXELS, "-width", NULL, NULL,
|
︙ | | |
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
|
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
|
+
+
+
-
-
+
+
+
|
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i + 2]),
pwPtr->tkwin);
found = 0;
for (j = 0; j < pwPtr->numPanes; j++) {
if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) {
int minSize;
Tk_SetOptions(interp, pwPtr->panes[j],
pwPtr->paneOpts, objc - firstOptionArg,
objv + firstOptionArg, pwPtr->tkwin, NULL, NULL);
Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->panes[j]->minSizeObj, &minSize);
if (minSize < 0) {
if (pwPtr->panes[j]->minSize < 0) {
pwPtr->panes[j]->minSize = 0;
Tcl_DecrRefCount(pwPtr->panes[j]->minSizeObj);
pwPtr->panes[j]->minSizeObj = Tcl_NewIntObj(0);
Tcl_IncrRefCount(pwPtr->panes[j]->minSizeObj);
}
found = 1;
/*
* If the pane is supposed to move, add it to the inserts
* array now; otherwise, leave it where it is.
*/
|
︙ | | |
967
968
969
970
971
972
973
974
975
976
977
978
979
980
|
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
|
+
|
continue;
}
/*
* Create a new pane structure and initialize it. All panes start
* out with their "natural" dimensions.
*/
int minSize;
panePtr = (Pane *)ckalloc(sizeof(Pane));
memset(panePtr, 0, sizeof(Pane));
Tk_InitOptions(interp, panePtr, pwPtr->paneOpts,
pwPtr->tkwin);
Tk_SetOptions(interp, panePtr, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
|
︙ | | |
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
|
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
|
+
-
-
+
+
+
+
|
panePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw;
}
if (panePtr->height > 0) {
panePtr->paneHeight = panePtr->height;
} else {
panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
}
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize);
if (panePtr->minSize < 0) {
panePtr->minSize = 0;
if (minSize < 0) {
Tcl_DecrRefCount(panePtr->minSizeObj);
panePtr->minSizeObj = Tcl_NewIntObj(0);
Tcl_IncrRefCount(panePtr->minSizeObj);
}
/*
* Set up the geometry management callbacks for this pane.
*/
Tk_CreateEventHandler(panePtr->tkwin, StructureNotifyMask,
|
︙ | | |
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
|
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
|
+
+
-
+
|
static void
PanedWindowWorldChanged(
void *instanceData) /* Information about the paned window. */
{
XGCValues gcValues;
GC newGC;
PanedWindow *pwPtr = (PanedWindow *)instanceData;
int borderWidth;
/*
* Allocated a graphics context for drawing the paned window widget
* elements (background, sashes, etc.) and set the window background.
*/
gcValues.background = Tk_3DBorderColor(pwPtr->background)->pixel;
newGC = Tk_GetGC(pwPtr->tkwin, GCBackground, &gcValues);
if (pwPtr->gc != NULL) {
Tk_FreeGC(pwPtr->display, pwPtr->gc);
}
pwPtr->gc = newGC;
Tk_SetWindowBackground(pwPtr->tkwin, gcValues.background);
/*
* Issue geometry size requests to Tk.
*/
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->borderWidthObj, &borderWidth);
Tk_SetInternalBorder(pwPtr->tkwin, pwPtr->borderWidth);
Tk_SetInternalBorder(pwPtr->tkwin, borderWidth);
if (pwPtr->width > 0 && pwPtr->height > 0) {
Tk_GeometryRequest(pwPtr->tkwin, pwPtr->width, pwPtr->height);
}
/*
* Arrange for the window to be redrawn, if neccessary.
*/
|
︙ | | |
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
|
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
|
+
|
PanedWindow *pwPtr = (PanedWindow *)clientData;
Pane *panePtr;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->tkwin;
int i, sashWidth, sashHeight;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
int first, last;
int borderWidth;
pwPtr->flags &= ~REDRAW_PENDING;
if ((pwPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
return;
}
if (pwPtr->flags & REQUESTED_RELAYOUT) {
|
︙ | | |
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
|
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
|
+
-
+
+
-
+
-
+
-
+
+
+
-
+
|
pixmap = Tk_WindowId(tkwin);
#endif /* TK_NO_DOUBLE_BUFFERING */
/*
* Redraw the widget's background and border.
*/
Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->borderWidthObj, &borderWidth);
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, 0, 0,
Tk_Width(tkwin), Tk_Height(tkwin), pwPtr->borderWidth,
Tk_Width(tkwin), Tk_Height(tkwin), borderWidth,
pwPtr->relief);
/*
* Set up boilerplate geometry values for sashes (width, height, common
* coordinates).
*/
Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->sashWidthObj, &sashWidth);
if (horizontal) {
if (horizontal) {
sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin));
sashWidth = pwPtr->sashWidth;
} else {
sashHeight = sashWidth;
sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderLeft(tkwin));
sashHeight = pwPtr->sashWidth;
}
/*
* Draw the sashes.
*/
GetFirstLastVisiblePane(pwPtr, &first, &last);
for (i = 0; i < pwPtr->numPanes - 1; i++) {
panePtr = pwPtr->panes[i];
if (panePtr->hide || i == last) {
continue;
}
if (sashWidth > 0 && sashHeight > 0) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
panePtr->sashx, panePtr->sashy, sashWidth, sashHeight,
1, pwPtr->sashRelief);
}
if (pwPtr->showHandle) {
int handleSize;
Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->handleSizeObj, &handleSize);
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
panePtr->handlex, panePtr->handley,
pwPtr->handleSize, pwPtr->handleSize, 1,
handleSize, handleSize, 1,
TK_RELIEF_RAISED);
}
}
#ifndef TK_NO_DOUBLE_BUFFERING
/*
* Copy the information from the off-screen pixmap onto the screen, then
|
︙ | | |
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
|
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
|
+
|
int sashWidth, sashOffset, sashCount, handleOffset;
int sashReserve, sxReserve, syReserve;
int internalBW;
int paneDynSize, paneDynMinSize, pwHeight, pwWidth, pwSize;
int first, last;
int stretchReserve, stretchAmount;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
int handleSize, sashPad, handlePad;
pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING);
/*
* If the parent has no panes 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
|
︙ | | |
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
|
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
|
+
-
-
+
+
+
+
-
-
-
+
+
-
-
-
+
+
+
+
+
+
-
+
-
+
+
-
+
+
+
|
stretchReserve = (horizontal ? pwWidth : pwHeight);
/*
* Calculate the sash width, including handle and padding, and the sash
* and handle offsets.
*/
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad);
sashOffset = handleOffset = pwPtr->sashPad;
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashOffset = handleOffset = sashPad;
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth);
if (pwPtr->showHandle && handleSize > sashWidth) {
sashWidth = (2 * pwPtr->sashPad) + pwPtr->handleSize;
sashOffset = ((pwPtr->handleSize - pwPtr->sashWidth) / 2)
+ pwPtr->sashPad;
sashOffset = ((handleSize - sashWidth) / 2) + sashPad;
sashWidth = (2 * sashPad) + handleSize;
} else {
sashWidth = (2 * pwPtr->sashPad) + pwPtr->sashWidth;
handleOffset = ((pwPtr->sashWidth - pwPtr->handleSize) / 2)
+ pwPtr->sashPad;
handleOffset = ((sashWidth - handleSize) / 2) + sashPad;
sashWidth = (2 * sashPad) + sashWidth;
}
for (i = sashCount = 0; i < pwPtr->numPanes; i++) {
int padX, padY, minSize;
panePtr = pwPtr->panes[i];
if (panePtr->hide) {
continue;
}
/*
* Compute the total size needed by all the panes and the left-over,
* or shortage of space available.
*/
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX);
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY);
if (horizontal) {
if (panePtr->width > 0) {
paneSize = panePtr->width;
} else {
paneSize = panePtr->paneWidth;
}
stretchReserve -= paneSize + (2 * panePtr->padX);
stretchReserve -= paneSize + (2 * padX);
} else {
if (panePtr->height > 0) {
paneSize = panePtr->height;
} else {
paneSize = panePtr->paneHeight;
}
stretchReserve -= paneSize + (2 * panePtr->padY);
stretchReserve -= paneSize + (2 * padY);
}
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize);
if (IsStretchable(panePtr->stretch,i,first,last)
&& Tk_IsMapped(pwPtr->tkwin)) {
paneDynSize += paneSize;
paneDynMinSize += panePtr->minSize;
paneDynMinSize += minSize;
}
if (i != last) {
stretchReserve -= sashWidth;
sashCount++;
}
}
/*
* Second pass; adjust/arrange panes.
*/
for (i = 0; i < pwPtr->numPanes; i++) {
int padX, padY;
panePtr = pwPtr->panes[i];
if (panePtr->hide) {
Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
Tk_UnmapWindow(panePtr->tkwin);
continue;
}
|
︙ | | |
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
|
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
|
-
+
|
*/
doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
newPaneWidth = (panePtr->width > 0 ? panePtr->width :
Tk_ReqWidth(panePtr->tkwin) + doubleBw);
newPaneHeight = (panePtr->height > 0 ? panePtr->height :
Tk_ReqHeight(panePtr->tkwin) + doubleBw);
paneMinSize = panePtr->minSize;
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &paneMinSize);
/*
* Calculate pane width and height.
*/
if (horizontal) {
if (panePtr->width > 0) {
|
︙ | | |
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
|
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
|
-
+
|
if (paneDynSize > 0) {
frac = (double)paneSize / (double)paneDynSize;
} else {
frac = (double)paneSize / (double)pwSize;
}
paneDynSize -= paneSize;
paneDynMinSize -= panePtr->minSize;
paneDynMinSize -= paneMinSize;
stretchAmount = (int) (frac * stretchReserve);
if (paneSize + stretchAmount >= paneMinSize) {
stretchReserve -= stretchAmount;
paneSize += stretchAmount;
} else {
stretchReserve += paneSize - paneMinSize;
paneSize = paneMinSize;
|
︙ | | |
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
|
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
|
+
+
-
+
-
+
|
stretchReserve += paneSize - paneMinSize;
paneSize = paneMinSize;
} else {
paneSize += paneDynSize - paneDynMinSize + stretchReserve;
stretchReserve = paneDynMinSize - paneDynSize;
}
}
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX);
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY);
if (horizontal) {
paneWidth = paneSize;
paneHeight = pwHeight - (2 * panePtr->padY);
paneHeight = pwHeight - (2 * padY);
} else {
paneWidth = pwWidth - (2 * panePtr->padX);
paneWidth = pwWidth - (2 * padX);
paneHeight = paneSize;
}
/*
* Adjust for area reserved for sashes.
*/
|
︙ | | |
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
|
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
|
+
-
+
-
+
-
+
-
+
-
-
+
+
|
panePtr->y = y;
/*
* Compute the location of the sash at the right or bottom of the
* parcel and the location of the next parcel.
*/
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handlePadObj, &handlePad);
if (horizontal) {
x += paneWidth + (2 * panePtr->padX);
x += paneWidth + (2 * padX);
if (x < internalBW) {
x = internalBW;
}
panePtr->sashx = x + sashOffset;
panePtr->sashy = y;
panePtr->handlex = x + handleOffset;
panePtr->handley = y + pwPtr->handlePad;
panePtr->handley = y + handlePad;
x += sashWidth;
} else {
y += paneHeight + (2 * panePtr->padY);
y += paneHeight + (2 * padY);
if (y < internalBW) {
y = internalBW;
}
panePtr->sashx = x;
panePtr->sashy = y + sashOffset;
panePtr->handlex = x + pwPtr->handlePad;
panePtr->handlex = x + handlePad;
panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
* Compute the actual dimensions of the pane in the pane.
*/
paneX = panePtr->x;
paneY = panePtr->y;
AdjustForSticky(panePtr->sticky, paneWidth, paneHeight,
&paneX, &paneY, &newPaneWidth, &newPaneHeight);
paneX += panePtr->padX;
paneY += panePtr->padY;
paneX += padX;
paneY += padY;
/*
* Now put the window in the proper spot.
*/
if (newPaneWidth <= 0 || newPaneHeight <= 0 ||
(horizontal ? paneX - internalBW > pwWidth :
|
︙ | | |
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
|
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
|
-
+
+
+
-
-
+
+
+
+
-
-
-
+
+
-
-
-
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
-
+
-
+
-
+
-
+
|
static void
ComputeGeometry(
PanedWindow *pwPtr) /* Pointer to the Paned Window structure. */
{
int i, x, y, doubleBw, internalBw;
int sashWidth, sashOffset, handleOffset;
int reqWidth, reqHeight, dim;
int reqWidth, reqHeight, dim, handleSize;
Pane *panePtr;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
int sashPad;
pwPtr->flags |= REQUESTED_RELAYOUT;
x = y = internalBw = Tk_InternalBorderLeft(pwPtr->tkwin);
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).
*/
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad);
sashOffset = handleOffset = pwPtr->sashPad;
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashOffset = handleOffset = sashPad;
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth);
if (pwPtr->showHandle && handleSize > sashWidth) {
sashWidth = (2 * pwPtr->sashPad) + pwPtr->handleSize;
sashOffset = ((pwPtr->handleSize - pwPtr->sashWidth) / 2)
+ pwPtr->sashPad;
sashOffset = ((handleSize - sashWidth) / 2) + sashPad;
sashWidth = (2 * sashPad) + handleSize;
} else {
sashWidth = (2 * pwPtr->sashPad) + pwPtr->sashWidth;
handleOffset = ((pwPtr->sashWidth - pwPtr->handleSize) / 2)
+ pwPtr->sashPad;
handleOffset = ((sashWidth - handleSize) / 2) + sashPad;
sashWidth = (2 * sashPad) + sashWidth;
}
for (i = 0; i < pwPtr->numPanes; i++) {
int padX, padY, minSize, handlePad;
panePtr = pwPtr->panes[i];
if (panePtr->hide) {
continue;
}
/*
* First set the coordinates for the top left corner of the pane's
* parcel.
*/
panePtr->x = x;
panePtr->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.
*/
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize);
if (horizontal) {
if (panePtr->paneWidth < panePtr->minSize) {
panePtr->paneWidth = panePtr->minSize;
if (panePtr->paneWidth < minSize) {
panePtr->paneWidth = minSize;
}
} else {
if (panePtr->paneHeight < panePtr->minSize) {
panePtr->paneHeight = panePtr->minSize;
if (panePtr->paneHeight < minSize) {
panePtr->paneHeight = minSize;
}
}
/*
* Compute the location of the sash at the right or bottom of the
* parcel.
*/
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX);
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handlePadObj, &handlePad);
if (horizontal) {
x += panePtr->paneWidth + (2 * panePtr->padX);
x += panePtr->paneWidth + (2 * padX);
panePtr->sashx = x + sashOffset;
panePtr->sashy = y;
panePtr->handlex = x + handleOffset;
panePtr->handley = y + pwPtr->handlePad;
panePtr->handley = y + handlePad;
x += sashWidth;
} else {
y += panePtr->paneHeight + (2 * panePtr->padY);
y += panePtr->paneHeight + (2 * padY);
panePtr->sashx = x;
panePtr->sashy = y + sashOffset;
panePtr->handlex = x + pwPtr->handlePad;
panePtr->handlex = x + handlePad;
panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
* Find the maximum height/width of the panes, for computing the
* requested height/width of the paned window.
|
︙ | | |
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
|
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
|
-
+
-
+
|
if (panePtr->height > 0) {
dim = panePtr->height;
} else {
doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
dim += 2 * panePtr->padY;
dim += 2 * padY;
if (dim > reqHeight) {
reqHeight = dim;
}
} else {
/*
* If the pane has an explicit width set use that; otherwise, use
* the pane's requested width.
*/
if (panePtr->width > 0) {
dim = panePtr->width;
} else {
doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
dim += 2 * panePtr->padX;
dim += 2 * padX;
if (dim > reqWidth) {
reqWidth = dim;
}
}
}
/*
|
︙ | | |
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
|
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
|
+
-
-
-
+
+
+
+
+
-
+
+
+
+
-
+
-
+
|
{
int i;
int expandPane, reduceFirst, reduceLast, reduceIncr, paneSize, sashOffset;
Pane *panePtr;
int stretchReserve = 0;
int nextSash = sash + 1;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
int handleSize, sashPad, sashWidth;
if (diff == 0)
return;
/*
* Update the pane sizes with their real sizes.
*/
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashOffset = ((pwPtr->handleSize - pwPtr->sashWidth) / 2)
+ pwPtr->sashPad;
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth);
if (pwPtr->showHandle && handleSize > sashWidth) {
sashOffset = ((handleSize - sashWidth) / 2) + sashPad;
} else {
sashOffset = pwPtr->sashPad;
sashOffset = sashPad;
}
for (i = 0; i < pwPtr->numPanes; i++) {
int padX, padY;
panePtr = pwPtr->panes[i];
if (panePtr->hide) {
continue;
}
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX);
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY);
if (horizontal) {
panePtr->paneWidth = panePtr->width = panePtr->sashx
- sashOffset - panePtr->x - (2 * panePtr->padX);
- sashOffset - panePtr->x - (2 * padX);
} else {
panePtr->paneHeight = panePtr->height = panePtr->sashy
- sashOffset - panePtr->y - (2 * panePtr->padY);
- sashOffset - panePtr->y - (2 * padY);
}
}
/*
* 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.
|
︙ | | |
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
|
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
|
+
+
+
-
+
-
+
|
reduceIncr = -1;
}
/*
* Calculate how much room we have to stretch in and adjust diff value
* accordingly.
*/
int minSize;
Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize);
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
panePtr = pwPtr->panes[i];
if (panePtr->hide) {
continue;
}
if (horizontal) {
stretchReserve += panePtr->width - panePtr->minSize;
stretchReserve += panePtr->width - minSize;
} else {
stretchReserve += panePtr->height - panePtr->minSize;
stretchReserve += panePtr->height - minSize;
}
}
if (stretchReserve <= 0) {
return;
}
if (diff > stretchReserve) {
diff = stretchReserve;
|
︙ | | |
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
|
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
|
-
-
-
+
+
+
|
continue;
}
if (horizontal) {
paneSize = panePtr->width;
} else {
paneSize = panePtr->height;
}
if (diff > (paneSize - panePtr->minSize)) {
diff -= paneSize - panePtr->minSize;
paneSize = panePtr->minSize;
if (diff > (paneSize - minSize)) {
diff -= paneSize - minSize;
paneSize = minSize;
} else {
paneSize -= diff;
i = reduceLast - reduceIncr;
}
if (horizontal) {
panePtr->paneWidth = panePtr->width = paneSize;
} else {
|
︙ | | |
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
|
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
|
+
+
+
-
+
-
+
|
static void
DisplayProxyWindow(
void *clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->proxywin;
int proxyBorderWidth;
pwPtr->flags &= ~PROXY_REDRAW_PENDING;
if ((tkwin == NULL) || !Tk_IsMapped(tkwin)) {
return;
}
#ifndef TK_NO_DOUBLE_BUFFERING
/*
* Create a pixmap for double-buffering, if necessary.
*/
pixmap = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin),
Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
#else
pixmap = Tk_WindowId(tkwin);
#endif /* TK_NO_DOUBLE_BUFFERING */
/*
* Redraw the widget's background and border.
*/
Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->proxyBorderWidthObj, &proxyBorderWidth);
Tk_Fill3DRectangle(tkwin, pixmap,
Tk_Fill3DRectangle(tkwin, pixmap,
pwPtr->proxyBackground ? pwPtr->proxyBackground : pwPtr->background,
0, 0, Tk_Width(tkwin), Tk_Height(tkwin), pwPtr->proxyBorderWidth,
0, 0, Tk_Width(tkwin), Tk_Height(tkwin), proxyBorderWidth,
(pwPtr->proxyRelief != TK_RELIEF_NULL) ? pwPtr->proxyRelief : pwPtr->sashRelief);
#ifndef TK_NO_DOUBLE_BUFFERING
/*
* Copy the pixmap to the display.
*/
|
︙ | | |
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
|
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
|
+
-
-
+
|
}
if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) {
return TCL_ERROR;
}
internalBW = Tk_InternalBorderLeft(pwPtr->tkwin);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth);
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (x < 0) {
x = 0;
}
pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW);
if (x > pwWidth) {
x = pwWidth;
}
y = Tk_InternalBorderLeft(pwPtr->tkwin);
sashWidth = pwPtr->sashWidth;
sashHeight = Tk_Height(pwPtr->tkwin) -
(2 * Tk_InternalBorderLeft(pwPtr->tkwin));
} else {
if (y < 0) {
y = 0;
}
pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW);
if (y > pwHeight) {
y = pwHeight;
}
x = Tk_InternalBorderLeft(pwPtr->tkwin);
sashHeight = pwPtr->sashWidth;
sashHeight = sashWidth;
sashWidth = Tk_Width(pwPtr->tkwin) -
(2 * Tk_InternalBorderLeft(pwPtr->tkwin));
}
if (sashWidth < 1) {
sashWidth = 1;
}
|
︙ | | |
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
|
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
|
-
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
|
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. */
{
int i, sashHeight, sashWidth, thisx, thisy;
int found, isHandle, lpad, rpad, tpad, bpad;
int first, last;
int first, last, handleSize, sashPad;
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad);
Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth);
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (Tk_IsMapped(pwPtr->tkwin)) {
sashHeight = Tk_Height(pwPtr->tkwin);
} else {
sashHeight = Tk_ReqHeight(pwPtr->tkwin);
}
sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin);
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
if (pwPtr->showHandle && handleSize > sashWidth) {
sashWidth = pwPtr->handleSize;
lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
rpad = pwPtr->handleSize - lpad;
lpad += pwPtr->sashPad;
rpad += pwPtr->sashPad;
lpad = (handleSize - sashWidth) / 2;
rpad = handleSize - lpad;
lpad += sashPad;
rpad += sashPad;
sashWidth = handleSize;
} else {
sashWidth = pwPtr->sashWidth;
lpad = rpad = pwPtr->sashPad;
lpad = rpad = sashPad;
}
tpad = bpad = 0;
} else {
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashHeight = pwPtr->handleSize;
tpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
bpad = pwPtr->handleSize - tpad;
tpad += pwPtr->sashPad;
bpad += pwPtr->sashPad;
if (pwPtr->showHandle && handleSize > sashWidth) {
sashHeight = handleSize;
tpad = (handleSize - sashWidth) / 2;
bpad = handleSize - tpad;
tpad += sashPad;
bpad += sashPad;
} else {
sashHeight = pwPtr->sashWidth;
tpad = bpad = pwPtr->sashPad;
sashHeight = sashWidth;
tpad = bpad = sashPad;
}
if (Tk_IsMapped(pwPtr->tkwin)) {
sashWidth = Tk_Width(pwPtr->tkwin);
} else {
sashWidth = Tk_ReqWidth(pwPtr->tkwin);
}
sashWidth -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin);
|
︙ | | |
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
|
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
|
-
+
-
+
|
* Determine if the point is over the handle or the sash.
*/
if (pwPtr->showHandle) {
thisx = pwPtr->panes[i]->handlex;
thisy = pwPtr->panes[i]->handley;
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (thisy <= y && y <= (thisy + pwPtr->handleSize)) {
if (thisy <= y && y <= (thisy + handleSize)) {
isHandle = 1;
}
} else {
if (thisx <= x && x <= (thisx + pwPtr->handleSize)) {
if (thisx <= x && x <= (thisx + handleSize)) {
isHandle = 1;
}
}
}
break;
}
}
|
︙ | | |