panel auto_split patch
- From: Joel Newkirk <mc-devel newkirk us>
- To: mc-devel gnome org
- Subject: panel auto_split patch
- Date: Tue, 02 Sep 2008 02:04:01 -0400
(NOT Subscribed To List)
On some platforms (such as Freerunner, with 2.8" screen) it is a common
occurrence for the screen orientation to change portrait<->landscape,
and also for size to be too small in one dimension for comfortable
visual layout. (IE, vertical_split is awkward when portrait-mode console
is <50 characters wide) Also, on most platforms it's quite reasonable
to presume that the window dimensions are subject to change, and that
those changes can quite easily involve severe limitation in one dimension.
But if you have selected 'vertical split' for example, and then change
the X*Y proportions of the window sufficiently, things can get too
cramped. So I propose 'auto_split' option - if selected by user, then
split will be automatically horizontal or vertical, depending on whether
height*2>COLS. (a somewhat arbitrary proportion I've found to work well
in my tests so far - essentially, with most fonts, if the window is
square or wider it chooses Vertical, if narrower it chooses Horizontal)
It's a simple patch (against 4.6.1), entailing a few additions and a few
alterations to layout.c, and adding 'extern int auto_split;' to layout.h
and '{ "auto_split", &auto_split },' to layout[] in setup.c. It may not
be correct, but so far it 'works for me'. (it gets quite frustrating
after a while using mc on a handheld, when switching from portrait to
landscape means you need to pull down Options->layout, change
horizontal|vertical split, & save - you don't necessarily change
orientation frequently, but mc could be invoked while in either mode,
and it would be very helpful if it were able to adapt)
The only potential bug I've seen is that numerically-specified panel
sizes get bungled if 'auto split' is selected in the Layout dialog while
'equal split' is not set. (when changing from vertical to horizontal in
the layout dialog with 'equal split' not set, it forces reversion to
50%/50%, however for an 'auto split' scenario it really isn't sensible
to talk about absolute split dimensions - but when it comes down to it,
it doesn't really make much sense to have column/row counts for manual
unequal split to begin with, when window dimensions and fonts are
subject to unpredictable changes)
j
Joel Newkirk
mc-devel newkirk us
78a79,81
> /* Set if the panel split horiz vs vert choice is handled
automatically based on terminal dimensions */
> int auto_split=0;
>
123a127
> static int _auto_split;
170a175
> { N_("&Auto split"), &auto_split, 0 },
183a189,196
> if (_auto_split)
> {
> _horizontal_split=0;
> if (height*2<COLS)
> {
> _horizontal_split=1;
> }
> }
217c230
< dlg_move (layout_dlg, 6, 6);
---
> dlg_move (layout_dlg, 7, 6);
219c232
< dlg_move (layout_dlg, 6, 18);
---
> dlg_move (layout_dlg, 7, 18);
295a309
> _auto_split = check_options [9].widget->state & C_BOOL;
370c384
< for (i = 0; i <= 8; i++) {
---
> for (i = 0; i <= 9; i++) {
425,426c439,440
< add_widget (layout_dlg, groupbox_new (4, 2, first_width, 6, title1));
< add_widget (layout_dlg, groupbox_new (4, 8, first_width, 4, title2));
---
> add_widget (layout_dlg, groupbox_new (4, 2, first_width, 7, title1));
> add_widget (layout_dlg, groupbox_new (4, 9, first_width, 4, title2));
467a482,483
>
>
469c485
< button_new (6, 15, B_2RIGHT, NARROW_BUTTON, "&>", b2right_cback);
---
> button_new (7, 15, B_2RIGHT, NARROW_BUTTON, "&>", b2right_cback);
472c488
< button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback);
---
> button_new (7, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback);
474c490
< check_options[6].widget = check_new (5, 6, XTRACT (6));
---
> check_options[6].widget = check_new (6, 6, XTRACT (6));
481a498,499
> check_options[9].widget = check_new (5, 6, XTRACT (9));
> add_widget (layout_dlg, check_options[9].widget);
528a547,554
> if (auto_split)
> {
> horizontal_split=0;
> if (height*2>COLS)
> {
> horizontal_split=1;
> }
> }
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]