/*
** Copyright (C) 1991, 1997 Free Software Foundation, Inc.
-**
+**
** This file is part of TACK.
-**
+**
** TACK is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2, or (at your option)
** any later version.
-**
+**
** TACK is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
-**
+**
** You should have received a copy of the GNU General Public License
** along with TACK; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#include <tack.h>
-MODULE_ID("$Id: color.c,v 1.1 1999/04/18 01:24:45 tom Exp $")
+MODULE_ID("$Id: color.c,v 1.5 2004/01/16 23:14:25 Jochen.Voss Exp $")
/*
* Color terminal tests. Has only one entry point: test_color().
static int cookie_monster, color_step, colors_per_line;
static int R, G, B;
+static void reset_colors(void)
+{
+ tc_putp(orig_colors);
+ tc_putp(tparm(orig_pair));
+}
+
static int
color_trans(int c)
{ /* translate or load the color */
static int
rainbow(int n)
-{ /* print the programable color display */
+{ /* print the programmable color display */
int i, c, d, palette_full, initial_pair;
static const struct {
const char *name;
put_str(alt_modes[m].name);
eat_cookie();
set_attr(0);
+ reset_colors();
put_crlf();
}
}
/* initialize the color palette */
pairs_used = max_colors >= 8 ? 8 : max_colors;
- if (can_change) {
- tc_putp(orig_colors);
- }
- tc_putp(tparm(orig_pair));
+ reset_colors();
new_color(COLOR_WHITE, COLOR_BLACK, FALSE);
ptextln("(setf) (setb) (scp) The following colors are predefined:");
put_crlf();
j = max_colors > 8 ? 8 : max_colors;
/*
- the black on white test is the same as the white on black test.
- */
+ * the black on white test is the same as the white on black test.
+ */
for (i = 1; i < j; i++) {
putchp('0' + def_colors[i].index);
putchp(' ');
new_color(COLOR_WHITE, COLOR_BLACK, FALSE);
put_crlf();
}
+ reset_colors();
put_crlf();
generic_done_message(t, state, ch);
}
}
for (j = 0; j < matrix_area; j++) {
if (j % matrix_size == 0) {
- tc_putp(tparm(orig_pair));
+ reset_colors();
put_crlf();
if (brightness) {
- tc_putp(exit_standout_mode);
+ tc_putp(exit_attribute_mode);
}
(void) sprintf(temp, "%-8s", def_colors[j / matrix_size].name);
put_str(temp);
FALSE);
put_str(" Hello ");
}
- tc_putp(tparm(orig_pair));
+ reset_colors();
if (brightness) {
- tc_putp(exit_standout_mode);
+ tc_putp(exit_attribute_mode);
}
put_crlf();
}
}
}
}
- tc_putp(orig_pair);
+ reset_colors();
put_crlf();
generic_done_message(t, state, ch);
}
int *state,
int *ch)
{
- new_color(COLOR_BLACK, COLOR_WHITE, FALSE);
+ new_color(COLOR_CYAN, COLOR_BLUE, FALSE);
put_clear();
put_newlines(2);
- new_color(COLOR_WHITE, COLOR_BLACK, FALSE);
- ptextln("If the two lines above are black then back_color_erase (bce) should be false.");
+ reset_colors();
+ ptextln("If the two lines above are blue then back_color_erase (bce) should be true.");
sprintf(temp, "(bce) is %s in the data base.", back_color_erase ? "true" : "false");
ptextln(temp);
generic_done_message(t, state, ch);
generic_done_message(t, state, ch);
return;
}
- tc_putp(orig_colors);
+ reset_colors();
pairs_used = 0;
new_color(COLOR_WHITE, COLOR_BLACK, FALSE);
sprintf(temp, "Reloading colors (init%c) using %s method",
}
generic_done_message(t, state, ch);
if (*ch != 0 && *ch != 'n') {
- tc_putp(orig_colors);
- tc_putp(tparm(orig_pair));
+ reset_colors();
return;
}
}
generic_done_message(t, state, ch);
if (*ch != 0 && *ch != 'n') {
- tc_putp(orig_colors);
- tc_putp(tparm(orig_pair));
+ reset_colors();
return;
}
dump_colors();
- tc_putp(orig_colors);
- tc_putp(tparm(orig_pair));
+ reset_colors();
generic_done_message(t, state, ch);
}