bottom_panel(PANEL * pan) { int err = OK; T((T_CALLED("bottom_panel(%p)"), pan)); if (pan) { if (!Is_Bottom(pan)) { dBug(("--> bottom_panel %s", USER_PTR(pan->user))); HIDE_PANEL(pan, err, OK); assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); dStack("<lb%d>", 1, pan); pan->below = _nc_bottom_panel; pan->above = _nc_bottom_panel->above; if (pan->above) pan->above->below = pan; _nc_bottom_panel->above = pan; dStack("<lb%d>", 9, pan); } } else err = ERR; returnCode(err); }
show_panel(PANEL * pan) { int err = ERR; T((T_CALLED("show_panel(%p)"), (void *)pan)); if (pan) { GetHook(pan); if (Is_Top(pan)) returnCode(OK); dBug(("--> show_panel %s", USER_PTR(pan->user))); HIDE_PANEL(pan, err, OK); dStack("<lt%d>", 1, pan); assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); _nc_top_panel->above = pan; pan->below = _nc_top_panel; pan->above = (PANEL *) 0; _nc_top_panel = pan; err = OK; dStack("<lt%d>", 9, pan); } returnCode(err); }
/*+------------------------------------------------------------------------- __override(pan,show) --------------------------------------------------------------------------*/ void _nc_override(const PANEL *pan, int show) { int y; PANEL *pan2; PANELCONS *tobs = pan->obscure; /* "this" one */ dBug(("_nc_override %s,%d", USER_PTR(pan->user),show)); switch (show) { case P_TOUCH: Touchpan(pan); /* The following while loop will now mark all panel window lines * obscured by use or obscuring us as touched, so they will be * updated. */ break; case P_UPDATE: while(tobs && (tobs->pan != pan)) tobs = tobs->above; /* The next loop will now only go through the panels obscuring pan; * it updates all the lines in the obscuring panels in sync. with * the lines touched in pan itself. This is called in update_panels() * in a loop from the bottom_panel to the top_panel, resulting in * the desired update effect. */ break; default: return; } while(tobs) { if((pan2 = tobs->pan) != pan) { dBug(("test obs pan=%s pan2=%s", USER_PTR(pan->user), USER_PTR(pan2->user))); for(y = pan->wstarty; y < pan->wendy; y++) { if( (y >= pan2->wstarty) && (y < pan2->wendy) && ((is_linetouched(pan->win,y - pan->wstarty) == TRUE)) ) Touchline(pan2,y - pan2->wstarty,1); } } tobs = tobs->above; } }
/*+------------------------------------------------------------------------- __panels_overlapped(pan1,pan2) - check panel overlapped --------------------------------------------------------------------------*/ static INLINE bool __panels_overlapped(register const PANEL *pan1, register const PANEL *pan2) { if(!pan1 || !pan2) return(FALSE); dBug(("__panels_overlapped %s %s", USER_PTR(pan1->user), USER_PTR(pan2->user))); /* pan1 intersects with pan2 ? */ if( (((pan1->wstarty >= pan2->wstarty) && (pan1->wstarty < pan2->wendy)) || ((pan2->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy))) && (((pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx)) || ((pan2->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx))) ) return(TRUE); else { dBug((" no")); return(FALSE); } }
del_panel (PANEL *pan) { int err = OK; if(pan) { dBug(("--> del_panel %s", USER_PTR(pan->user))); HIDE_PANEL(pan,err,OK); free((void *)pan); } else err = ERR; return(err); }
del_panel(PANEL * pan) { int err = OK; T((T_CALLED("del_panel(%p)"), pan)); if (pan) { dBug(("--> del_panel %s", USER_PTR(pan->user))); HIDE_PANEL(pan, err, OK); free((void *)pan); } else err = ERR; returnCode(err); }
hide_panel(register PANEL * pan) { int err = OK; T((T_CALLED("hide_panel(%p)"), pan)); if (!pan) returnCode(ERR); dBug(("--> hide_panel %s", USER_PTR(pan->user))); dStack("<u%d>", 1, pan); HIDE_PANEL(pan, err, ERR); dStack("<u%d>", 9, pan); returnCode(err); }
int hide_panel(register PANEL *pan) { int err = OK; if(!pan) return(ERR); dBug(("--> hide_panel %s", USER_PTR(pan->user))); dStack("<u%d>",1,pan); HIDE_PANEL(pan,err,TRUE); dStack("<u%d>",9,pan); return(err); }
void update_panels(void) { PANEL *pan; dBug(("--> update_panels")); pan = _nc_bottom_panel; while(pan && pan->above) { PANEL_UPDATE(pan,pan->above, FALSE); pan = pan->above; } pan = _nc_bottom_panel; while (pan) { Wnoutrefresh(pan); pan = pan->above; } }
hide_panel(register PANEL * pan) { int err = ERR; T((T_CALLED("hide_panel(%p)"), (void *)pan)); if (pan) { GetHook(pan); dBug(("--> hide_panel %s", USER_PTR(pan->user))); dStack("<u%d>", 1, pan); HIDE_PANEL(pan, err, ERR); err = OK; dStack("<u%d>", 9, pan); } returnCode(err); }
/*+------------------------------------------------------------------------- __calculate_obscure() --------------------------------------------------------------------------*/ void _nc_calculate_obscure(void) { PANEL *pan; PANEL *pan2; PANELCONS *tobs; /* "this" one */ PANELCONS *lobs = (PANELCONS *)0; /* last one */ pan = _nc_bottom_panel; while(pan) { if(pan->obscure) _nc_free_obscure(pan); dBug(("--> __calculate_obscure %s", USER_PTR(pan->user))); lobs = (PANELCONS *)0; /* last one */ pan2 = _nc_bottom_panel; /* This loop builds a list of panels obsured by pan or obscuring pan; pan itself is in the list; all panels before pan are obscured by pan, all panels after pan are obscuring pan. */ while(pan2) { if(__panels_overlapped(pan,pan2)) { if(!(tobs = (PANELCONS *)malloc(sizeof(PANELCONS)))) return; tobs->pan = pan2; dPanel("obscured",pan2); tobs->above = (PANELCONS *)0; if(lobs) lobs->above = tobs; else pan->obscure = tobs; lobs = tobs; } pan2 = pan2->above; } _nc_override(pan,P_TOUCH); pan = pan->above; } }
update_panels(void) { PANEL *pan; T((T_CALLED("update_panels()"))); dBug(("--> update_panels")); pan = _nc_bottom_panel; while (pan && pan->above) { PANEL_UPDATE(pan, pan->above); pan = pan->above; } pan = _nc_bottom_panel; while (pan) { Wnoutrefresh(pan); pan = pan->above; } returnVoid; }