/******************************************************** pops.c PopScreen main routine (start and end) Written by Stephen Vermeulen 403-282-7990 PO Box 3295, Station B, Calgary, Alberta, CANADA, T2M 4L8 This is public domain for what it is worth... This is a little routine I wrote when I got annoyed by VLT's lack of screen to front and back gadgets. It allows you to pop the selected screen to the front from the CLI. Typing POPS by itself will give you a list of screens and their current numbers, and then typing something like: POPS 2 will pop screen number 2 to the front. If you run something like DMouse, Qmouse... you probably will not need this. *********************************************************/ #include #include #include #include /** global variables go here... **/ struct IntuitionBase *IntuitionBase; struct GfxBase *GfxBase; open_libs() { IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0L); GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 0L); if (!IntuitionBase || !GfxBase) return(FALSE); /**** Successful opening of libraries ****/ return(TRUE); } close_libs() { if (IntuitionBase) { CloseLibrary(IntuitionBase); IntuitionBase = NULL; } if (GfxBase) { CloseLibrary(GfxBase); GfxBase = NULL; } } char names[4000]; struct Screen *slist[20]; short nlist[20]; main(argc, argv) int argc; char *argv[]; { struct Screen *s; int i, pos; if (open_libs()) { if (argc > 1) { i = atoi(argv[1]); Forbid(); s = IntuitionBase->FirstScreen; while (s && (i > 0)) { --i; s = s->NextScreen; } Permit(); if (s) ScreenToFront(s); } else { puts("PopScreen [screen number]"); puts("By Stephen Vermeulen, Box 3295, Stn. B, Calgary, Alta., CANADA, T2M 4L8"); puts("A little utility to pop the indicated screen to the front"); i = 0; pos = 0; Forbid(); s = IntuitionBase->FirstScreen; while (s && (i < 20)) { slist[i] = s; strcpy(&names[pos], s->DefaultTitle); nlist[i] = pos; pos += strlen(&names[pos]) + 1; if (pos > 3900) break; ++i; s = s->NextScreen; } Permit(); puts("Screen Name"); for (pos = 0; pos < i; ++pos) printf("%6d %s\n", pos, &names[nlist[pos]]); } close_libs(); } }