Mercurial > hg
comparison mcabber/src/screen.c @ 1268:dbc907b2d92f
Add configurable colors for info and incoming messages (Michal 'vorner' Vaner)
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 20 Aug 2007 19:41:31 +0200 |
parents | 401639413340 |
children | 033576acac4c |
comparison
equal
deleted
inserted
replaced
1267:c5257cbe6ae4 | 1268:dbc907b2d92f |
---|---|
180 "status", | 180 "status", |
181 "roster", | 181 "roster", |
182 "rostersel", | 182 "rostersel", |
183 "rosterselmsg", | 183 "rosterselmsg", |
184 "rosternewmsg", | 184 "rosternewmsg", |
185 "info", | |
186 "msgin", | |
185 NULL | 187 NULL |
186 }; | 188 }; |
187 | 189 |
188 const char *color; | 190 const char *color; |
189 const char *background = settings_opt_get("color_background"); | 191 const char *background = settings_opt_get("color_background"); |
247 init_pair(i+1, ((color) ? FindColor(color) : COLOR_RED), | 249 init_pair(i+1, ((color) ? FindColor(color) : COLOR_RED), |
248 FindColor(backselected)); | 250 FindColor(backselected)); |
249 break; | 251 break; |
250 case COLOR_ROSTERNMSG: | 252 case COLOR_ROSTERNMSG: |
251 init_pair(i+1, ((color) ? FindColor(color) : COLOR_RED), | 253 init_pair(i+1, ((color) ? FindColor(color) : COLOR_RED), |
254 FindColor(background)); | |
255 break; | |
256 case COLOR_INFO: | |
257 init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE), | |
258 FindColor(background)); | |
259 break; | |
260 case COLOR_MSGIN: | |
261 init_pair(i+1, ((color) ? FindColor(color) : COLOR_WHITE), | |
252 FindColor(background)); | 262 FindColor(background)); |
253 break; | 263 break; |
254 } | 264 } |
255 } | 265 } |
256 } | 266 } |
671 if (line) { | 681 if (line) { |
672 if (line->flags & HBB_PREFIX_HLIGHT_OUT) | 682 if (line->flags & HBB_PREFIX_HLIGHT_OUT) |
673 wattrset(win_entry->win, get_color(COLOR_MSGOUT)); | 683 wattrset(win_entry->win, get_color(COLOR_MSGOUT)); |
674 else if (line->flags & HBB_PREFIX_HLIGHT) | 684 else if (line->flags & HBB_PREFIX_HLIGHT) |
675 wattrset(win_entry->win, get_color(COLOR_MSGHL)); | 685 wattrset(win_entry->win, get_color(COLOR_MSGHL)); |
676 | 686 else if (line->flags & HBB_PREFIX_INFO) |
677 if (line->timestamp && !(line->flags & HBB_PREFIX_SPECIAL)) { | 687 wattrset(win_entry->win, get_color(COLOR_INFO)); |
688 else if (line->flags & HBB_PREFIX_IN) | |
689 wattrset(win_entry->win, get_color(COLOR_MSGIN)); | |
690 | |
691 if (line->timestamp && | |
692 !(line->flags & (HBB_PREFIX_SPECIAL|HBB_PREFIX_CONT))) { | |
678 strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp)); | 693 strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp)); |
679 } else | 694 } else |
680 strcpy(date, " "); | 695 strcpy(date, " "); |
681 if (line->flags & HBB_PREFIX_INFO) { | 696 if (!(line->flags & HBB_PREFIX_CONT)) { |
682 char dir = '*'; | 697 if (line->flags & HBB_PREFIX_INFO) { |
683 if (line->flags & HBB_PREFIX_IN) | 698 char dir = '*'; |
684 dir = '<'; | 699 if (line->flags & HBB_PREFIX_IN) |
685 else if (line->flags & HBB_PREFIX_OUT) | 700 dir = '<'; |
686 dir = '>'; | 701 else if (line->flags & HBB_PREFIX_OUT) |
687 wprintw(win_entry->win, "%.11s *%c* ", date, dir); | 702 dir = '>'; |
688 } else if (line->flags & HBB_PREFIX_ERR) { | 703 wprintw(win_entry->win, "%.11s *%c* ", date, dir); |
689 char dir = '#'; | 704 } else if (line->flags & HBB_PREFIX_ERR) { |
690 if (line->flags & HBB_PREFIX_IN) | 705 char dir = '#'; |
691 dir = '<'; | 706 if (line->flags & HBB_PREFIX_IN) |
692 else if (line->flags & HBB_PREFIX_OUT) | 707 dir = '<'; |
693 dir = '>'; | 708 else if (line->flags & HBB_PREFIX_OUT) |
694 wprintw(win_entry->win, "%.11s #%c# ", date, dir); | 709 dir = '>'; |
695 } else if (line->flags & HBB_PREFIX_IN) { | 710 wprintw(win_entry->win, "%.11s #%c# ", date, dir); |
696 char cryptflag = line->flags & HBB_PREFIX_PGPCRYPT ? '~' : '='; | 711 } else if (line->flags & HBB_PREFIX_IN) { |
697 wprintw(win_entry->win, "%.11s <%c= ", date, cryptflag); | 712 char cryptflag = line->flags & HBB_PREFIX_PGPCRYPT ? '~' : '='; |
698 } else if (line->flags & HBB_PREFIX_OUT) { | 713 wprintw(win_entry->win, "%.11s <%c= ", date, cryptflag); |
699 char cryptflag = line->flags & HBB_PREFIX_PGPCRYPT ? '~' : '-'; | 714 } else if (line->flags & HBB_PREFIX_OUT) { |
700 wprintw(win_entry->win, "%.11s -%c> ", date, cryptflag); | 715 char cryptflag = line->flags & HBB_PREFIX_PGPCRYPT ? '~' : '-'; |
701 } else if (line->flags & HBB_PREFIX_SPECIAL) { | 716 wprintw(win_entry->win, "%.11s -%c> ", date, cryptflag); |
702 strftime(date, 30, "%m-%d %H:%M:%S", localtime(&line->timestamp)); | 717 } else if (line->flags & HBB_PREFIX_SPECIAL) { |
703 wprintw(win_entry->win, "%.14s ", date); | 718 strftime(date, 30, "%m-%d %H:%M:%S", localtime(&line->timestamp)); |
719 wprintw(win_entry->win, "%.14s ", date); | |
720 } else { | |
721 wprintw(win_entry->win, "%.11s ", date); | |
722 } | |
704 } else { | 723 } else { |
705 wprintw(win_entry->win, "%.11s ", date); | 724 wprintw(win_entry->win, " " ); |
706 } | 725 } |
707 | 726 |
708 wprintw(win_entry->win, "%s", line->text); // Display text line | 727 wprintw(win_entry->win, "%s", line->text); // Display text line |
709 | 728 |
710 if (line->flags & HBB_PREFIX_HLIGHT_OUT || | 729 // Return the color back |
711 line->flags & HBB_PREFIX_HLIGHT) | 730 if (line->flags & (HBB_PREFIX_HLIGHT_OUT | HBB_PREFIX_HLIGHT |
731 | HBB_PREFIX_INFO | HBB_PREFIX_IN)) | |
712 wattrset(win_entry->win, get_color(COLOR_GENERAL)); | 732 wattrset(win_entry->win, get_color(COLOR_GENERAL)); |
713 wclrtoeol(win_entry->win); | 733 wclrtoeol(win_entry->win); |
714 g_free(line->text); | 734 g_free(line->text); |
715 g_free(line); | 735 g_free(line); |
716 } else { | 736 } else { |