[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6893] MS-Windows/MS-DOS followup for new display attributes.
From: |
Eli Zaretskii |
Subject: |
[6893] MS-Windows/MS-DOS followup for new display attributes. |
Date: |
Fri, 25 Dec 2015 14:47:02 +0000 |
Revision: 6893
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6893
Author: eliz
Date: 2015-12-25 14:47:01 +0000 (Fri, 25 Dec 2015)
Log Message:
-----------
MS-Windows/MS-DOS followup for new display attributes.
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/pcterm.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-12-25 14:40:58 UTC (rev 6892)
+++ trunk/ChangeLog 2015-12-25 14:47:01 UTC (rev 6893)
@@ -1,5 +1,15 @@
2015-12-25 Eli Zaretskii <address@hidden>
+ * info/pcterm.c (blinkvideo, textcolor, textbackground) [_WIN32]:
+ New functions.
+ (pc_begin_blink, pc_default_color, convert_color)
+ (pc_set_fg_color, pc_set_bg_color): New functions, to support
+ capabilities added to terminal.c.
+ (pc_initialize_terminal): Make the xref_attr use the lightcyan
+ color, to be more prominent.
+ (pc_initialize_terminal): Add hooks for the new attributes: bold,
+ blink, and foreground/background colors.
+
* info/info-utils.c (copy_converting): When 'iconv' finishes
conversion, call it with 2nd and 3rd arguments NULL to make sure
it flushes the last converted character to the output buffer.
Modified: trunk/info/pcterm.c
===================================================================
--- trunk/info/pcterm.c 2015-12-25 14:40:58 UTC (rev 6892)
+++ trunk/info/pcterm.c 2015-12-25 14:47:01 UTC (rev 6893)
@@ -79,6 +79,7 @@
#include "variables.h"
#include "session.h"
+#include "terminal.h"
extern int speech_friendly; /* defined in info.c */
@@ -256,6 +257,34 @@
}
void
+blinkvideo (void)
+{
+ highvideo ();
+}
+
+void
+textcolor (int color)
+{
+ int attr;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+ attr = (csbi.wAttributes & 0xf0) | (color & 0x0f);
+ textattr (attr);
+}
+
+void
+textbackground (int color)
+{
+ int attr;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+ attr = (csbi.wAttributes & 0x0f) | ((color & 0x0f) << 4);
+ textattr (attr);
+}
+
+void
ScreenGetCursor (int *row, int *col)
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
@@ -837,6 +866,50 @@
normvideo ();
}
+static void
+pc_begin_blink (void)
+{
+ blinkvideo ();
+}
+
+static void
+pc_default_color (void)
+{
+ textattr (norm_attr);
+}
+
+/* Info definitions of 8 colors (see terminal.h) are in an order
+ that's different from Windows/DOS console colors. This function
+ unscrambles the order, and also maps 8 standard ANSI colors to the
+ low-intensity shades of the 16 PC colors, so that "standout" works
+ by turning the intensity bit. */
+static int
+convert_color (int terminal_color)
+{
+ /* The terminal.h order is:
+ black, red, green, yellow, blue, magenta, cyan, white. */
+ static int pc_color_map[] = {
+ 0, 4, 2, 6, 1, 5, 3, 7
+ };
+
+ if (terminal_color >= 0
+ && terminal_color < sizeof(pc_color_map) / sizeof (pc_color_map[0]))
+ return pc_color_map[terminal_color];
+ return 7; /* lightgray */
+}
+
+static void
+pc_set_fg_color (int color)
+{
+ textcolor (convert_color (color));
+}
+
+static void
+pc_set_bg_color (int color)
+{
+ textbackground (convert_color (color));
+}
+
/* Move the cursor up one line. */
static void
pc_up_line (void)
@@ -1077,7 +1150,7 @@
xref_attr = CYAN;
#endif
#ifdef _WIN32
- xref_attr = FOREGROUND_BLUE | FOREGROUND_GREEN;
+ xref_attr = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
#endif
/* Does the user want non-default colors? */
@@ -1151,6 +1224,12 @@
terminal_end_standout_hook = pc_end_standout;
terminal_begin_underline_hook = pc_begin_underline;
terminal_end_underline_hook = pc_end_underline;
+ terminal_begin_bold_hook = pc_begin_standout;
+ terminal_begin_blink_hook = pc_begin_blink;
+ terminal_end_all_modes_hook = pc_end_standout;
+ terminal_default_colour_hook = pc_default_color;
+ terminal_set_colour_hook = pc_set_fg_color;
+ terminal_set_bgcolour_hook = pc_set_bg_color;
terminal_prep_terminal_hook = pc_prep_terminal;
terminal_unprep_terminal_hook = pc_unprep_terminal;
terminal_up_line_hook = pc_up_line;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6893] MS-Windows/MS-DOS followup for new display attributes.,
Eli Zaretskii <=