top: consolidate logic dealing with resetting a window

This commit just gathers all the logic associated with
resetting/normalizing a single window in one function.

In the future, should the window structure be expanded
to support added functionality, the act of maintaining
it will have been made a little bit easier, hopefully.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-02-27 00:00:00 -06:00 committed by Jaromir Capik
parent a458871cde
commit 9dd7251ca3
2 changed files with 19 additions and 16 deletions

View File

@ -3615,6 +3615,20 @@ static void win_names (WIN_t *q, const char *name) {
} // end: win_names
/*
* This guy just resets (normalizes) a single window
* and he ensures pid monitoring is no longer active. */
static void win_reset (WIN_t *q) {
SETw(q, Show_IDLEPS | Show_TASKON);
#ifndef SCROLLVAR_NO
q->rc.maxtasks = q->usrseltyp = q->begpflg = q->begtask = q->varcolbeg = 0;
#else
q->rc.maxtasks = q->usrseltyp = q->begpflg = q->begtask = 0;
#endif
Monpidsidx = 0;
} // end: win_reset
/*
* Display a window/field group (ie. make it "current"). */
static WIN_t *win_select (int ch) {
@ -3791,15 +3805,9 @@ static void wins_reflag (int what, int flg) {
}
/* a flag with special significance -- user wants to rebalance
display so we gotta' off some stuff then force on two flags... */
if (EQUWINS_xxx == flg) {
#ifndef SCROLLVAR_NO
w->rc.maxtasks = w->usrseltyp = w->begpflg = w->begtask = w->varcolbeg = 0;
#else
w->rc.maxtasks = w->usrseltyp = w->begpflg = w->begtask = 0;
#endif
Monpidsidx = 0;
SETw(w, Show_IDLEPS | Show_TASKON);
}
if (EQUWINS_xxx == flg)
win_reset(w);
w = w->next;
} while (w != Curwin);
} // end: wins_reflag
@ -4325,13 +4333,7 @@ static void keys_window (int ch) {
if (ALTCHKw) TOGw(w, Show_TASKON);
break;
case '=':
SETw(w, Show_IDLEPS | Show_TASKON);
#ifndef SCROLLVAR_NO
w->rc.maxtasks = w->usrseltyp = w->begpflg = w->begtask = w->varcolbeg = 0;
#else
w->rc.maxtasks = w->usrseltyp = w->begpflg = w->begtask = 0;
#endif
Monpidsidx = 0;
win_reset(w);
break;
case '_':
if (ALTCHKw) wins_reflag(Flags_TOG, Show_TASKON);

View File

@ -701,6 +701,7 @@ typedef struct WIN_t {
//atic void whack_terminal (void);
/*------ Windows/Field Groups support ----------------------------------*/
//atic void win_names (WIN_t *q, const char *name);
//atic void win_reset (WIN_t *q);
//atic WIN_t *win_select (int ch);
//atic int win_warn (int what);
//atic void wins_clrhlp (WIN_t *q, int save);