1: #ifndef lint
   2: static char sccsid[] = "@(#)cmd5.c	3.14 4/24/85";
   3: #endif
   4: 
   5: /*
   6:  * Copyright (c) 1983 Regents of the University of California,
   7:  * All rights reserved.  Redistribution permitted subject to
   8:  * the terms of the Berkeley Software License Agreement.
   9:  */
  10: 
  11: #include "defs.h"
  12: 
  13: /*
  14:  * Window movement.
  15:  */
  16: 
  17: c_move(w)
  18: register struct ww *w;
  19: {
  20:     int col, row;
  21:     int mincol, minrow;
  22:     int maxcol, maxrow;
  23:     int curcol, currow;
  24: 
  25:     if (!terse)
  26:         wwputs("New window position: ", cmdwin);
  27:     col = w->ww_w.l;
  28:     row = w->ww_w.t;
  29:     wwadd(boxwin, framewin->ww_back);
  30:     for (;;) {
  31:         wwbox(boxwin, row - 1, col - 1, w->ww_w.nr + 2, w->ww_w.nc + 2);
  32:         getminmax(row, w->ww_w.nr, 1, wwnrow,
  33:             &currow, &minrow, &maxrow);
  34:         getminmax(col, w->ww_w.nc, 0, wwncol,
  35:             &curcol, &mincol, &maxcol);
  36:         wwsetcursor(currow, curcol);
  37:         while (wwpeekc() < 0)
  38:             wwiomux();
  39:         switch (getpos(&row, &col, minrow, mincol, maxrow, maxcol)) {
  40:         case 3:
  41:             wwunbox(boxwin);
  42:             wwdelete(boxwin);
  43:             return;
  44:         case 2:
  45:             wwunbox(boxwin);
  46:             break;
  47:         case 1:
  48:             wwunbox(boxwin);
  49:         case 0:
  50:             continue;
  51:         }
  52:         break;
  53:     }
  54:     wwdelete(boxwin);
  55:     if (!terse)
  56:         wwputc('\n', cmdwin);
  57:     wwcurtowin(cmdwin);
  58:     movewin(w, row, col);
  59: }
  60: 
  61: movewin(w, row, col)
  62: register struct ww *w;
  63: {
  64:     struct ww *back = w->ww_back;
  65: 
  66:     w->ww_alt.t = w->ww_w.t;
  67:     w->ww_alt.l = w->ww_w.l;
  68:     wwdelete(w);
  69:     wwmove(w, row, col);
  70:     wwadd(w, back);
  71:     reframe();
  72: }
  73: 
  74: /*
  75:  * Weird stufff, don't ask.
  76:  */
  77: getminmax(x, n, a, b, curx, minx, maxx)
  78: register x, n, a, b;
  79: int *curx, *minx, *maxx;
  80: {
  81:     if (x < 0)
  82:         *curx = x + n - 1;
  83:     else
  84:         *curx = x;
  85: 
  86:     if (x <= a)
  87:         *minx = 1 - n;
  88:     else if (x <= b - n)
  89:         *minx = a;
  90:     else
  91:         *minx = b - n;
  92: 
  93:     if (x >= b - n)
  94:         *maxx = b - 1;
  95:     else if (x >= a)
  96:         *maxx = b - n;
  97:     else
  98:         *maxx = a;
  99: }

Defined functions

c_move defined in line 17; used 1 times
getminmax defined in line 77; used 2 times
movewin defined in line 61; used 2 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1985-04-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1019
Valid CSS Valid XHTML 1.0 Strict