texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6804] info background colour styles


From: Gavin D. Smith
Subject: [6804] info background colour styles
Date: Sun, 22 Nov 2015 22:55:05 +0000

Revision: 6804
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6804
Author:   gavin
Date:     2015-11-22 22:55:04 +0000 (Sun, 22 Nov 2015)
Log Message:
-----------
info background colour styles

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/terminal.c
    trunk/info/terminal.h
    trunk/info/variables.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-11-22 21:17:26 UTC (rev 6803)
+++ trunk/ChangeLog     2015-11-22 22:55:04 UTC (rev 6804)
@@ -1,5 +1,17 @@
 2015-11-22  Gavin Smith  <address@hidden>
 
+       * info/terminal.h
+       (BGCOLOUR_MASK, BGCOLOUR_BLACK, BGCOLOUR_RED, BGCOLOUR_GREEN)
+       (BGCOLOUR_YELLOW, BGCOLOUR_BLUE, BGCOLOUR_MAGENTA, BGCOLOUR_CYAN)
+       (BGCOLOUR_WHITE): New symbols.
+       * info/variables.c (set_variable_to_value): Add styles for 
+       background colours.
+       * info/terminal.c (terminal_switch_rendition): Handle background 
+       colour changing.
+       (terminal_set_bgcolour): New function.
+
+2015-11-22  Gavin Smith  <address@hidden>
+
        * install-info/tests/ii-0058-test: New test, for an empty dir 
        file.
 
@@ -1365,7 +1377,7 @@
 
 2015-08-29  Gavin Smith  <address@hidden>
 
-       * info/variable.c (set_variable_to_value): Handle rendition
+       * info/variables.c (set_variable_to_value): Handle rendition
        variables in user init file.
        (info_variables): Add user variables "ref-rendition",
        "hl-ref-rendition", "match-rendition".

Modified: trunk/info/terminal.c
===================================================================
--- trunk/info/terminal.c       2015-11-22 21:17:26 UTC (rev 6803)
+++ trunk/info/terminal.c       2015-11-22 22:55:04 UTC (rev 6804)
@@ -67,6 +67,7 @@
 VFunction *terminal_end_all_modes_hook = NULL;
 VFunction *terminal_default_colour_hook = NULL;
 VFunction *terminal_set_colour_hook = NULL;
+VFunction *terminal_set_bgcolour_hook = NULL;
 VFunction *terminal_prep_terminal_hook = NULL;
 VFunction *terminal_unprep_terminal_hook = NULL;
 VFunction *terminal_up_line_hook = NULL;
@@ -623,6 +624,15 @@
     tputs (tgoto (term_AF, 0, colour), 0, output_character_function);
 }
 
+static void
+terminal_set_bgcolour (int colour)
+{
+  if (terminal_set_bgcolour_hook)
+    (*terminal_set_bgcolour_hook) (colour);
+  else
+    tputs (tgoto (term_AB, 0, colour), 0, output_character_function);
+}
+
 /* Information about what styles like colour, underlining, boldface are
    currently output for text on the screen.  All zero represents the default
    rendition. */
@@ -635,7 +645,6 @@
 terminal_switch_rendition (unsigned long new)
 {
   unsigned long old = terminal_rendition;
-  int all_modes_turned_off = 0;
 
   if ((old & new & COMBINED_MODES) != (old & COMBINED_MODES))
     {
@@ -652,8 +661,7 @@
       if ((new & COLOUR_MASK) == 00)
         {
           terminal_default_colour ();
-          /* Once we do the background colour as well, we should
-             record that the background colour has been reset. */
+          old &= ~BGCOLOUR_MASK;
         }
       else if ((new & COLOUR_MASK) >= 8)
         {
@@ -661,6 +669,19 @@
         }
       /* Colour values from 1 to 7 don't do anything right now. */
     }
+  if ((new & BGCOLOUR_MASK) != (old & BGCOLOUR_MASK))
+    {
+      /* Switch colour. */
+      if ((new & BGCOLOUR_MASK) == 00)
+        {
+          terminal_default_colour ();
+        }
+      else if ((new & BGCOLOUR_MASK) >> 9 >= 8)
+        {
+          terminal_set_bgcolour (((new & BGCOLOUR_MASK) >> 9) - 8);
+        }
+      /* Colour values from 1 to 7 don't do anything right now. */
+    }
   if ((new & UNDERLINE_MASK) != (old & UNDERLINE_MASK))
     {
       if ((new & UNDERLINE_MASK))

Modified: trunk/info/terminal.h
===================================================================
--- trunk/info/terminal.h       2015-11-22 21:17:26 UTC (rev 6803)
+++ trunk/info/terminal.h       2015-11-22 22:55:04 UTC (rev 6804)
@@ -152,19 +152,28 @@
 extern int mouse_protocol;
 
 #define COLOUR_MASK             000000000017
-#define COLOUR_BLACK    8 + 0
-#define COLOUR_RED      8 + 1
-#define COLOUR_GREEN    8 + 2
-#define COLOUR_YELLOW   8 + 3
-#define COLOUR_BLUE     8 + 4
-#define COLOUR_MAGENTA  8 + 5
-#define COLOUR_CYAN     8 + 6
-#define COLOUR_WHITE    8 + 7
+#define COLOUR_BLACK    (8 + 0)
+#define COLOUR_RED      (8 + 1)
+#define COLOUR_GREEN    (8 + 2)
+#define COLOUR_YELLOW   (8 + 3)
+#define COLOUR_BLUE     (8 + 4)
+#define COLOUR_MAGENTA  (8 + 5)
+#define COLOUR_CYAN     (8 + 6)
+#define COLOUR_WHITE    (8 + 7)
 #define UNDERLINE_MASK          000000000020
 #define STANDOUT_MASK           000000000040
 #define BOLD_MASK               000000000100
 #define ZERO1_MASK              000000000200
 #define BLINK_MASK              000000000400
+#define BGCOLOUR_MASK           000000017000
+#define BGCOLOUR_BLACK    ((8 + 0) << 9)
+#define BGCOLOUR_RED      ((8 + 1) << 9)
+#define BGCOLOUR_GREEN    ((8 + 2) << 9)
+#define BGCOLOUR_YELLOW   ((8 + 3) << 9)
+#define BGCOLOUR_BLUE     ((8 + 4) << 9)
+#define BGCOLOUR_MAGENTA  ((8 + 5) << 9)
+#define BGCOLOUR_CYAN     ((8 + 6) << 9)
+#define BGCOLOUR_WHITE    ((8 + 7) << 9)
 #define ZERO2_MASK              000000100000
 #define ZERO3_MASK              000040000000
 #define ZERO4_MASK              020000000000

Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c      2015-11-22 21:17:26 UTC (rev 6803)
+++ trunk/info/variables.c      2015-11-22 22:55:04 UTC (rev 6804)
@@ -391,6 +391,16 @@
               COLOUR_MASK, COLOUR_WHITE,   "white",
               COLOUR_MASK, 0,           "nocolour",
               COLOUR_MASK, 0,           "nocolor",
+              BGCOLOUR_MASK, BGCOLOUR_BLACK,   "bgblack",
+              BGCOLOUR_MASK, BGCOLOUR_RED,     "bgred",
+              BGCOLOUR_MASK, BGCOLOUR_GREEN,   "bggreen",
+              BGCOLOUR_MASK, BGCOLOUR_YELLOW,  "bgyellow",
+              BGCOLOUR_MASK, BGCOLOUR_BLUE,    "bgblue",
+              BGCOLOUR_MASK, BGCOLOUR_MAGENTA, "bgmagenta",
+              BGCOLOUR_MASK, BGCOLOUR_CYAN,    "bgcyan",
+              BGCOLOUR_MASK, BGCOLOUR_WHITE,   "bgwhite",
+              BGCOLOUR_MASK, 0,           "nobgcolour",
+              BGCOLOUR_MASK, 0,           "nobgcolor",
               UNDERLINE_MASK, UNDERLINE_MASK, "underline",
               UNDERLINE_MASK, 0,              "nounderline",
               STANDOUT_MASK, STANDOUT_MASK, "standout",




reply via email to

[Prev in Thread] Current Thread [Next in Thread]