Function:xs2qcpa

From S2PLOT

Jump to: navigation, search

xs2qcpa

Is the currently selected panel active?

Prototype

int xs2qcpa(void);

Description

Is the currently selected panel active? Only works in static mode - in dynamic mode, callbacks associated with deactivated panels are not processed.

See Also

xs2cpSelect a panel for subsequent geometry calls.
xs2apAdd a new panel
xs2mpModify location of existing panel
xs2tpToggle visibility of panel
xs2lpcLink panel cameras together
xs2qspQuery currently selected panel
xs2qpaIs specified panel active?

Code Example

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "s2plot.h"

int main(int argc, char *argv[])
{
   int panel0 = 0;                              /* Default ID of main panel */
   int panel1;                                  /* ID of newly created panel */
   int panel2;                                  /* ID of newly created panel */
   int pa;                                      /* Activity status of panel */

   srand48((long)time(NULL));                   /* Seed random numbers */

   s2opend("/s2mono", argc, argv);              /* Open in mono mode */

   xs2mp(panel0, 0.5, 1.0, 1.0, 1.0);           /* Move master to top */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);  /* Draw coordinate box */

   panel1 = xs2ap(0.0, 0.0, 0.5, 0.5);          /* Create new panel */
   xs2cp(panel1);                               /* Choose this panel */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set window coordinates */
   s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0);     /* Draw coordinate box */

   panel2 = xs2ap(0.5, 0.0, 1.0, 0.5);          /* Create new panel  */
   xs2cp(panel2);                               /* Choose this panel */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set window coordinates */
   s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0);     /* Draw coordinate box */

   int i;                                       /* Loop variable */
   for (i=panel0;i<=panel2;i++) {
      if (drand48() > 0.7) xs2tp(i);            /* Randomly deactivate panel */
      xs2cp(i);                                 /* Chose a panel */
      pa = xs2qcpa();                           /* Is this panel active? */
      if (pa) fprintf(stderr,"Panel %d is active\n",i);
      else fprintf(stderr,"Panel %d is inactive\n",i);
   }

   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.