[Bf-committers] Panel auto resize bug
Sun, 19 Oct 2003 19:00:24 +1000
As said earlier I hope there could be a full auto-align mode - where you
don't have to switch between vertical and horizontal mode and it even can
optimize the space in a square shaped window.
In this proposal (which even deals with different sized panels, the top left
panel is always in the same position.
BTW, as a last resort, you could just enumerate all of the layouts (like I
did with ABCDE) with their corresponding aspect ratio, then search for the
aspect ratio that is the best match with the button windows aspect ratio.
Assuming the panels are all the same size (e.g. 40x30 units) and there are 5
of them, the best match might be a 3x2 layout like this:
DE (left aligned - but horizontal alignment could be customizable)
So that would be 120x60 units which mean it has an aspect ratio of 2.0. The
enumeration of different layout possibilities could be stored in the RAM so
that while you're resizing the buttons window frame the optimal layout can
be constantly shown. BTW I think the "home" key/icon command should be
executed whenever necessary (when either the buttons window or panel sizes
change...)... it would take hardly any CPU usage - e.g. if the aspect ratio
of the current panel layout (determined earlier) was 2.0, and the buttons
window is 200 x 90 pixels, then the panel layout would be 180x90 pixels (it
has to be smaller or equal to 200x90). That means the panels are magnified
by a factor of 1.5 since in their default units they're 120x60. BTW, the
automatically home key press should happen *after* the automatical panel
layout is chosen. And if panel sizes change then the layouts would need to
be recalculated. There would be a problem having animated minimizing of
panels and auto-arranging and auto-optimizing of panels though since
auto-arranging would usually treat the recently minimized panel as if it is
fully small when it should treat it as being gradually getting smaller... (I
favour auto-home key presses and auto-arranging over nice looking
minimization animations) Also, as I've mentioned before, whenever I start-up
2.29, the top of the panels are cut off and I have to press home to fix
> I've had a lot of troubles finding a good heuristic for auto align.
> First of all I wanted the headers to align in horizontal mode... so
> aligning them at the top was the logical choice. Also when you switch
> to vertical or back, the first panel stays where it is.
> Adding more constraints will increase the size of the panel. I see
> there's an error in the align code that doesn't keep the headers
> aligned... I will fix that.
> Of course; this type of flexible size Panel is best used in vertical
> align mode!
> In the version in CVS I see one Constraint drawing error, which
> disappears after redraw. I fix that.
> The align code is quite simple, and you can try some variants
> yourself... :)