2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 #ifdef VERBOSE_REV_INFO
25 static char rcs_id[] = "$XConsortium: TermEnhance.c /main/1 1996/04/21 19:15:41 drk $";
26 #endif /* VERBOSE_REV_INFO */
30 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
31 * (c) Copyright 1993, 1994 International Business Machines Corp. *
32 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
33 * (c) Copyright 1993, 1994 Novell, Inc. *
36 #include "TermHeader.h"
39 #include "TermColor.h"
40 #include "TermBuffer.h"
42 #define ourColorPair (values[(int) enhFgColor])
43 #define ourBgColor (values[(int) enhBgColor])
44 #define ourFont (values[(int) enhFont])
45 #define ourVideo (values[(int) enhVideo])
48 _DtTermEnhProc(Widget w, enhValues values, TermEnhInfo info)
51 DtTermWidget tw = (DtTermWidget) w;
52 DtTermData td = tw->vt.td;
54 /* initialize the color pair if we need to... */
55 if (!td->colorPairs[ourColorPair].initialized) {
56 (void) _DtTermColorInitializeColorPair(w,
57 &td->colorPairs[ourColorPair]);
59 if (!td->colorPairs[ourBgColor].initialized) {
60 (void) _DtTermColorInitializeColorPair(w,
61 &td->colorPairs[ourBgColor]);
64 /* take care of video enhancements...
66 /* half bright (picks fg color) ... */
67 if (IS_HALF_BRIGHT(ourVideo) && td->colorPairs[ourColorPair].hbValid) {
68 info->fg = td->colorPairs[ourColorPair].hb.pixel;
70 info->fg = td->colorPairs[ourColorPair].fg.pixel;
73 /* background is always background... */
74 info->bg = td->colorPairs[ourBgColor].bg.pixel;
76 /* if inverse video, swap fg and bg... */
77 if (IS_INVERSE(ourVideo)) {
85 info->flags = (unsigned long) 0;
86 if (IS_SECURE(ourVideo)) {
87 info->flags |= TermENH_SECURE;
89 if (IS_UNDERLINE(ourVideo)) {
90 info->flags |= TermENH_UNDERLINE;
93 info->font = td->renderFonts[RENDER_FONT_NORMAL].termFont;
94 if (IS_BOLD(ourVideo)) {
95 if (ourFont == FONT_NORMAL) {
96 if (td->renderFonts[RENDER_FONT_BOLD].termFont) {
97 /* valid bold font -- use it... */
98 info->font = td->renderFonts[RENDER_FONT_BOLD].termFont;
100 /* embolden via overstrike... */
101 info->flags |= TermENH_OVERSTRIKE;
104 /* DKS: can't do bold with the linedraw font... */
105 info->font = td->renderFonts[RENDER_FONT_LINEDRAW].termFont;
108 /* not bold -- default is FONT_NORMAL... */
109 if (ourFont == FONT_LINEDRAW) {
110 info->font = td->renderFonts[RENDER_FONT_LINEDRAW].termFont;