Improved ColorName matching
This commit is contained in:
parent
de7d1ae282
commit
da4989aaa1
@ -10,6 +10,10 @@ ______________________________________________________________________
|
||||
Notes for GoldED+ 1.1.5, /snapshot/
|
||||
______________________________________________________________________
|
||||
|
||||
+ Improved ColorName matching. Case insensitive wildcard matching will be
|
||||
used for ColorName names. Also, search will be stopped on first matched
|
||||
name or address.
|
||||
|
||||
- Relative path usage is fixed. Now a Real UID is used to parse "~/" always.
|
||||
|
||||
+ Several unicode charset convertion tables is included into distribution of
|
||||
|
@ -209,10 +209,8 @@ void GMsgList::ReadMlst(int n) {
|
||||
strcpy(ml->to, msg.To());
|
||||
strcpy(ml->re, msg.re);
|
||||
|
||||
ml->colorby = GetColorName(msg.orig);
|
||||
if (ml->colorby == -1) ml->colorby = GetColorName(ml->by);
|
||||
ml->colorto = AA->isnet() ? GetColorName(msg.dest) : -1;
|
||||
if (ml->colorto == -1) ml->colorto = GetColorName(ml->to);
|
||||
ml->colorby = GetColorName(ml->by, msg.orig, -1);
|
||||
ml->colorto = GetColorName(ml->to, AA->isnet() ? msg.dest : Addr(), -1);
|
||||
}
|
||||
|
||||
|
||||
@ -944,11 +942,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar) {
|
||||
}
|
||||
|
||||
if (!isbar)
|
||||
{
|
||||
int colorname = GetColorName(msg.orig);
|
||||
if (colorname == -1) colorname = GetColorName(msg.By());
|
||||
if (colorname != -1) attr = colorname;
|
||||
}
|
||||
attr = GetColorName(msg.By(), msg.orig, attr);
|
||||
else if (CFG->replylinkfloat)
|
||||
{
|
||||
size_t bylen = strlen(msg.By());
|
||||
|
@ -418,8 +418,7 @@ char* strtmp(const char* str);
|
||||
int quotecolor(const char* line);
|
||||
void doinvalidate(char* text, const char* find, const char* replace, bool is_tearline = false);
|
||||
bool find(const std::vector<const char *> &vec, const char *str);
|
||||
int GetColorName(Addr &addr);
|
||||
int GetColorName(char *name);
|
||||
int GetColorName(const char *name, Addr &addr, int color);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@ -330,35 +330,24 @@ void ScreenBlankIdle() {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
int GetColorName(Addr &addr)
|
||||
int GetColorName(const char *name, Addr &addr, int color)
|
||||
{
|
||||
if (addr.invalid()) return -1;
|
||||
bool addr_valid = addr.valid();
|
||||
bool name_valid = (name != NULL);
|
||||
|
||||
if (!addr_valid && !name_valid)
|
||||
return color;
|
||||
|
||||
std::vector< std::pair<Node, int> >::iterator it;
|
||||
for (it = CFG->colorname.begin(); it != CFG->colorname.end(); it++)
|
||||
{
|
||||
if (addr.match(it->first.addr))
|
||||
if (addr_valid && addr.match(it->first.addr))
|
||||
return it->second;
|
||||
if (name_valid && gwildmat(name, it->first.name))
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
int GetColorName(char *name)
|
||||
{
|
||||
if (!name) return -1;
|
||||
|
||||
std::vector< std::pair<Node, int> >::iterator it;
|
||||
for (it = CFG->colorname.begin(); it != CFG->colorname.end(); it++)
|
||||
{
|
||||
if (strieql(it->first.name, name))
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,7 +100,6 @@ void GMsgHeaderView::Paint() {
|
||||
int namewidth = CFG->disphdrnodeset.pos - CFG->disphdrnameset.pos;
|
||||
int nodewidth = CFG->disphdrdateset.pos - CFG->disphdrnodeset.pos;
|
||||
int datewidth = MinV(width - CFG->disphdrdateset.pos, CFG->disphdrdateset.len);
|
||||
int colorname = -1;
|
||||
|
||||
#if defined(GUTLOS_FUNCS)
|
||||
g_set_ostitle_name(struplow(strtmp(area->echoid())), 0);
|
||||
@ -194,8 +193,6 @@ void GMsgHeaderView::Paint() {
|
||||
if(not area->isinternet()) {
|
||||
if(area->isecho() or not (*msg->ifrom and (*msg->realby or *msg->iorig)))
|
||||
{
|
||||
colorname = GetColorName(msg->orig);
|
||||
|
||||
// Generate orig node data
|
||||
if(msg->orig.net)
|
||||
msg->orig.make_string(buf);
|
||||
@ -214,13 +211,12 @@ void GMsgHeaderView::Paint() {
|
||||
else
|
||||
strxcpy(buf, msg->By(), (namewidth+nodewidth));
|
||||
|
||||
if (colorname == -1) colorname = GetColorName(buf);
|
||||
strsetsz(buf, nodegenerated ? namewidth : (namewidth+nodewidth));
|
||||
|
||||
window.prints(2, 0, window_color, LNG->From);
|
||||
int color = ((msg->foundwhere&GFIND_FROM) or msg->attr.fmu() or (msg->attr.loc() and CFG->switches.get(displocalhigh))) ? highlight_color : from_color;
|
||||
window.prints(2, CFG->disphdrnameset.pos, (colorname != -1) ? colorname : color, buf);
|
||||
colorname = -1;
|
||||
color = GetColorName(msg->By(), msg->orig, color);
|
||||
window.prints(2, CFG->disphdrnameset.pos, color, buf);
|
||||
|
||||
if(datewidth > 0) {
|
||||
if(msg->written)
|
||||
@ -236,8 +232,6 @@ void GMsgHeaderView::Paint() {
|
||||
if(not area->isinternet()) {
|
||||
if(not (*msg->ito and (*msg->realto or *msg->idest)))
|
||||
{
|
||||
if (area->isnet()) colorname = GetColorName(msg->dest);
|
||||
|
||||
if(msg->dest.net and area->isnet()) {
|
||||
msg->dest.make_string(buf);
|
||||
if(msg->odest.net) {
|
||||
@ -259,12 +253,12 @@ void GMsgHeaderView::Paint() {
|
||||
else
|
||||
strxcpy(buf, msg->To(), (namewidth+nodewidth));
|
||||
|
||||
if (colorname == -1) colorname = GetColorName(buf);
|
||||
strsetsz(buf, nodegenerated ? namewidth : (namewidth+nodewidth));
|
||||
|
||||
window.prints(3, 0, window_color, LNG->To);
|
||||
color = ((msg->foundwhere&GFIND_TO) or msg->attr.tou()) ? highlight_color : to_color;
|
||||
window.prints(3, CFG->disphdrnameset.pos, (colorname != -1) ? colorname : color , buf);
|
||||
color = GetColorName(msg->To(), area->isnet() ? msg->dest : Addr(), color);
|
||||
window.prints(3, CFG->disphdrnameset.pos, color, buf);
|
||||
|
||||
if(datewidth > 0) {
|
||||
if(msg->arrived)
|
||||
|
Reference in New Issue
Block a user