|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 1223 (0x4c7) Types: TextFile Names: »colors.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─⟦526ad3590⟧ »EUUGD11/gnu-31mar87/X.V10.R4.tar.Z« └─⟦2109abc41⟧ └─⟦this⟧ »./X.V10R4/xtrek/watch/colors.c«
#include <stdio.h> #include <X/Xlib.h> #include "../data.h" typedef struct assoc { char *str; int *colorp; int bWDef; char *colorDef; } ASSOC; ASSOC assoc[] = { { "border", &borderColor, BlackPixel, "blue" }, { "background", &backColor, WhitePixel, "black" }, { "text", &textColor, BlackPixel, "yellow" }, { "fed", &shipCol[0], BlackPixel, "yellow", }, { "rom", &shipCol[1], BlackPixel, "red", }, { "kli", &shipCol[2], BlackPixel, "green", }, { "ori", &shipCol[3], BlackPixel, "slate blue", }, { "warning", &warningColor, BlackPixel, "red" }, { "unknown", &unColor, BlackPixel, "light grey" }, { "me", &myColor, BlackPixel, "white" } }; getColorDefs(prog) char *prog; { int i, invert; char *color; Color def; if (DisplayCells() <= 2) { /* b & w */ invert = (XGetDefault(prog, "reverseVideo") == NULL); for (i = 0; i < sizeof (assoc) / sizeof (*assoc); i++) *assoc[i].colorp = invert ? !assoc[i].bWDef : assoc[i].bWDef; } else { for (i = 0; i < sizeof (assoc) / sizeof (*assoc); i++) { if ((color = XGetDefault(prog, assoc[i].str)) == NULL) color = assoc[i].colorDef; XParseColor(color, &def); XGetHardwareColor(&def); *assoc[i].colorp = def.pixel; } } }