If using ncurses, use color to hilight games with too big terminals in watching menu.
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@563 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
fecd1b9361
commit
413256523c
11
configure.ac
11
configure.ac
|
@ -70,8 +70,17 @@ fi
|
||||||
AC_SUBST(MKDEP)
|
AC_SUBST(MKDEP)
|
||||||
AC_SUBST(MKDEP_DIRECT)
|
AC_SUBST(MKDEP_DIRECT)
|
||||||
|
|
||||||
|
AC_SEARCH_LIBS(use_default_colors, [ncurses],
|
||||||
|
[
|
||||||
|
AC_MSG_RESULT([Using ncurses and color.])
|
||||||
|
AC_DEFINE(USE_NCURSES_COLOR,1,[Use ncurses and color])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_MSG_RESULT([Not using ncurses, not using color.])
|
||||||
|
])
|
||||||
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_SEARCH_LIBS(initscr, [curses ncurses], [], [
|
AC_SEARCH_LIBS(initscr, [ncurses curses], [], [
|
||||||
AC_MSG_ERROR([Cannot find curses or ncurses devel libs.])
|
AC_MSG_ERROR([Cannot find curses or ncurses devel libs.])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -713,12 +713,17 @@ inprogressmenu (int gameid)
|
||||||
|
|
||||||
for (di = 0; di < ARRAY_SIZE(watchcols); di++) {
|
for (di = 0; di < ARRAY_SIZE(watchcols); di++) {
|
||||||
char tmpbuf[80];
|
char tmpbuf[80];
|
||||||
|
int hilite = 0;
|
||||||
switch (watchcols[di].dat) {
|
switch (watchcols[di].dat) {
|
||||||
default: break;
|
default: break;
|
||||||
case 0: tmpbuf[0] = selectorchars[i]; tmpbuf[1] = '\0'; break;
|
case 0: tmpbuf[0] = selectorchars[i]; tmpbuf[1] = '\0'; break;
|
||||||
case 1: snprintf(tmpbuf, 80, "%s", games[i + offset]->name); break;
|
case 1: snprintf(tmpbuf, 80, "%s", games[i + offset]->name); break;
|
||||||
case 2: snprintf(tmpbuf, 80, "%s", myconfig[games[i + offset]->gamenum]->shortname); break;
|
case 2: snprintf(tmpbuf, 80, "%s", myconfig[games[i + offset]->gamenum]->shortname); break;
|
||||||
case 3: snprintf(tmpbuf, 80, "%s", gametype); break;
|
case 3:
|
||||||
|
snprintf(tmpbuf, 80, "%s", gametype);
|
||||||
|
if ((games[i+offset]->ws_col > COLS || games[i+offset]->ws_row > LINES))
|
||||||
|
hilite = CLR_RED;
|
||||||
|
break;
|
||||||
case 4: snprintf(tmpbuf, 80, "%s %s", games[i + offset]->date, games[i + offset]->time); break;
|
case 4: snprintf(tmpbuf, 80, "%s %s", games[i + offset]->date, games[i + offset]->time); break;
|
||||||
case 5: snprintf(tmpbuf, 80, "%s", idletime); break;
|
case 5: snprintf(tmpbuf, 80, "%s", idletime); break;
|
||||||
#ifdef USE_SHMEM
|
#ifdef USE_SHMEM
|
||||||
|
@ -726,7 +731,12 @@ inprogressmenu (int gameid)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
tmpbuf[79] = '\0';
|
tmpbuf[79] = '\0';
|
||||||
|
if (hilite) attron(hilite);
|
||||||
mvprintw(top_banner_hei + 1 + i, watchcols[di].x, watchcols[di].fmt, tmpbuf);
|
mvprintw(top_banner_hei + 1 + i, watchcols[di].x, watchcols[di].fmt, tmpbuf);
|
||||||
|
if (hilite) {
|
||||||
|
attron(CLR_NORMAL);
|
||||||
|
hilite = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i + offset == selected) attroff(selected_attr);
|
if (i + offset == selected) attroff(selected_attr);
|
||||||
|
@ -1293,6 +1303,12 @@ initcurses ()
|
||||||
nonl ();
|
nonl ();
|
||||||
intrflush (stdscr, FALSE);
|
intrflush (stdscr, FALSE);
|
||||||
keypad (stdscr, TRUE);
|
keypad (stdscr, TRUE);
|
||||||
|
#ifdef USE_NCURSES_COLOR
|
||||||
|
start_color();
|
||||||
|
use_default_colors();
|
||||||
|
init_pair(1, -1, -1);
|
||||||
|
init_pair(2, COLOR_RED, -1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************* */
|
/* ************************************************************* */
|
||||||
|
|
|
@ -23,6 +23,14 @@
|
||||||
#define DGL_PASSWDLEN 20 /* max. length of passwords */
|
#define DGL_PASSWDLEN 20 /* max. length of passwords */
|
||||||
#define DGL_MAILMSGLEN 80 /* max. length of mail message */
|
#define DGL_MAILMSGLEN 80 /* max. length of mail message */
|
||||||
|
|
||||||
|
#ifdef USE_NCURSES_COLOR
|
||||||
|
# define CLR_NORMAL COLOR_PAIR(1) | A_NORMAL
|
||||||
|
# define CLR_RED COLOR_PAIR(2) | A_NORMAL
|
||||||
|
#else
|
||||||
|
# define CLR_NORMAL 0
|
||||||
|
# define CLR_RED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
DGLTIME_DGLSTART = 0, /* when someone telnets in */
|
DGLTIME_DGLSTART = 0, /* when someone telnets in */
|
||||||
|
|
Loading…
Reference in New Issue