Display originator's city in delimiter line between header and message body. New token: DispHdrLocation

This commit is contained in:
Stas Degteff 2005-09-26 18:00:24 +00:00
parent 5e71adb5da
commit ebdd6624c9
13 changed files with 137 additions and 2 deletions

View File

@ -235,6 +235,10 @@ DISPATTACHSIZE KBYTES
DISPAREANO YES ; Only shows it if available.
;DISPAREANO ALWAYS ; Will show 0 if there is no board number.
//
;DispHdrLocation No
DispHdrLocation Yes
// Positions and lengths of name/node/date fields in header display.
// These are the default values.
;DISPHDRNAMESET 8 36

View File

@ -205,6 +205,12 @@ DispAreaNo Yes ;
;DispAreaNo Always ; <20>®ª §ë¢ âì 0 ¥á«¨ ­¥â "board number".
;DispAreaNo No ; <20>¥ ¢ë¢®¤¨âì.
// ‚뢮¤ ¢ ¯®«®áª¥ ¯®¤ 奤¥à®¬ ¨¬¥­¨ £®à®¤  ¨§ ­®¤- ¨ ¯®©­â«¨á⮢.
// …᫨ ¯®¨­â®¢ë©  ¤à¥á ­¥ ­ ©¤¥­, ¡ã¤¥â ¨á¯®«ì§®¢ ­  ¤à¥á ­®¤ë.
// (¯® 㬮«ç ­¨î: No)
;DispHdrLocation No
DispHdrLocation Yes
// <20> á¯®«®¦¥­¨¥ ¨ ¤«¨­  ¯®«¥© ˆ¬ï/€¤à¥á/„ â  ¢ ¢¥àåã íªà ­ .
// ‡¤¥áì 㪠§ ­ë §­ ç¥­¨ï ¯® 㬮«ç ­¨î.
;DispHdrNameSet 8 36

View File

@ -10,6 +10,10 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
+ Display originator's city in delimiter line between header and message body.
New config file token: DISPHDRLOCATION (yes/no).
(Patch from Ianos Gnatiuc 2:5030/830.17)
+ Don't use a GOLDMARK char in default status line.
(Patch from Ianos Gnatiuc 2:5030/830.17)

View File

@ -711,6 +711,7 @@ CfgGed::CfgGed() {
ctrlinfonews = 0;
dispareano = true;
dispattachsize = ATTACH_KBYTES;
disphdrlocation = false;
displistcursor = NO;
dispmargin = 0;
dispmsgsize = DISPMSGSIZE_BYTES;

View File

@ -122,6 +122,7 @@ const word CRC_DISPAREANO = 0x68CE;
const word CRC_DISPATTACHSIZE = 0x7BB4;
const word CRC_DISPAUTONEXT = 0x52D9;
const word CRC_DISPHDRDATESET = 0x65A5;
const word CRC_DISPHDRLOCATION = 0x8EF6;
const word CRC_DISPHDRNAMESET = 0xFEF9;
const word CRC_DISPHDRNODESET = 0xC232;
const word CRC_DISPLISTCURSOR = 0x8B82;

View File

@ -276,6 +276,7 @@ SwitchD:
case CRC_DISPAREANO : CfgDispareano (); break;
case CRC_DISPATTACHSIZE : CfgDispattachsize (); break;
case CRC_DISPHDRDATESET : CfgDisphdrdateset (); break;
case CRC_DISPHDRLOCATION : CfgDisphdrlocation (); break;
case CRC_DISPHDRNAMESET : CfgDisphdrnameset (); break;
case CRC_DISPHDRNODESET : CfgDisphdrnodeset (); break;
case CRC_DISPLISTCURSOR : CfgDisplistcursor (); break;

View File

@ -449,6 +449,13 @@ void CfgDisphdrdateset() {
// ------------------------------------------------------------------
void CfgDisphdrlocation()
{
CFG->disphdrlocation = (0 != GetYesno(val));
}
// ------------------------------------------------------------------
void CfgDisphdrnameset() {
char* key;

View File

@ -122,6 +122,7 @@ void CfgDispareano ();
void CfgDispattachsize ();
void CfgDispautonext ();
void CfgDisphdrdateset ();
void CfgDisphdrlocation ();
void CfgDisphdrnameset ();
void CfgDisphdrnodeset ();
void CfgDisplistcursor ();

View File

@ -194,6 +194,8 @@ const int CS_MONO = 2;
const int LOOK_DEST = 0;
const int LOOK_ORIG = 1;
const int LOOK_NAME = 2;
const int LOOK_CITY1 = 3;
const int LOOK_CITY2 = 4;
// ------------------------------------------------------------------

View File

@ -200,6 +200,7 @@ public:
int ctrlinfonews;
int dispareano;
int dispattachsize;
bool disphdrlocation;
PosLen disphdrdateset;
PosLen disphdrnameset;
PosLen disphdrnodeset;

View File

@ -1005,16 +1005,36 @@ void Lookup(GMsg* msg, Addr* addr, char* name, int topline, char* status) {
else
NLP->find(matchaddr);
found = (exactmatch and NLP->found()) ? true : false;
if(found) {
found = (NLP->found() && (exactmatch || topline == -100));
if (found && (topline != -100))
{
NLP->push_state();
if(NLP->next())
if(NLP->found())
found = false;
NLP->pop_state();
}
else if (!found && matchaddr.point && (topline == -100))
{
matchaddr.point = 0;
NLP->find(matchaddr);
found = NLP->found();
}
entry = NLP->entry();
if (topline == -100)
{
if (found)
strcpy(name, entry.location);
else
strcpy(name, "");
NLP_close();
return;
}
if(not found or (topline < 0)) {
strcpy(buf, information);
update_statusline(status);
@ -1061,6 +1081,71 @@ void Lookup(GMsg* msg, Addr* addr, char* name, int topline, char* status) {
}
// ------------------------------------------------------------------
struct location_item
{
Addr addr;
std::string loc;
location_item(Addr &a) { addr = a; }
bool operator<(Addr &other) { return (addr.compare(other) < 0); }
bool operator==(Addr &other) { return addr.equals(other); }
};
void LookupNodeLocation(GMsg* msg, std::string &location, int what)
{
static std::vector<location_item> cash;
Subj statuslinebak;
strcpy(statuslinebak, information);
vcurhide();
w_info(LNG->Wait);
Addr addr;
switch (what)
{
case LOOK_CITY2:
addr = msg->dest;
break;
case LOOK_CITY1:
addr = msg->orig;
break;
}
if (addr.zone == 0)
addr.zone = AA->Aka().addr.zone;
std::vector<location_item>::iterator it = cash.begin();
std::vector<location_item>::iterator end = cash.end();
while ((it != end) && (*it < addr)) it++;
if ((it != end) && (*it == addr))
location = it->loc;
else
{
char buf[256];
location_item item(addr);
addr.make_string(buf);
Lookup(msg, &addr, buf, -100, LNG->LookupInfo);
if (addr.invalid())
buf[0] = NUL;
item.loc = location = buf;
cash.insert(it, item);
}
update_statusline(statuslinebak);
w_info(NULL);
}
// ------------------------------------------------------------------
// Lookup and display info about the node

View File

@ -235,6 +235,7 @@ bool Lookup2(Addr& addr, char* name, int topline, const char* status);
const char *lookup_nodelist(ftn_addr* addr);
void LookupNodeLocation(GMsg* msg, std::string &location, int what);
void LookupNode(GMsg* msg, const char* name, int what);
void CheckNodelists();

View File

@ -322,6 +322,27 @@ void GMsgHeaderView::Paint() {
if(*buf1)
window.prints(5, 1, title_color, buf1);
}
if (CFG->disphdrlocation && !_in_editor)
{
std::string loc;
LookupNodeLocation(msg, loc, LOOK_CITY1);
if (loc.length()) loc = " " + loc;
if (AA->isnet())
{
std::string loc2;
LookupNodeLocation(msg, loc2, LOOK_CITY2);
if (loc.length()) loc += " | " + loc2;
}
if (loc.length())
{
loc += " ";
int pos = window.width() - loc.length() - 1;
window.prints(5, pos, window_color, loc.c_str());
}
}
}