65 |
static void size_window P_ ((Lisp_Object, int, int, int)); |
static void size_window P_ ((Lisp_Object, int, int, int)); |
66 |
static int freeze_window_start P_ ((struct window *, void *)); |
static int freeze_window_start P_ ((struct window *, void *)); |
67 |
static int window_fixed_size_p P_ ((struct window *, int, int)); |
static int window_fixed_size_p P_ ((struct window *, int, int)); |
68 |
static void enlarge_window P_ ((Lisp_Object, int, int, int)); |
static void enlarge_window P_ ((Lisp_Object, int, int)); |
69 |
static Lisp_Object window_list P_ ((void)); |
static Lisp_Object window_list P_ ((void)); |
70 |
static int add_window_to_list P_ ((struct window *, void *)); |
static int add_window_to_list P_ ((struct window *, void *)); |
71 |
static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
3590 |
+ XFASTINT (XWINDOW (window)->total_lines)); |
+ XFASTINT (XWINDOW (window)->total_lines)); |
3591 |
enlarge_window (upper, |
enlarge_window (upper, |
3592 |
total / 2 - XFASTINT (XWINDOW (upper)->total_lines), |
total / 2 - XFASTINT (XWINDOW (upper)->total_lines), |
3593 |
0, 0); |
0); |
3594 |
} |
} |
3595 |
} |
} |
3596 |
} |
} |
3881 |
return new; |
return new; |
3882 |
} |
} |
3883 |
|
|
3884 |
DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 3, "p", |
DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p", |
3885 |
doc: /* Make current window ARG lines bigger. |
doc: /* Make current window ARG lines bigger. |
3886 |
From program, optional second arg non-nil means grow sideways ARG columns. |
From program, optional second arg non-nil means grow sideways ARG columns. |
3887 |
Interactively, if an argument is not given, make the window one line bigger. |
Interactively, if an argument is not given, make the window one line bigger. |
3888 |
If HORIZONTAL is non-nil, enlarge horizontally instead of vertically. |
If HORIZONTAL is non-nil, enlarge horizontally instead of vertically. |
3889 |
|
This function can delete windows, even the second window, if they get |
3890 |
Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size |
too small. */) |
3891 |
of the siblings above or to the left of the selected window. Only |
(arg, horizontal) |
3892 |
siblings to the right or below are changed. */) |
Lisp_Object arg, horizontal; |
|
(arg, horizontal, preserve_before) |
|
|
register Lisp_Object arg, horizontal, preserve_before; |
|
3893 |
{ |
{ |
3894 |
CHECK_NUMBER (arg); |
CHECK_NUMBER (arg); |
3895 |
enlarge_window (selected_window, XINT (arg), !NILP (horizontal), |
enlarge_window (selected_window, XINT (arg), !NILP (horizontal)); |
|
!NILP (preserve_before)); |
|
3896 |
|
|
3897 |
if (! NILP (Vwindow_configuration_change_hook)) |
if (! NILP (Vwindow_configuration_change_hook)) |
3898 |
call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
3900 |
return Qnil; |
return Qnil; |
3901 |
} |
} |
3902 |
|
|
3903 |
DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 3, "p", |
DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", |
3904 |
doc: /* Make current window ARG lines smaller. |
doc: /* Make current window ARG lines smaller. |
3905 |
From program, optional second arg non-nil means shrink sideways arg columns. |
From program, optional second arg non-nil means shrink sideways arg columns. |
3906 |
Interactively, if an argument is not given, make the window one line smaller. |
Interactively, if an argument is not given, make the window one line smaller. Only |
|
|
|
|
Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size |
|
|
of the siblings above or to the left of the selected window. Only |
|
3907 |
siblings to the right or below are changed. */) |
siblings to the right or below are changed. */) |
3908 |
(arg, side, preserve_before) |
(arg, side) |
3909 |
register Lisp_Object arg, side, preserve_before; |
Lisp_Object arg, side; |
3910 |
{ |
{ |
3911 |
CHECK_NUMBER (arg); |
CHECK_NUMBER (arg); |
3912 |
enlarge_window (selected_window, -XINT (arg), !NILP (side), |
enlarge_window (selected_window, -XINT (arg), !NILP (side)); |
|
!NILP (preserve_before)); |
|
3913 |
|
|
3914 |
if (! NILP (Vwindow_configuration_change_hook)) |
if (! NILP (Vwindow_configuration_change_hook)) |
3915 |
call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
3947 |
|
|
3948 |
Siblings of the selected window are resized to fulfill the size |
Siblings of the selected window are resized to fulfill the size |
3949 |
request. If they become too small in the process, they will be |
request. If they become too small in the process, they will be |
3950 |
deleted. |
deleted. */ |
|
|
|
|
If PRESERVE_BEFORE is nonzero, that means don't alter |
|
|
the siblings to the left or above WINDOW. */ |
|
3951 |
|
|
3952 |
static void |
static void |
3953 |
enlarge_window (window, delta, horiz_flag, preserve_before) |
enlarge_window (window, delta, horiz_flag) |
3954 |
Lisp_Object window; |
Lisp_Object window; |
3955 |
int delta, horiz_flag, preserve_before; |
int delta, horiz_flag; |
3956 |
{ |
{ |
3957 |
Lisp_Object parent, next, prev; |
Lisp_Object parent, next, prev; |
3958 |
struct window *p; |
struct window *p; |
3999 |
|
|
4000 |
/* Compute the maximum size increment this window can have. */ |
/* Compute the maximum size increment this window can have. */ |
4001 |
|
|
4002 |
if (preserve_before) |
maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep) |
4003 |
{ |
/* This is a main window followed by a minibuffer. */ |
4004 |
if (!NILP (parent)) |
: !NILP (p->next) ? ((*sizefun) (p->next) |
4005 |
{ |
- window_min_size (XWINDOW (p->next), |
4006 |
maxdelta = (*sizefun) (parent) - XINT (*sizep); |
horiz_flag, 0, 0)) |
4007 |
/* Subtract size of siblings before, since we can't take that. */ |
/* This is a minibuffer following a main window. */ |
4008 |
maxdelta -= XINT (CURBEG (window)) - XINT (CURBEG (parent)); |
: !NILP (p->prev) ? ((*sizefun) (p->prev) |
4009 |
} |
- window_min_size (XWINDOW (p->prev), |
4010 |
else |
horiz_flag, 0, 0)) |
4011 |
maxdelta = (!NILP (p->next) ? ((*sizefun) (p->next) |
/* This is a frame with only one window, a minibuffer-only |
4012 |
- window_min_size (XWINDOW (p->next), |
or a minibufferless frame. */ |
4013 |
horiz_flag, 0, 0)) |
: (delta = 0)); |
|
: (delta = 0)); |
|
|
} |
|
|
else |
|
|
maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep) |
|
|
/* This is a main window followed by a minibuffer. */ |
|
|
: !NILP (p->next) ? ((*sizefun) (p->next) |
|
|
- window_min_size (XWINDOW (p->next), |
|
|
horiz_flag, 0, 0)) |
|
|
/* This is a minibuffer following a main window. */ |
|
|
: !NILP (p->prev) ? ((*sizefun) (p->prev) |
|
|
- window_min_size (XWINDOW (p->prev), |
|
|
horiz_flag, 0, 0)) |
|
|
/* This is a frame with only one window, a minibuffer-only |
|
|
or a minibufferless frame. */ |
|
|
: (delta = 0)); |
|
4014 |
|
|
4015 |
if (delta > maxdelta) |
if (delta > maxdelta) |
4016 |
/* This case traps trying to make the minibuffer |
/* This case traps trying to make the minibuffer |
4033 |
for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) |
for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) |
4034 |
maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), |
maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), |
4035 |
horiz_flag, 0, 0); |
horiz_flag, 0, 0); |
4036 |
if (! preserve_before) |
for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) |
4037 |
for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) |
maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), |
4038 |
maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), |
horiz_flag, 0, 0); |
|
horiz_flag, 0, 0); |
|
4039 |
|
|
4040 |
/* If we can get it all from them without deleting them, do so. */ |
/* If we can get it all from them without deleting them, do so. */ |
4041 |
if (delta <= maximum) |
if (delta <= maximum) |
4051 |
moving away from this window in both directions alternately, |
moving away from this window in both directions alternately, |
4052 |
and take as much as we can get without deleting that sibling. */ |
and take as much as we can get without deleting that sibling. */ |
4053 |
while (delta != 0 |
while (delta != 0 |
4054 |
&& (!NILP (next) || (!preserve_before && !NILP (prev)))) |
&& (!NILP (next) || !NILP (prev))) |
4055 |
{ |
{ |
4056 |
if (! NILP (next)) |
if (! NILP (next)) |
4057 |
{ |
{ |
4075 |
if (delta == 0) |
if (delta == 0) |
4076 |
break; |
break; |
4077 |
|
|
4078 |
if (!preserve_before && ! NILP (prev)) |
if (! NILP (prev)) |
4079 |
{ |
{ |
4080 |
int this_one = ((*sizefun) (prev) |
int this_one = ((*sizefun) (prev) |
4081 |
- window_min_size (XWINDOW (prev), |
- window_min_size (XWINDOW (prev), |
4324 |
DEFUN ("adjust-window-trailing-edge", Fadjust_window_trailing_edge, |
DEFUN ("adjust-window-trailing-edge", Fadjust_window_trailing_edge, |
4325 |
Sadjust_window_trailing_edge, 3, 3, 0, |
Sadjust_window_trailing_edge, 3, 3, 0, |
4326 |
doc: /* Adjust the bottom or right edge of WINDOW by DELTA. |
doc: /* Adjust the bottom or right edge of WINDOW by DELTA. |
4327 |
If HORIZ_FLAG is t, that means adjust the width, moving the right edge. |
If HORIZONTAL is non-nil, that means adjust the width, moving the right edge. |
4328 |
Otherwise, adjust the height, moving the bottom edge. |
Otherwise, adjust the height, moving the bottom edge. |
4329 |
|
|
4330 |
Following siblings of the selected window are resized to fulfill |
Following siblings of the selected window are resized to fulfill |
4576 |
among the other windows. */ |
among the other windows. */ |
4577 |
Lisp_Object window; |
Lisp_Object window; |
4578 |
XSETWINDOW (window, w); |
XSETWINDOW (window, w); |
4579 |
enlarge_window (window, 1 - XFASTINT (w->total_lines), 0, 0); |
enlarge_window (window, 1 - XFASTINT (w->total_lines), 0); |
4580 |
} |
} |
4581 |
} |
} |
4582 |
|
|