1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 03:03:02 +01:00

bold currently selected friend in friendlist

This commit is contained in:
Jfreegman 2013-11-17 19:45:53 -05:00
parent 73cc9bfcf2
commit 246c9283d0
2 changed files with 27 additions and 6 deletions

View File

@ -224,12 +224,17 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
for (i = 0; i < num_friends; ++i) { for (i = 0; i < num_friends; ++i) {
int f = friendlist_index[i]; int f = friendlist_index[i];
int f_selected = false;
if (friends[f].active) { if (friends[f].active) {
if (i == num_selected) if (i == num_selected) {
wattron(self->window, A_BOLD);
wprintw(self->window, " > "); wprintw(self->window, " > ");
else wattroff(self->window, A_BOLD);
f_selected = true;
} else {
wprintw(self->window, " "); wprintw(self->window, " ");
}
if (friends[f].online) { if (friends[f].online) {
TOX_USERSTATUS status = friends[f].status; TOX_USERSTATUS status = friends[f].status;
@ -251,7 +256,15 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
wattron(self->window, COLOR_PAIR(colour) | A_BOLD); wattron(self->window, COLOR_PAIR(colour) | A_BOLD);
wprintw(self->window, "O"); wprintw(self->window, "O");
wattroff(self->window, COLOR_PAIR(colour) | A_BOLD); wattroff(self->window, COLOR_PAIR(colour) | A_BOLD);
wprintw(self->window, "]%s (", friends[f].name); wprintw(self->window, "]");
if (f_selected)
wattron(self->window, A_BOLD);
wprintw(self->window, "%s", friends[f].name);
if (f_selected)
wattroff(self->window, A_BOLD);
/* Reset friends[f].statusmsg on window resize */ /* Reset friends[f].statusmsg on window resize */
if (fix_statuses) { if (fix_statuses) {
@ -270,9 +283,17 @@ static void friendlist_onDraw(ToxWindow *self, Tox *m)
friends[f].statusmsg_len = maxlen; friends[f].statusmsg_len = maxlen;
} }
wprintw(self->window, "%s)\n", friends[f].statusmsg); wprintw(self->window, " (%s)\n", friends[f].statusmsg);
} else { } else {
wprintw(self->window, "[O]%s\n", friends[f].name); wprintw(self->window, "[O]");
if (f_selected)
wattron(self->window, A_BOLD);
wprintw(self->window, "%s\n", friends[f].name);
if (f_selected)
wattroff(self->window, A_BOLD);
} }
} }
} }

View File

@ -48,7 +48,7 @@ int init_groupchat_win(ToxWindow *prompt, Tox *m, int groupnum)
static void close_groupchatwin(Tox *m, int groupnum) static void close_groupchatwin(Tox *m, int groupnum)
{ {
tox_del_groupchat(m, groupnum); tox_del_groupchat(m, groupnum);
memset(&(groupchats[groupnum]), 0, sizeof(GroupChat)); memset(&groupchats[groupnum], 0, sizeof(GroupChat));
int i; int i;