/[emacs]/emacs/src/window.c
ViewVC logotype

Diff of /emacs/src/window.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.529 by monnier, Thu Dec 1 16:25:15 2005 UTC revision 1.530 by rms, Tue Dec 6 02:03:23 2005 UTC
# Line 65  static int window_min_size P_ ((struct w Line 65  static int window_min_size P_ ((struct w
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,
# Line 3590  displayed.  */) Line 3590  displayed.  */)
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      }      }
# Line 3881  See Info node `(elisp)Splitting Windows' Line 3881  See Info node `(elisp)Splitting Windows'
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);
# Line 3903  siblings to the right or below are chang Line 3900  siblings to the right or below are chang
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);
# Line 3954  window_width (window) Line 3947  window_width (window)
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;
# Line 4009  enlarge_window (window, delta, horiz_fla Line 3999  enlarge_window (window, delta, horiz_fla
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
# Line 4058  enlarge_window (window, delta, horiz_fla Line 4033  enlarge_window (window, delta, horiz_fla
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)
# Line 4077  enlarge_window (window, delta, horiz_fla Line 4051  enlarge_window (window, delta, horiz_fla
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              {              {
# Line 4101  enlarge_window (window, delta, horiz_fla Line 4075  enlarge_window (window, delta, horiz_fla
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),
# Line 4350  adjust_window_trailing_edge (window, del Line 4324  adjust_window_trailing_edge (window, del
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
# Line 4602  shrink_mini_window (w) Line 4576  shrink_mini_window (w)
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    

Legend:
Removed from v.1.529  
changed lines
  Added in v.1.530

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26