texinfo-commits
[Top][All Lists]
Advanced

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

[6409] Implement standout and underlined text for Windows/DOS ports.


From: Eli Zaretskii
Subject: [6409] Implement standout and underlined text for Windows/DOS ports.
Date: Sat, 11 Jul 2015 07:15:11 +0000

Revision: 6409
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6409
Author:   eliz
Date:     2015-07-11 07:15:10 +0000 (Sat, 11 Jul 2015)
Log Message:
-----------
Implement standout and underlined text for Windows/DOS ports.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/pcterm.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-07-11 00:49:58 UTC (rev 6408)
+++ trunk/ChangeLog     2015-07-11 07:15:10 UTC (rev 6409)
@@ -1,3 +1,13 @@
+2015-07-11  Eli Zaretskii  <address@hidden>
+
+       * info/pcterm.c (highvideo, normvideo) [_WIN32]: New functions.
+       (pc_begin_underline, pc_end_underline, pc_begin_standout)
+       (pc_end_standout): New functions.
+       (pc_initialize_terminal): Set up hooks for standout and underlined
+       text.
+       (top level) <xref_attr>: Declare.
+       (pc_initialize_terminal): Initialize xref_attr.
+
 2015-07-11  Gavin Smith  <address@hidden>
 
        * info/display.c (display_update_window_1): Better handling of 

Modified: trunk/info/pcterm.c
===================================================================
--- trunk/info/pcterm.c 2015-07-11 00:49:58 UTC (rev 6408)
+++ trunk/info/pcterm.c 2015-07-11 07:15:10 UTC (rev 6409)
@@ -90,7 +90,7 @@
 
 static struct text_info outside_info;  /* holds screen params outside Info */
 #ifdef _WIN32
-static SHORT norm_attr, inv_attr;
+static SHORT norm_attr, inv_attr, xref_attr;
 static SHORT current_attr;
 static HANDLE hstdin = INVALID_HANDLE_VALUE;
 static HANDLE hstdout = INVALID_HANDLE_VALUE;
@@ -100,7 +100,7 @@
 static DWORD old_outpmode;
 static UINT output_cp;
 #else
-static unsigned char    norm_attr, inv_attr;
+static unsigned char    norm_attr, inv_attr, xref_attr;
 #endif
 
 static unsigned const char * find_sequence (int);
@@ -234,6 +234,28 @@
 }
 
 void
+highvideo (void)
+{
+  int attr;
+  CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+  GetConsoleScreenBufferInfo (hscreen, &csbi);
+  attr = csbi.wAttributes | FOREGROUND_INTENSITY;
+  textattr (attr);
+}
+
+void
+normvideo (void)
+{
+  int attr;
+  CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+  GetConsoleScreenBufferInfo (hscreen, &csbi);
+  attr = csbi.wAttributes & ~FOREGROUND_INTENSITY;
+  textattr (attr);
+}
+
+void
 ScreenGetCursor (int *row, int *col)
 {
   CONSOLE_SCREEN_BUFFER_INFO csbi;
@@ -787,6 +809,34 @@
   textattr (norm_attr);
 }
 
+/* The implementation of the underlined text.  The DOS/Windows console
+   doesn't support underlined text, so we make it blue instead (blue,
+   because this face is used for hyperlinks).  */
+static void
+pc_begin_underline (void)
+{
+  textattr (xref_attr);
+}
+
+static void
+pc_end_underline (void)
+{
+  textattr (norm_attr);
+}
+
+/* Standout (a.k.a. "high video") text.  */
+static void
+pc_begin_standout (void)
+{
+  highvideo ();
+}
+
+static void
+pc_end_standout (void)
+{
+  normvideo ();
+}
+
 /* Move the cursor up one line. */
 static void
 pc_up_line (void)
@@ -1023,6 +1073,12 @@
   norm_attr    = outside_info.normattr;
   inv_attr     = (((outside_info.normattr &    7) << 4) |
                   ((outside_info.normattr & 0x7f) >> 4));
+#ifdef __MSDOS__
+  xref_attr = CYAN;
+#endif
+#ifdef _WIN32
+  xref_attr = FOREGROUND_BLUE | FOREGROUND_GREEN;
+#endif
 
   /* Does the user want non-default colors?  */
   info_colors = getenv ("INFO_COLORS");
@@ -1091,6 +1147,10 @@
   /* Set all the hooks to our PC-specific functions.  */
   terminal_begin_inverse_hook       = pc_begin_inverse;
   terminal_end_inverse_hook         = pc_end_inverse;
+  terminal_begin_standout_hook      = pc_begin_standout;
+  terminal_end_standout_hook        = pc_end_standout;
+  terminal_begin_underline_hook     = pc_begin_underline;
+  terminal_end_underline_hook       = pc_end_underline;
   terminal_prep_terminal_hook       = pc_prep_terminal;
   terminal_unprep_terminal_hook     = pc_unprep_terminal;
   terminal_up_line_hook             = pc_up_line;




reply via email to

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