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; }
int main(int argc, char *argv[]) { s2opend("/s2mono", argc, argv); /* Open in mono mode */ s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */ s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */ xs2mp(master_panel, 0.0, 0.5, 0.5, 1.0); /* Move to top left */ slave_panel = xs2ap(0.5, 0.0, 1.0, 0.5); /* Create panel in bottom right */ xs2cp(slave_panel); /* Choose this panel */ s2swin(-2.,2., -2.,2., -2.,2.); /* Set the window coordinates */ s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0); /* Draw coordinate box */ xs2cp(master_panel); /* Go back to main panel */ cs2scb(cb); /* Install dynamic callback */ fprintf(stderr,"Press <tab> to switch between panels\n"); fprintf(stderr,"Press <spacebar> to link cameras together - cannot be undone\n"); fprintf(stderr,"Futher presses of <spacebar> toggle panel visiblity\n"); s2show(1); /* Open the s2plot window */ return 1; }