This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
deb-goldedplus/golded3/geglob.cpp

309 lines
10 KiB
C++
Raw Normal View History

2000-02-25 11:04:07 +00:00
// ------------------------------------------------------------------
// GoldED+
// Copyright (C) 1990-1999 Odinn Sorensen
// Copyright (C) 1999-2000 Alexander S. Aganichev
// ------------------------------------------------------------------
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307 USA
// ------------------------------------------------------------------
// $Id$
// ------------------------------------------------------------------
// Global data.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
// Various global data
glog LOG;
gareafile* AFILE = NULL;
CfgGed* CFG = NULL;
LangGed* LNG = NULL;
NodeIxl* NODE = NULL;
Qwk* QWK = NULL;
GoldedCfgEdit* EDIT = NULL;
uint locpost=0, netpost=0, echopost=0;
Subj information = "";
Area* AA = NULL;
char m_title[80]; // Menu title string
int m_titlepos; // Menu title position
vattr m_titleattr; // Menu title color
2000-02-25 11:04:07 +00:00
int AreaKeys = 0;
int ReadKeys = 0;
int ListKeys = 0;
int NodeKeys = 0;
int EditKeys = 0;
int FileKeys = 0;
2001-03-17 21:17:57 +00:00
int AddressbookKeys = 0;
int HeaderKeys = 0;
std::list<CmdKey>::iterator AreaKey, ReadKey, ListKey, NodeKey, EditKey, FileKey, AddressbookKey, HeaderKey;
2000-02-25 11:04:07 +00:00
int inforow = 18;
char goldmark = ' ';
int startecho = -1;
Echo stecho = "";
2000-02-25 11:04:07 +00:00
int fieldupd = 2; // State of field mode in winpdef()
int CurrArea = 0;
int OrigArea = 0;
Esc* MNETable = NULL;
Esc* I51Table = NULL;
Esc* CompTable = NULL;
Chs* CharTable = NULL;
EscTab* CompTP = NULL;
EscTab* I51TP = NULL;
EscTab* MNETP = NULL;
ChsTab* ChsTP = NULL;
bool quiet = true;
bool ignore = false;
int cfgerrors = 0;
bool veryverbose = false;
bool shellvid = true;
vsavebuf* oldscreen = NULL;
2000-02-25 11:04:07 +00:00
bool disablesound = false;
int _in_editor = NO;
int _in_msglist = NO;
int savedirect = NO;
void(*SIGINT_OldHandler)(void) = NULL;
int arealistnumgrps = false;
int startupscan_success = false;
// ------------------------------------------------------------------
// 0 1 2 3 4 5 6 7 8 9 10 11
Win gold_color1[16] = {
{5, { 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0}, 2}, // Back 0
{5, { 31, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 1}, // Stat 1
{0, { 15, 14, 14, 7, 12, 7, 7, 9, 7, 7, 7, 14}, 0}, // Brag 2
{0, { 7, 9, 14, 31, 15, 7, 7, 7, 7, 7, 7, 9}, 0}, // Area 3
2001-10-14 08:12:45 +00:00
{0, { 7, 7, 15, 14, 113, 8, 15, 79, 15, 15, 8, 7, 8, 15, 15}, 5}, // Read 4
2000-02-25 11:04:07 +00:00
{0, { 7, 9, 14, 7, 15, 7, 15, 113, 7, 7, 7, 9}, 0}, // Head 5
{0, { 7, 12, 14, 31, 15, 8, 7, 7, 7, 7, 7, 12}, 0}, // Ask 6
{0, { 7, 12, 14, 31, 15, 8, 7, 2, 12, 15, 7, 12}, 0}, // Menu 7
{0, { 7, 14, 7, 79, 15, 7, 7, 7, 7, 7, 7, 14}, 0}, // Help 8
{3, { 7, 12, 14, 31, 15, 8, 7, 7, 7, 7, 7, 12}, 0}, // Cfg 9
{0, { 15, 12, 14, 7, 7, 7, 7, 7, 7, 7, 7, 12}, 0}, // Info 10
{3, { 7, 12, 14, 31, 15, 8, 7, 7, 7, 7, 7, 12}, 0}, // Cfgb 11
2001-05-03 03:33:31 +00:00
{0, { 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}, 0}, // Style 12
2000-02-25 11:04:07 +00:00
{0, { 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7}, 0}, // Shad 13
#if defined(GCFG_SPELL_INCLUDED)
{0, { 15, }, 0 }, // SpellCheker
#endif
2000-02-25 11:04:07 +00:00
};
// ------------------------------------------------------------------
// 0 1 2 3 4 5 6 7 8 9
Win gold_color2[16] = {
{5, { 240, 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, 15}, 2}, // Back 0
{5, { 143, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 1}, // Stat 1
{0, { 15, 14, 14, 7, 12, 7, 7, 9, 7, 7, 7, 14}, 0}, // Brag 2
{0, { 240, 241, 244, 143, 244, 7, 7, 7, 7, 7, 7, 241}, 0}, // Area 3
2001-10-14 08:12:45 +00:00
{0, { 241, 240, 242, 244, 64, 248, 240, 64, 240, 240, 248, 240, 248, 241, 249}, 5}, // Read 4
2000-02-25 11:04:07 +00:00
{0, { 135, 142, 142, 135, 143, 7, 143, 64, 135, 135, 7, 142}, 0}, // Head 5
{0, { 224, 230, 232, 143, 228, 231, 7, 7, 7, 7, 7, 230}, 0}, // Ask 6
{0, { 112, 126, 116, 143, 126, 120, 117, 113, 125, 121, 7, 126}, 0}, // Menu 7
{0, { 135, 142, 7, 228, 143, 7, 7, 7, 7, 7, 7, 142}, 0}, // Help 8
{3, { 224, 230, 232, 143, 228, 231, 7, 7, 7, 7, 7, 230}, 0}, // Cfg 9
{0, { 15, 12, 14, 7, 7, 7, 7, 7, 7, 7, 7, 12}, 0}, // Info 10
{3, { 240, 241, 244, 143, 244, 7, 7, 7, 7, 7, 7, 241}, 0}, // Cfgb 11
2001-05-03 03:33:31 +00:00
{0, { 135, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249}, 0}, // Style 12
2000-02-25 11:04:07 +00:00
{0, { 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7}, 0}, // Shad 13
#if defined(GCFG_SPELL_INCLUDED)
{0, { 15, }, 0 }, // SpellCheker
#endif
2000-02-25 11:04:07 +00:00
};
// ------------------------------------------------------------------
// 0 1 2 3 4 5 6 7 8 9
Win gold_mono1[16] = {
{5, { 15, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0}, 2}, // Back 0
{5, { 112, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 1}, // Stat 1
{0, { 15, 7, 15, 7, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Brag 2
{0, { 7, 7, 15, 112, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Area 3
2001-10-14 08:12:45 +00:00
{0, { 7, 7, 15, 15, 112, 15, 7, 7, 7, 7, 15, 7, 7, 15, 7}, 5}, // Read 4
2000-02-25 11:04:07 +00:00
{0, { 7, 7, 15, 7, 15, 7, 112, 15, 7, 7, 7, 7}, 0}, // Head 5
{0, { 112, 112, 112, 15, 15, 7, 7, 7, 7, 7, 7, 112}, 0}, // Ask 6
{0, { 7, 7, 112, 112, 15, 7, 15, 15, 15, 15, 7, 7}, 0}, // Menu 7
{0, { 112, 112, 7, 15, 112, 7, 7, 7, 7, 7, 7, 112}, 0}, // Help 8
{3, { 7, 7, 112, 112, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Cfg 9
{0, { 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 0}, // Info A
{3, { 7, 7, 112, 112, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Cfgb B
2001-05-03 03:33:31 +00:00
{0, { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 0}, // Style C
2000-02-25 11:04:07 +00:00
{0, { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 0}, // Shad F
#if defined(GCFG_SPELL_INCLUDED)
{0, { 15, }, 0 }, // SpellCheker
#endif
2000-02-25 11:04:07 +00:00
};
// ------------------------------------------------------------------
// Deallocate CFG at exit
void CfgReset(void) {
2000-02-25 11:04:07 +00:00
throw_delete(QWK);
throw_delete(EDIT);
throw_delete(AFILE);
if(NODE)
throw_xrelease(NODE->nodelist);
throw_xrelease(NODE);
throw_delete(CFG);
}
// ------------------------------------------------------------------
// Assign default CFG values
void CfgInit() {
CFG = new CfgGed;
throw_new(CFG);
NODE = (NodeIxl*)throw_calloc(1, sizeof(NodeIxl));
AFILE = new gareafile;
throw_new(AFILE);
EDIT = new GoldedCfgEdit;
throw_new(EDIT);
QWK = new Qwk;
throw_new(QWK);
LangInit();
}
// ------------------------------------------------------------------
// Assign default CFG values before reading the .CFG's
void CfgInit2() {
// ----------------------------------------------------------------
// Set some default robotnames
CfgRobotname("AreaFix, AreaMgr, FileFix, AreaLink, SqaFix, AllFix, SqaFixHost, Raid, GEcho");
// ----------------------------------------------------------------
// Set some default filerequest extensions
CfgFrqext(".ARC .ARJ .EXE .LHA .LZH .PAK .RUN .SDA .SDN .ZIP .ZOO .DOC .TXT .GIF .RAR .PNG .JPG .HA");
// ----------------------------------------------------------------
// Setup the standard beeping effects
static char Attention[] = "Attention PLAY ToYou";
CfgEvent(Attention);
static char EditComment[] = "EditComment PLAY ToYou";
CfgEvent(EditComment);
static char EndOfMsgs[] = "EndOfMsgs PLAY TheEnd";
CfgEvent(EndOfMsgs);
static char JobDone[] = "JobDone PLAY GotIt";
CfgEvent(JobDone);
static char JobFailed[] = "JobFailed PLAY TooBad";
CfgEvent(JobFailed);
static char MsgIsLocal[] = "MsgIsLocal PLAY ToYou";
CfgEvent(MsgIsLocal);
static char MsgToYou[] = "MsgToYou PLAY ToYou";
CfgEvent(MsgToYou);
static char SayBiBi[] = "SayBiBi PLAY SayBiBi";
CfgEvent(SayBiBi);
static char SearchFailed[] = "SearchFailed PLAY TooBad";
CfgEvent(SearchFailed);
static char SearchSuccess[] = "SearchSuccess PLAY GotIt";
CfgEvent(SearchSuccess);
// ----------------------------------------------------------------
}
2000-12-27 12:45:20 +00:00
// ------------------------------------------------------------------
bool inline samekey(gkey key1, gkey key2) {
2001-01-27 11:52:13 +00:00
if(key1 >= KK_Commands) // special key
2000-12-27 12:45:20 +00:00
return false;
2002-09-23 09:23:45 +00:00
if(key1 == key2)
return true;
2002-11-04 18:59:51 +00:00
if((key1 > 0xFF) or (key2 > 0xFF))
2002-09-23 09:23:45 +00:00
return false;
return (g_tolower(key1) == key2) or (g_tolower(key2) == key1);
2000-12-27 12:45:20 +00:00
}
2000-02-25 11:04:07 +00:00
// ------------------------------------------------------------------
int IsMacro(gkey key, int type) {
std::vector<Macro>::iterator m = CFG->macro.begin();
2000-02-25 11:04:07 +00:00
while(m != CFG->macro.end()) {
2002-09-23 09:23:45 +00:00
if(samekey(key, m->key) and (type == m->type))
2000-02-25 11:04:07 +00:00
return true;
m++;
}
return false;
}
// ------------------------------------------------------------------
int PlayMacro(gkey key, int type) {
std::vector<Macro>::iterator m = CFG->macro.begin();
2000-02-25 11:04:07 +00:00
while(m != CFG->macro.end()) {
2002-09-23 09:23:45 +00:00
if(samekey(key, m->key) and (type == m->type)) {
RunMacro(&(*m));
2000-02-25 11:04:07 +00:00
return true;
}
m++;
}
return false;
}
// ------------------------------------------------------------------