From f6dcc514a9f2bd4216bf0b06c5c4978b5c43db08 Mon Sep 17 00:00:00 2001 From: "donal.k.fellows@manchester.ac.uk" Date: Wed, 21 May 2003 15:30:59 +0000 Subject: The panedwindow widget now sizes right around unmapped windows. [Bug 738143] --- ChangeLog | 3 +++ generic/tkPanedWindow.c | 13 ++++++++++--- tests/panedwindow.test | 12 +++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca115de..726ac6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-05-21 Donal K. Fellows + * generic/tkPanedWindow.c (PanedWindowReqProc): Thanks very much + to Eric Boudaillier for making panes resize correctly! [Bug 738143] + * generic/tkText.c (TextSearchCmd): Forwards and backwards aren't the same. [Bug 740558] Also edited SearchCore to get it closer to the Engineering Manual style guidelines. diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index a096c75..9d72509 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -12,7 +12,7 @@ * 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.13 2003/02/21 11:48:54 dkf Exp $ + * RCS: @(#) $Id: tkPanedWindow.c,v 1.14 2003/05/21 15:31:01 dkf Exp $ */ #include "tkPort.h" @@ -1518,14 +1518,21 @@ PanedWindowReqProc(clientData, tkwin) Tk_Window tkwin; /* Other Tk-related information * about the window. */ { - Slave *panePtr = (Slave *) clientData; - PanedWindow *pwPtr = (PanedWindow *) (panePtr->masterPtr); + Slave *slavePtr = (Slave *) clientData; + PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr); if (Tk_IsMapped(pwPtr->tkwin)) { if (!(pwPtr->flags & RESIZE_PENDING)) { pwPtr->flags |= RESIZE_PENDING; Tcl_DoWhenIdle(ArrangePanes, (ClientData) pwPtr); } } else { + int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; + if (slavePtr->width <= 0) { + slavePtr->paneWidth = Tk_ReqWidth(slavePtr->tkwin) + doubleBw; + } + if (slavePtr->height <= 0) { + slavePtr->paneHeight = Tk_ReqHeight(slavePtr->tkwin) + doubleBw; + } ComputeGeometry(pwPtr); } } diff --git a/tests/panedwindow.test b/tests/panedwindow.test index 0da6bbc..70e0e7c 100644 --- a/tests/panedwindow.test +++ b/tests/panedwindow.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: panedwindow.test,v 1.9 2003/04/01 21:06:49 dgp Exp $ +# RCS: @(#) $Id: panedwindow.test,v 1.10 2003/05/21 15:31:01 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -1883,6 +1883,16 @@ test panedwindow-23.1 {PanedWindowReqProc, react to slave geometry changes} { destroy .p .f1 .f2 set result } {40 80} +test panedwindow-23.2 {PanedWindowReqProc, react to slave geometry changes} { + panedwindow .p -orient horizontal -sashpad 0 -sashwidth 2 + .p add [frame .f1 -width 10] [frame .f2 -width 10] + set result [winfo reqwidth .p] + .f1 configure -width 20 + lappend result [winfo reqwidth .p] + destroy .p .f1 .f2 + set result +} {32 42} + test panedwindow-24.1 {ConfigurePanes, can't add panedwindow to itself} { panedwindow .p -- cgit v0.12