-
-/*+-------------------------------------------------------------------------
- __override(pan,show)
---------------------------------------------------------------------------*/
-static void
-__override(const PANEL *pan, int show)
-{
- int y;
- PANEL *pan2;
- PANELCONS *tobs = pan->obscure; /* "this" one */
-
- dBug(("__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;
- }
-} /* end of __override */
-
-/*+-------------------------------------------------------------------------
- __calculate_obscure()
---------------------------------------------------------------------------*/
-static void
-__calculate_obscure(void)
-{
- PANEL *pan;
- PANEL *pan2;
- PANELCONS *tobs; /* "this" one */
- PANELCONS *lobs = (PANELCONS *)0; /* last one */
-
- pan = __bottom_panel;
- while(pan)
- {
- if(pan->obscure)
- __free_obscure(pan);
- dBug(("--> __calculate_obscure %s", USER_PTR(pan->user)));
- lobs = (PANELCONS *)0; /* last one */
- pan2 = __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;
- }
- __override(pan,P_TOUCH);
- pan = pan->above;
- }
-} /* end of __calculate_obscure */
-
-/*+-------------------------------------------------------------------------
- __panel_is_linked(pan) - check to see if panel is in the stack
---------------------------------------------------------------------------*/
-static INLINE bool
-__panel_is_linked(const PANEL *pan)
-{
- /* This works! The only case where it would fail is, when the list has
- only one element. But this could only be the pseudo panel at the bottom */
- return ( ((pan->above!=(PANEL *)0) ||
- (pan->below!=(PANEL *)0) ||
- (pan==__bottom_panel)) ? TRUE : FALSE );
-} /* end of __panel_is_linked */
-
-/*+-------------------------------------------------------------------------
- __panel_link_top(pan) - link panel into stack at top
---------------------------------------------------------------------------*/
-static void
-__panel_link_top(PANEL *pan)
-{
-#ifdef TRACE
- dStack("<lt%d>",1,pan);
- if(__panel_is_linked(pan))
- return;
-#endif
-
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
- if(__top_panel)
- {
- __top_panel->above = pan;
- pan->below = __top_panel;
- }
- __top_panel = pan;
- if(!__bottom_panel)
- __bottom_panel = pan;
- __calculate_obscure();
- dStack("<lt%d>",9,pan);
-
-} /* end of __panel_link_top */
-
-/*+-------------------------------------------------------------------------
- __panel_link_bottom(pan) - link panel into stack at bottom
---------------------------------------------------------------------------*/
-static void
-__panel_link_bottom(PANEL *pan)
-{
-#ifdef TRACE
- dStack("<lb%d>",1,pan);
- if(__panel_is_linked(pan))
- return;