Commit eb5ffafe authored by Innocent De Marchi's avatar Innocent De Marchi

Update upstream source from tag 'upstream/8.1.6+dfsg1'

Update to upstream version '8.1.6+dfsg1'
with Debian dir 2bc7e78a42a3ba84e6a30d28e6ec371b4e1dbe29
parents 2ae61ae8 3a498a11
/*
* @(#)Abacus.c
*
* Copyright 1994 - 2017 David A. Bagley, bagleyd AT verizon.net
* Copyright 1994 - 2018 David A. Bagley, bagleyd AT verizon.net
*
* All rights reserved.
*
......@@ -2812,8 +2812,8 @@ drawCounterLine(AbacusWidget w, int deck, int rail, Boolean focus,
Boolean highlight) {
int dx, dy;
int size = w->abacus.frameSize.y - w->abacus.delta.y - 1;
GC gc = (highlight) ? w->abacus.railGC[2] :
((focus) ? w->abacus.railGC[3] : w->abacus.borderGC);
GC gc = (highlight) ? w->abacus.railShadeGC[7] :
((focus) ? w->abacus.railShadeGC[10] : w->abacus.borderGC);
Pixmap dr = 0;
if (deck == 1)
......@@ -2868,7 +2868,7 @@ drawRail(AbacusWidget w, const int deck, const int rail, const int j,
0, offsetX, size);
if (w->abacus.slot && (j == 1 || (d != -1 && subj == 1))) {
vfillRectClip(w, dr,
(highlight) ? w->abacus.railGC[2] : w->abacus.borderGC,
(highlight) ? w->abacus.railShadeGC[7] : w->abacus.borderGC,
dx + w->abacus.beadSize.x / 2 -
w->abacus.railWidth / 2, dy,
w->abacus.railWidth,
......@@ -2886,7 +2886,7 @@ drawRail(AbacusWidget w, const int deck, const int rail, const int j,
} else if (w->abacus.slot && (j == room ||
(d != -1 && subj == w->abacus.subdecks[d].room))) {
vfillRectClip(w, dr,
(highlight) ? w->abacus.railGC[2] : w->abacus.borderGC,
(highlight) ? w->abacus.railShadeGC[7] : w->abacus.borderGC,
dx + w->abacus.beadSize.x / 2 -
w->abacus.railWidth / 2, dy,
w->abacus.railWidth,
......@@ -2902,14 +2902,35 @@ drawRail(AbacusWidget w, const int deck, const int rail, const int j,
(w->abacus.railWidth - 1) / 2, dy,
2, 1, 2 + 5 * w->abacus.beadSize.y / 8, offsetX, size);
} else {
vfillRectClip(w, dr, ((highlight) ? w->abacus.railGC[2] :
int color = (highlight) ? 6 : (w->abacus.railIndex * 3);
Point coord0, coord1;
coord0.x = dx + w->abacus.beadSize.x / 2 - w->abacus.railWidth / 2;
coord0.y = dy;
coord1.x = w->abacus.railWidth;
coord1.y = w->abacus.beadSize.y + 1 + 2 * w->abacus.pressOffset.y;
vfillRectClip(w, dr, ((highlight) ? w->abacus.railShadeGC[color + 1] :
((w->abacus.slot) ? w->abacus.borderGC :
w->abacus.railGC[w->abacus.railIndex])),
dx + w->abacus.beadSize.x / 2 -
w->abacus.railWidth / 2, dy,
w->abacus.railWidth,
w->abacus.beadSize.y + 1 + 2 * w->abacus.pressOffset.y,
w->abacus.railShadeGC[color + 1])),
coord0.x, coord0.y, coord1.x, coord1.y,
0, offsetX, size);
if (!w->abacus.slot) {
int diff;
if (w->abacus.vertical) {
diff = coord1.y;
} else {
diff = coord1.x;
}
if (diff < 2) {
return;
}
vfillRectClip(w, dr, w->abacus.railShadeGC[color + 2],
coord0.x + coord1.x - 1, coord0.y, 1, coord1.y,
0, offsetX, size);
vfillRectClip(w, dr, w->abacus.railShadeGC[color],
coord0.x, coord0.y, 1, coord1.y,
0, offsetX, size);
}
}
}
......@@ -3106,7 +3127,7 @@ drawBead(AbacusWidget w, const int deck, const int rail, const int bead,
if (!w->abacus.slot || (j != 1 && (d == -1 ||
subj != 1))) {
VFILLRECTANGLE(w, dr, (w->abacus.slot) ?
w->abacus.borderGC : w->abacus.railGC[railI],
w->abacus.borderGC : w->abacus.railShadeGC[railI * 3 + 1],
dx + w->abacus.beadSize.x / 2 -
w->abacus.railWidth / 2,
dy - 1 + ((w->abacus.vertical) ?
......@@ -3116,7 +3137,7 @@ drawBead(AbacusWidget w, const int deck, const int rail, const int bead,
if (!w->abacus.slot || (j != room && (d == -1 ||
subj != w->abacus.subdecks[d].room))) {
VFILLRECTANGLE(w, dr, (w->abacus.slot) ?
w->abacus.borderGC : w->abacus.railGC[railI],
w->abacus.borderGC : w->abacus.railShadeGC[railI * 3 + 1],
dx + w->abacus.beadSize.x / 2 -
w->abacus.railWidth / 2,
dy - 1 + ((w->abacus.vertical) ?
......@@ -3138,7 +3159,7 @@ drawBead(AbacusWidget w, const int deck, const int rail, const int bead,
if (!w->abacus.slot || (j != 1 && (d == -1 ||
subj != 1))) {
VFILLRECTANGLE(w, dr, (w->abacus.slot) ?
w->abacus.borderGC : w->abacus.railGC[railI],
w->abacus.borderGC : w->abacus.railShadeGC[railI * 3 + 1],
dx + w->abacus.beadSize.x / 2 -
w->abacus.railWidth / 2 -
w->abacus.pressOffset.x * pressed,
......@@ -6200,28 +6221,44 @@ setValuesAbacus(AbacusWidget w)
szBuf, sizeof (szBuf), INIFILE);
(void) sscanf(szBuf, "%d %d %d",
&(color.red), &(color.green), &(color.blue));
w->abacus.railGC[0] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[1] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[0] = RGB(brighter(color.red),
brighter(color.green), brighter(color.blue));
w->abacus.railShadeGC[2] = RGB(darker(color.red),
darker(color.green), darker(color.blue));
/* silver (LightSteelBlue1) */
(void) GetPrivateProfileString(SECTION,
"secondaryRailColor", "202 225 255",
szBuf, sizeof (szBuf), INIFILE);
(void) sscanf(szBuf, "%d %d %d",
&(color.red), &(color.green), &(color.blue));
w->abacus.railGC[1] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[4] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[3] = RGB(brighter(color.red),
brighter(color.green), brighter(color.blue));
w->abacus.railShadeGC[5] = RGB(darker(color.red),
darker(color.green), darker(color.blue));
/* Purple */
(void) GetPrivateProfileString(SECTION,
"highlightRailColor", "160 32 240",
szBuf, sizeof (szBuf), INIFILE);
(void) sscanf(szBuf, "%d %d %d",
&(color.red), &(color.green), &(color.blue));
w->abacus.railGC[2] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[7] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[6] = RGB(brighter(color.red),
brighter(color.green), brighter(color.blue));
w->abacus.railShadeGC[8] = RGB(darker(color.red),
darker(color.green), darker(color.blue));
/* black */
(void) GetPrivateProfileString(SECTION,
"lineRailColor", "0 0 0",
szBuf, sizeof (szBuf), INIFILE);
(void) sscanf(szBuf, "%d %d %d",
&(color.red), &(color.green), &(color.blue));
w->abacus.railGC[3] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[10] = RGB(color.red, color.green, color.blue);
w->abacus.railShadeGC[9] = RGB(brighter(color.red),
brighter(color.green), brighter(color.blue));
w->abacus.railShadeGC[11] = RGB(darker(color.red),
darker(color.green), darker(color.blue));
/* gray25 */
(void) GetPrivateProfileString(SECTION,
"borderColor", "64 64 64", szBuf, sizeof (szBuf), INIFILE);
......@@ -6417,9 +6454,21 @@ setAllColors(AbacusWidget w)
values.foreground = w->abacus.railColor[i];
values.background = w->abacus.borderColor;
}
if (w->abacus.railGC[i])
XtReleaseGC((Widget) w, w->abacus.railGC[i]);
w->abacus.railGC[i] = XtGetGC((Widget) w, valueMask, &values);
if (w->abacus.railShadeGC[1 + i * 3])
XtReleaseGC((Widget) w, w->abacus.railShadeGC[1 + i * 3]);
w->abacus.railShadeGC[1 + i * 3] = XtGetGC((Widget) w, valueMask, &values);
if (!w->abacus.mono) {
values.foreground = brighter(w, w->abacus.railColor[i]);
}
if (w->abacus.railShadeGC[i * 3])
XtReleaseGC((Widget) w, w->abacus.railShadeGC[i * 3]);
w->abacus.railShadeGC[i * 3] = XtGetGC((Widget) w, valueMask, &values);
if (!w->abacus.mono) {
values.foreground = darker(w, w->abacus.railColor[i]);
}
if (w->abacus.railShadeGC[2 + i * 3])
XtReleaseGC((Widget) w, w->abacus.railShadeGC[2 + i * 3]);
w->abacus.railShadeGC[2 + i * 3] = XtGetGC((Widget) w, valueMask, &values);
}
for (i = 0; i < 3; i++) {
if (w->abacus.mono) {
......@@ -6878,10 +6927,10 @@ destroyAbacus(Widget old)
if (w->abacus.aux == PRIMARY)
(void) shutdown_sound();
#endif
for (i = 0; i < MAX_SHADES; i++)
for (i = 0; i < MAX_BEAD_SHADES; i++)
XtReleaseGC(old, w->abacus.beadShadeGC[i]);
for (i = 0; i < 4; i++)
XtReleaseGC(old, w->abacus.railGC[i]);
for (i = 0; i < MAX_RAIL_SHADES; i++)
XtReleaseGC(old, w->abacus.railShadeGC[i]);
XtReleaseGC(old, w->abacus.borderGC);
XtReleaseGC(old, w->abacus.frameGC);
XtReleaseGC(old, w->abacus.inverseGC);
......@@ -7092,10 +7141,10 @@ Widget request, Widget renew
(void) SRAND(getpid());
w->abacus.colormap = None;
for (i = 0; i < MAX_SHADES; i++)
for (i = 0; i < MAX_BEAD_SHADES; i++)
w->abacus.beadShadeGC[i] = NULL;
for (i = 0; i < 3; i++)
w->abacus.railGC[i] = NULL;
for (i = 0; i < MAX_RAIL_SHADES; i++)
w->abacus.railShadeGC[i] = NULL;
w->abacus.borderGC = NULL;
w->abacus.frameGC = NULL;
w->abacus.inverseGC = NULL;
......
/*
* @(#)AbacusP.h
*
* Copyright 1994 - 2017 David A. Bagley, bagleyd AT verizon.net
* Copyright 1994 - 2018 David A. Bagley, bagleyd AT verizon.net
*
* Abacus demo and neat pointers from
* Copyright 1991 - 1998 Luis Fernandes, elf AT ee.ryerson.ca
......@@ -160,7 +160,8 @@ extern AbacusClassRec abacusClassRec;
#define MAX_SLICES 10
#define COUNTRY_SIZE 3
#define STRING_SIZE 256
#define MAX_SHADES 12
#define MAX_BEAD_SHADES 12
#define MAX_RAIL_SHADES 12
#define NORMAL 1
#define DOUBLE 2
......@@ -235,8 +236,9 @@ typedef struct _AbacusPart {
Boolean slot, diamond, sound;
char *digits, *mathBuffer;
FILE *fp;
GC frameGC, borderGC, symbolGC, lineGC, railGC[4], inverseGC;
GC beadShadeGC[MAX_SHADES];
GC frameGC, borderGC, symbolGC, lineGC, inverseGC;
GC beadShadeGC[MAX_BEAD_SHADES];
GC railShadeGC[MAX_BEAD_SHADES];
Pixmap bufferBead[4][2][2];
TimeVal oldTime;
Boolean rightToLeftAdd, rightToLeftMult;
......
[Feb 05, 2018] V8.1.6:
Added rail shading.
[Nov 16, 2017] V8.1.5:
Fix for railIndex, can now be set in generic mode.
Russian abacus the spaces were increased by 3.
......
#ifndef _version_h
#define _version_h
#define VERSION "8.1.5"
#define VERSION "8.1.6"
#endif /* _version_h */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment