Function:xs2qpa
From S2PLOT
(Difference between revisions)
Revision as of 03:46, 4 December 2007 S2plot admin (Talk | contribs) ← Previous diff |
Revision as of 03:46, 4 December 2007 S2plot admin (Talk | contribs) Next diff → |
||
Line 19: | Line 19: | ||
<tr><td>[[Function:xs2lpc | xs2lpc]]</td><td>Link panel cameras together.</td><td> </td></tr> | <tr><td>[[Function:xs2lpc | xs2lpc]]</td><td>Link panel cameras together.</td><td> </td></tr> | ||
<tr><td>[[Function:xs2qsp | xs2qsp]]</td><td>Query currently selected panel.</td></tr> | <tr><td>[[Function:xs2qsp | xs2qsp]]</td><td>Query currently selected panel.</td></tr> | ||
- | <tr><td>[[Function:xs2qpa | xs2qpa]]</td><td>Is specified panel active? </td></tr> | ||
<tr><td>[[Function:xs2qcpa | xs2qcpa]]</td><td>Is currently selected panel active? </td></tr> | <tr><td>[[Function:xs2qcpa | xs2qcpa]]</td><td>Is currently selected panel active? </td></tr> | ||
</table> | </table> |
Revision as of 03:46, 4 December 2007
xs2qpa
Is specified panel active?
Prototype
int xs2qpa(int panelid);
Description
Is the specified panel active? Activity of a panel is modified using xs2tp. In dynamic mode, the callback is disabled if the panel is inactive.
See Also
xs2cp | Select a panel for subsequent geometry calls. | |
xs2ap | Add a new panel. | |
xs2mp | Modify location of existing panel. | |
xs2tp | Toggle visibility of panel. | |
xs2lpc | Link panel cameras together. | |
xs2qsp | Query currently selected panel. | |
xs2qcpa | Is currently selected panel active? |
Code Example
#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"
/* Global variable */
int pid = 0; /* Which panel should be drawn? */
int panel0; /* ID of the master panel */
void cb(double *t, int *kc)
{
int myid = xs2qsp(); /* Query the panel id currently being drawn */
if (myid == panel0) { /* Is this the main panel? */
static int count = 8; /* Counter */
if (count < 0) { /* Is it time to choose a new panel */
pid = random()%3; /* Choose a random new panel */
count = 8; /* Reset the counter */
}
count--; /* Decrease counter */
}
if (myid == pid) { /* If this panel is the selected panel... */
s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */
char string[32];
sprintf(string,"I am panel %d",myid); /* Prepare a string */
s2textxy(-1,0,0,string); /* Write the string */
}
}
int main(int argc, char *argv[])
{
int panel1; /* ID of newly created panel */
int panel2; /* ID of newly created panel */
s2opend("/s2mono", argc, argv); /* Open in mono mode */
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
panel0 = xs2qsp(); /* Get the ID of the master panel */
xs2mp(panel0, 0.0, 0.5, 1.0, 1.0); /* Move default panel to top left */
cs2scb(&cb); /* Install a dynamic callback */
panel1 = xs2ap(0.0, 0.0, 0.5, 0.5); /* Create panel in bottom left */
xs2cp(panel1); /* Choose this panel */
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
cs2scb(&cb); /* Install a dynamic callback */
panel2 = xs2ap(0.5, 0.0, 1.0, 0.5); /* Create panel in bottom right */
xs2cp(panel2); /* Choose this panel */
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
cs2scb(&cb); /* Install a dynamic callback */
xs2cp(panel0); /* Go back to main panel */
s2sch(2); /* Set the character height */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.