AnalogTerm2: Improve configuration and related configuration.
authorMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 17 Apr 2023 20:57:27 +0000 (20:57 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 17 Apr 2023 20:57:27 +0000 (20:57 +0000)
- When fast/jump scroll is enabled, make the number of maximum
  lines to scroll configurable.
- Increase the configuration range for -r (can now go as low
  as 10fps).
- Makefile now installs example alternative font files that can
  be loaded using cat(1).
- Better document the dependency of various settings on -r in
  the command usage/help.

mmsoftware/analogterm2/GNUmakefile
mmsoftware/analogterm2/README.txt
mmsoftware/analogterm2/src/config.c
mmsoftware/analogterm2/src/config.h
mmsoftware/analogterm2/src/draw.c
mmsoftware/analogterm2/src/main.c

index f32db72..f013045 100644 (file)
@@ -1,3 +1,5 @@
+PREFIX := /usr/local
+
 CC := cc
 CC_HOST := cc
 RM := rm
@@ -31,6 +33,7 @@ CFLAGS += -DNDEBUG
 CHARS := src/font/*9.xbm
 OBJS := $(addprefix src/,config.o main.o font.o utf8.o state.o xshm.o screen.o draw.o tty.o)
 BIN := analogterm2
+FONTS := $(addprefix tests/,a2-font-ansi.txt ocr-font-ansi.txt topaz-font-ansi.txt nosquare-font-ansi.txt square-font-ansi.txt wargames-font-ansi.txt)
 
 # OS dependent settings follow
 OS_TARGET := UNIX
@@ -79,7 +82,11 @@ $(BIN): $(OBJS)
        $(STRIP) $@
 
 install:
-       $(INSTALL) -c -o 0 -g 0 -m 755 $(BIN) /usr/local/bin
+       $(INSTALL) -c -o 0 -g 0 -m 755 $(BIN) $(PREFIX)/bin
+       $(INSTALL) -d -o 0 -g 0 -m 755 $(PREFIX)/share/analogterm2
+       for f in $(FONTS); do \
+               echo $(INSTALL) -c -o 0 -g 0 -m 644 $$f $(PREFIX)/share/analogterm2 ; \
+       done
 
 clean:
        $(RM) -f $(BIN) $(BIN).core $(OBJS)
index 6286928..3cb2dd1 100644 (file)
@@ -44,7 +44,8 @@ $ printf '\033[?658467;192;255;255h'
 Apply alternative scanline emulator intensity parameters.
 $ printf '\033[?658467;65539;0;100h\033[?658467;65539;1;18h\033[?658467;65539;2;230h\033[?658467;65539;3;13h\033[?658467;65539;4;0h'
 
-Alter "1" to have a serif foot.
+Alter "1" to have a serif foot.  Some custom fonts can be loaded
+using cat(1) on supplied example files.
 $ printf '\033[?658467;65540;49;7;28h'
 
 This terminal was mostly written using AnalogTerm and AnalogTerm2
index 9b08cf6..7dc0563 100644 (file)
@@ -41,6 +41,7 @@ bool  cfg_condensed;
 bool   cfg_stderr;
 bool   cfg_sleep;
 bool   cfg_slowscroll;
+int    cfg_jumpscrolllines;
 int    cfg_leading;
 
 
@@ -76,6 +77,7 @@ cfg_setdefaults(void)
        cfg_stderr = false;
        cfg_sleep = false;
        cfg_slowscroll = SLOW_SCROLL;
+       cfg_jumpscrolllines = JUMP_SCROLL_LINES;
 
        cfg_leading = EXTRA_LEADING;
 }
index 8607e2b..6251af5 100644 (file)
@@ -240,6 +240,7 @@ extern bool cfg_unicode;
 #define JUMP_SCROLL_LINES      8
 
 extern bool cfg_slowscroll;
+extern int  cfg_jumpscrolllines;
 
 
 /*
index 88ee2fe..385ee75 100644 (file)
@@ -612,7 +612,7 @@ draw_update_screen(screen_t *sc, state_t *st)
        int h, low, high;
 
        if (!st->scroll_slow && !refresh_expired &&
-           jump_scroll_lines <= JUMP_SCROLL_LINES)
+           jump_scroll_lines <= cfg_jumpscrolllines)
                return;
        refresh_expired = false;
        jump_scroll_lines = 0;
index cfd96c5..60b6b08 100644 (file)
@@ -174,8 +174,8 @@ usage(void)
        errno = EINVAL;
        fprintf(stderr,
            "\nUsage: %s [-8|-u] [-w <cols>] [-h <rows>] [-E <n>] [-s]\n"
-           "    [-C <color>] [-c] [-W] [-b] [-B <microseconds>] [-P]\n"
-           "    [-m <mode>] [-M] [-d] [-D] [-S] [-p <parameters>]\n"
+           "    [-C <color>] [-c] [-W] [-b] [-r <ms>] [-B <ticks>] [-j <n>]\n"
+           "    [-P] [-m <mode>] [-M] [-d] [-D] [-S] [-p <parameters>]\n"
            "    [-l <pixels>] [-f <delay>] [-e <command> [<arguments>]]\n\n"
            "Where:\n"
            " -8 / -u - 8-bit mode (Latin-1), unicode+UTF-8.  8-bit mode is\n"
@@ -193,25 +193,34 @@ usage(void)
            "      [?658467;65536h (color), [?658467;65537h (mono).\n"
            " -W - Toggle X zoom between wide (2x) and condensed (1.5x)\n"
            " -r - Set the maximum screen refresh speed when in jump scroll\n"
-           "      in microseconds.\n"
+           "      in microseconds (limits: 11111 (90fps) - 100000 (10fps)).\n"
+           "      Also affects the text/cursor blinking rate setting -B.\n"
+           "      Low settings save CPU but affect interactive performance.\n"
+           "      Jump scroll is the default but can be changed with the\n"
+           "      DEC Private Mode sequence 4: [?4h and [?4l.\n"
            " -b - Toggle blinking cursor.\n"
            " -B - Set the cursor and text blinking speed, in refresh ticks.\n"
            "      This can also be changed with ESC [?658467;65538;<n>h\n"
+           "      This depends on the refresh rate setting, -r.\n"
+           " -j - Maximum number of lines to jump in fast scrolling mode.\n"
+           "      Also depends on the -r setting.\n"
            " -P - If the cursor is blinking, reset its timer for printing.\n"
+           "      By default, it is only reset \"on\" by user input.\n"
            " -m - Set default cursor style (0 = block, 1 = line, 2 = bar).\n"
            " -M - Enable very visible cursor mode by default.\n"
            "      Can also be controlled with the escape sequences \n"
            "      [?658467;65541h and [?658467;65542h.\n"
            " -d - Log emulator debug messages to stderr.\n"
-           " -D - Toggle if the cursor can be disabled or not.\n"
+           " -D - Toggle if the cursor can be disabled/invisible or not.\n"
            " -S - Wait in a sleeping loop until the user closes the window\n"
            "      before exiting.  This is useful to view the output of\n"
-           "      custom commands.\n"
+           "      custom commands along with -e.\n"
            " -p - Analog scanline parameters.  These are described below.\n"
            " -l - Add extra leading pixels between lines.  This will also\n"
            "      affect the vertical connectivity of graphics characters.\n"
            " -f - Number of frames to keep reverse video on for the flash\n"
-           "      of the visual bell.  May not be visible with 0.\n"
+           "      of the visual bell.  May not be visible with very low\n"
+           "      values.  Also depends on -r.\n"
            " -e - Execute command and its arguments instead of $SHELL.\n"
            "      Must be the last AnalogTerm2 argument if used, because\n"
            "      other arguments will be passed to the command.\n"
@@ -255,8 +264,8 @@ main(int argc, char **argv, char **envp)
        cfg_unicode = !locale_8bit();
 
        progname = strdup(argv[0]);
-       while ((ch = getopt(argc, argv, "?8uw:h:E:scC:Wr:bB:Pm:MdDSp:l:f:e:"))
-           != -1) {
+       while ((ch = getopt(argc, argv,
+           "?8uw:h:E:scC:Wr:bB:j:Pm:MdDSp:l:f:e:")) != -1) {
                switch (ch) {
                case '8':
                        cfg_unicode = false;
@@ -305,7 +314,7 @@ main(int argc, char **argv, char **envp)
                        cfg_condensed = !cfg_condensed;
                        break;
                case 'r':
-                       if ((i = atoi(optarg)) >= 11111 && i <= 33333)
+                       if ((i = atoi(optarg)) >= 11111 && i <= 100000)
                                cfg_refreshspeed = i;
                        break;
                case 'b':
@@ -315,6 +324,10 @@ main(int argc, char **argv, char **envp)
                        if ((i = atoi(optarg)) > 0 && i < 501)
                                cfg_blinkspeed = i;
                        break;
+               case 'j':
+                       if ((i = atoi(optarg)) > 1 && i <= 16)
+                               cfg_jumpscrolllines = i;
+                       break;
                case 'P':
                        cfg_cursorprintreset = !cfg_cursorprintreset;
                        break;