1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-07-21 16:14:14 -04:00

Remove obsolete old_attrpr, old_center, old_center2 and old_center3

This commit is contained in:
John Zaitseff 2011-08-16 18:51:56 +10:00
parent cf30933614
commit de6a4e3e66
2 changed files with 0 additions and 274 deletions

View File

@ -1440,182 +1440,6 @@ int right (WINDOW *win, int y, int x, chtype attr_norm, chtype attr_alt1,
}
/***********************************************************************/
// old_attrpr: Print a string with a particular character rendition
int old_attrpr (WINDOW *win, chtype attr, const char *restrict format, ...)
{
va_list args;
int ret;
assert(win != NULL);
assert(format != NULL);
chtype oldattr = getattrs(win);
chtype oldbkgd = getbkgd(win);
/* Note that wattrset() will override parts of wbkgdset() and vice
versa: don't swap the order of these two lines! */
wbkgdset(win, (oldbkgd & A_COLOR) | A_NORMAL);
wattrset(win, attr);
va_start(args, format);
ret = vw_printw(win, format, args);
va_end(args);
wbkgdset(win, oldbkgd);
wattrset(win, oldattr);
return ret;
}
/***********************************************************************/
// old_center: Centre a string in a given window
int old_center (WINDOW *win, int y, chtype attr, const char *restrict format, ...)
{
va_list args;
int ret, len, x;
char *buf;
assert(win != NULL);
assert(format != NULL);
buf = xmalloc(BUFSIZE);
chtype oldattr = getattrs(win);
chtype oldbkgd = getbkgd(win);
// Order is important: see old_attrpr()
wbkgdset(win, (oldbkgd & A_COLOR) | A_NORMAL);
wattrset(win, attr);
va_start(args, format);
len = vsnprintf(buf, BUFSIZE, format, args);
va_end(args);
if (len < 0) {
ret = ERR;
} else if (len == 0) {
ret = OK;
} else {
x = (getmaxx(win) - len) / 2;
ret = mvwprintw(win, y, MAX(x, 2), "%1.*s", getmaxx(win) - 4, buf);
}
wbkgdset(win, oldbkgd);
wattrset(win, oldattr);
free(buf);
return ret;
}
/***********************************************************************/
// old_center2: Centre two strings in a given window
int old_center2 (WINDOW *win, int y, chtype attr1, chtype attr2,
const char *initial, const char *restrict format, ...)
{
va_list args;
int ret, len1, len2, x;
char *buf;
assert(win != NULL);
assert(initial != NULL);
assert(format != NULL);
buf = xmalloc(BUFSIZE);
chtype oldattr = getattrs(win);
chtype oldbkgd = getbkgd(win);
wbkgdset(win, (oldbkgd & A_COLOR) | A_NORMAL);
len1 = strlen(initial);
va_start(args, format);
len2 = vsnprintf(buf, BUFSIZE, format, args);
va_end(args);
if (len2 < 0) {
ret = ERR;
} else if (len1 + len2 == 0) {
ret = OK;
} else {
x = (getmaxx(win) - (len1 + len2)) / 2;
wattrset(win, attr1);
mvwprintw(win, y, MAX(x, 2), "%s", initial);
wattrset(win, attr2);
ret = wprintw(win, "%1.*s", getmaxx(win) - len1 - 4, buf);
}
wbkgdset(win, oldbkgd);
wattrset(win, oldattr);
free(buf);
return ret;
}
/***********************************************************************/
// old_center3: Centre three strings in a given window
int old_center3 (WINDOW *win, int y, chtype attr1, chtype attr3, chtype attr2,
const char *initial, const char *final,
const char *restrict format, ...)
{
va_list args;
int len1, len2, len3;
int ret, x;
char *buf;
assert(win != NULL);
assert(initial != NULL);
assert(final != NULL);
assert(format != NULL);
buf = xmalloc(BUFSIZE);
chtype oldattr = getattrs(win);
chtype oldbkgd = getbkgd(win);
wbkgdset(win, (oldbkgd & A_COLOR) | A_NORMAL);
len1 = strlen(initial);
len3 = strlen(final);
va_start(args, format);
len2 = vsnprintf(buf, BUFSIZE, format, args);
va_end(args);
if (len2 < 0) {
ret = ERR;
} else if (len1 + len2 + len3 == 0) {
ret = OK;
} else {
x = (getmaxx(win) - (len1 + len2 + len3)) / 2;
wattrset(win, attr1);
mvwprintw(win, y, MAX(x, 2), "%s", initial);
wattrset(win, attr2);
ret = wprintw(win, "%1.*s", getmaxx(win) - len1 - len3 - 4, buf);
wattrset(win, attr3);
wprintw(win, "%s", final);
}
wbkgdset(win, oldbkgd);
wattrset(win, oldattr);
free(buf);
return ret;
}
/***********************************************************************/
// gettxchar: Read a character from the keyboard

View File

@ -548,104 +548,6 @@ extern int right (WINDOW *win, int y, int x, chtype attr_norm, chtype attr_alt1,
...);
/*
Function: old_attrpr - Print a string with a particular character rendition
Parameters: win - Window to use (should be curwin)
attr - Character rendition to use for the string
format - printf()-like format string
... - printf()-like arguments
Returns: int - Return code from wprintw(): OK or ERR
This function sets the character rendition (attributes) to attr, prints
the string using wprintw(), then restores the previous character
rendition. The return code is as returned from wprintw(). Note that
wrefresh() is NOT called.
*/
extern int old_attrpr (WINDOW *win, chtype attr, const char *restrict format, ...)
__attribute__((format (printf, 3, 4)));
/*
Function: old_center - Centre a string in a given window
Parameters: win - Window to use (should be curwin)
y - Line on which to centre the string
attr - Character rendition to use for the string
format - printf()-like format string
... - printf()-like arguments
Returns: int - Return code from wprintw(): OK or ERR
This function prints a string formatted with wprintw() in the centre of
line y in the window win, using the character rendition (attributes) in
attr. If the string is too long to fit the window, it is truncated.
Please note that wrefresh() is NOT called.
At the current time, the implementation of this function does NOT
handle multibyte strings correctly: strlen() is used to determine the
printing width of the string.
*/
extern int old_center (WINDOW *win, int y, chtype attr,
const char *restrict format, ...)
__attribute__((format (printf, 4, 5)));
/*
Function: old_center2 - Centre two strings in a given window
Parameters: win - Window to use (should be curwin)
y - Line on which to centre the strings
attr1 - Character rendition to use for initial string
attr2 - Character rendition to use for main string
initial - Initial string (no printf() formatting)
format - printf()-like format string for main string
... - printf()-like arguments
Returns: int - Return code from wprintw(): OK or ERR
This function prints two strings side-by-side on line y in the centre
of window win. The first (initial) string is printed with character
rendition (attributes) attr1 using waddstr(). The second (main) string
uses wprintw(format, ...) with rendition attr2. If the main string is
too long to fit in the window alongside the initial string, the main
string is truncated to fit. Please note that wrefresh() is NOT called.
As with center(), the current implementation does NOT handle multibyte
strings correctly.
*/
extern int old_center2 (WINDOW *win, int y, chtype attr1, chtype attr2,
const char *initial, const char *restrict format, ...)
__attribute__((format (printf, 6, 7)));
/*
Function: old_center3 - Centre three strings in a given window
Parameters: win - Window to use (should be curwin)
y - Line on which to centre the strings
attr1 - Character rendition to use for initial string
attr3 - Character rendition to use for final string
attr2 - Character rendition to use for main string
initial - Initial string (no printf() formatting)
final - Final string (no printf() formatting)
format - printf()-like format string for main string
... - printf()-like arguments
Returns: int - Return code from wprintw(): OK or ERR
This function prints three strings side-by-side on line y in the centre
of window win. The first (initial) string is printed with character
rendition (attributes) attr1 using waddstr(). The second (main) string
uses wprintw(format, ...) with rendition attr2. The third (final)
string is then printed with rendition attr3 using waddstr(). If the
strings are too long to fit the window width, the main (centre) string
is truncated. Please note that wrefresh() is NOT called. Also note
the order of rendition values: 1, 3, 2, NOT 1, 2, 3!
As with center(), the current implementation does NOT handle multibyte
strings correctly.
*/
extern int old_center3 (WINDOW *win, int y, chtype attr1, chtype attr3,
chtype attr2, const char *initial, const char *final,
const char *restrict format, ...)
__attribute__((format (printf, 8, 9)));
/*
Function: gettxchar - Read a character from the keyboard
Parameters: win - Window to use (should be curwin)