home *** CD-ROM | disk | FTP | other *** search
- /*
- * lemhelp.c - give menu of key functions
- *
- * copyright (c) by Alan W. Paeth, 1987. All rights reserved.
- */
-
- #include "lem.h"
- #include "lemfont.h"
-
- #define HELPCHARS "[IHMABCDEFGLNOPRSTUVWX^?"
-
- help()
- {
- char c;
- msgpost("[help]: <space> - all; \"/\" - fonts; <key> - function: ");
- c = getstroke();
- if (c == ' ') helpall();
- else if (c == '/') helpfonts();
- else if (c != '\0') helpkey(c);
- }
-
- char *helpmsg(c)
- char c;
- {
- char *s;
- if (c < ' ') c += ' '; /* turn ^chars to upper case */
- switch(UC(c))
- {
- case '[': s = "ESC Delete Mark; Deselect all"; break;
- case 'A': s = "^A All select"; break;
- case 'B': s = "^B Box-ify selections"; break;
- case 'C': s = "^C Copy selections (in place)"; break;
- case 'D': s = "^D Delete selections"; break;
- case 'E': s = "^E Ellipse-ify selections"; break;
- case 'F': s = "^F Force<+key>: 0=reset/1-9=size/Bld/Nrm/Itl/Lft/Rht/Cen";break;
- case 'G': s = "^G Group selections"; break;
- case 'H': s = "BS Backspace input text"; break;
- case 'I': s = "TAB Select marked obj (cyclically)"; break;
- case 'L': s = "^L Refresh display"; break;
- case 'J':
- case 'M': s = "CR Add text (if present)"; break;
- case 'N': s = "^N No select (deselect all)"; break;
- case 'O': s = "^O Output PIC \"filename\""; break;
- case 'P': s = "^P Pop (ungroup -- instantiate) selected groups"; break;
- case 'Q': s = "^Q Quit"; break;
- case 'R': s = "^R Read \"filename\""; break;
- case 'S': s = "^Sc Special function escape"; break;
- case 'T': s = "^Td Tickmarks (on/off)"; break;
- case 'U': s = "^U Undo selections (undelete, untransform)"; break;
- case 'V': s = "^V Vector-ify selections"; break;
- case 'W': s = "^W Write \"filename\""; break;
- case 'X': s = "^X Cut lines (selections scissor normal lines)"; break;
- case '^': s = "^^ Help"; break;
- case '?': s = "^^? Help all"; break;
- default: s = " (undefined)"; break;
- }
- return(s);
- }
-
- helpkey(c)
- char c;
- {
- msgpost(helpmsg(c));
- }
-
- helpall()
- {
- int i, x, y;
- char c;
- erase();
- x = 10;
- y = screenh-fontleading(SYSFONT);
- for (i=0; i<strlen(HELPCHARS); i++)
- {
- int baseline;
- c = HELPCHARS[i];
- fontwrite(SYSFONT, x, y, helpmsg(c), EMPHNONE, HELPCOL);
- baseline = fontleading(SYSFONT);
- y -= baseline;
- if (y < baseline) break;
- }
- }
-
- helpfonts()
- {
- int i, x, y;
- char fontmsg[50];
- erase();
- x = 10;
- y = screenh-fontleading(SYSFONT);
- fontwrite(SYSFONT, x, y, "Current Fonts", EMPHNONE, HELPCOL);
- y -= 2 * fontleading(SYSFONT);
- for (i=1; i<rclen; i++)
- {
- int baseline;
- sprintf(fontmsg, "%d %s%d", i, lemfont[i].dsp, lemfont[i].psize);
- fontwrite(SYSFONT, x, y, fontmsg, EMPHNONE, HELPCOL);
- fontwrite(i, x+180, y, "regular", EMPHNONE, HELPCOL);
- fontwrite(i, x+280, y, "bold", EMPHBOLD, HELPCOL);
- fontwrite(i, x+380, y, "italic", EMPHITAL, HELPCOL);
- if (gsize == i)
- {
- char *S;
- S = (galign==ALIGNLEFT)?"[L]" : ((gemph==ALIGNRGHT)?"[R]":"[C]");
- if (gemph == EMPHNONE) fontwrite(i, x+160, y, S,EMPHNONE,HELPCOL);
- if (gemph == EMPHBOLD) fontwrite(i, x+260, y, S,EMPHBOLD,HELPCOL);
- if (gemph == EMPHITAL) fontwrite(i, x+360, y, S,EMPHITAL,HELPCOL);
- }
- baseline = fontleading(SYSFONT);
- y -= 2 * baseline;
- if (y < baseline) break;
- }
- }
-