📄 commandsgtol.cpp
字号:
int nInc;
SUB *pSub = _subs.GetFirst();
while(pSub != NULL)
{
if (pSub->strGroup == strGroup)
{
nCount++;
_subs.SubToTrigger(pSub,strTemp);
pBuf = strText.GetBuffer(strTemp.GetLength()+pSub->strSub.GetLength()+40);
nResult = sprintf(pBuf,"%s%03d:%s%c{%s} {%s}\n",
ANSI_F_BOLDWHITE,
_subs.GetFindIndex()+1,
ANSI_RESET,
(pSub->bEnabled ? ' ' : '*'),
(const char *)strTemp,
(const char *)pSub->strSub);
strText.ReleaseBuffer(nResult);
_terminal.Print(strText);
if (_config.bPause)
{
nInc = strText.GetLength() / 80 + 1;
nLineCount += nInc;
if (nLineCount >= nNumLines)
if (PausePrompt())
nLineCount = 0;
else
break;
}
}
pSub = _subs.GetNext();
}
strText.Format("[%d substitutes listed.]\n",nCount);
_terminal.Print(strText);
CommandPrintOff();
}
void GroupTablist(CString &strLine)
{
CString strGroup;
FindStatement(strLine,strGroup);
if (strGroup.IsEmpty())
return;
CString strText;
strText.Format("Defined Tab Words(%s):",(const char *)strGroup);
PrintMessage(strText);
CommandPrintOn();
char *pBuf;
int nResult;
int nCount = 0;
int nLineCount = 1;
int nNumLines = _terminal.GetWindowLines()-2;
int nInc;
TAB *pTab = _tabList.GetFirst();
while(pTab != NULL)
{
if (pTab->strGroup == strGroup)
{
nCount++;
pBuf = strText.GetBuffer(pTab->strText.GetLength()+20);
nResult = sprintf(pBuf,"%s%03d:%s {%s}\n",
ANSI_F_BOLDWHITE,
_tabList.GetFindIndex()+1,
ANSI_RESET,
(const char *)pTab->strText);
strText.ReleaseBuffer(nResult);
_terminal.Print(strText);
if (_config.bPause)
{
nInc = strText.GetLength() / 80 + 1;
nLineCount += nInc;
if (nLineCount >= nNumLines)
if (PausePrompt())
nLineCount = 0;
else
break;
}
}
pTab = _tabList.GetNext();
}
strText.Format("[%d tab words listed.]\n",nCount);
_terminal.Print(strText);
CommandPrintOff();
}
void GroupVariables(CString &strLine)
{
CString strGroup;
FindStatement(strLine,strGroup);
if (strGroup.IsEmpty())
return;
CString strText,strTemp;
strText.Format("Defined Variables(%s):",(const char *)strGroup);
PrintMessage(strText);
CommandPrintOn();
char *pBuf;
int nResult;
int nCount = 0;
int nLineCount = 1;
int nNumLines = _terminal.GetWindowLines()-2;
int nInc;
STRING_MAP *pMap = _mapVars.GetFirst();
while(pMap != NULL)
{
if (pMap->strGroup == strGroup)
{
nCount++;
pBuf = strTemp.GetBuffer(pMap->strKey.GetLength()+pMap->strText.GetLength()+30);
nResult = sprintf(pBuf,"%s%03d:%s {%s} {%s}\n",
ANSI_F_BOLDWHITE,
_mapVars.GetFindIndex()+1,
ANSI_RESET,
(const char *)pMap->strKey,
(const char *)pMap->strText);
strTemp.ReleaseBuffer(nResult);
_terminal.Print(strTemp);
if (_config.bPause)
{
nInc = strTemp.GetLength() / 80 + 1;
nLineCount += nInc;
if (nLineCount >= nNumLines)
if (PausePrompt())
nLineCount = 0;
else
break;
}
}
pMap = _mapVars.GetNext();
}
strText.Format("[%d variables listed.]\n",nCount);
_terminal.Print(strText);
CommandPrintOff();
}
void Help(CString &strLine)
{
if (strLine.IsEmpty())
{
ShowHelpFile("topics");
return;
}
strLine.MakeLower();
const char *pszLine = (const char *)strLine;
int nIndex;
if (strLine[0] == '@')
{
CString strProc;
nIndex = 0;
while(_procedureList[nIndex].proc)
{
strProc = _procedureList[nIndex].szProcedure;
strProc.MakeLower();
if (IsPartial(pszLine+1,strProc))
{
ShowHelpFile(_procedureList[nIndex].szHelp);
return;
}
nIndex++;
}
return;
}
nIndex = 0;
while(_commandList[nIndex].proc)
{
if (IsPartial(pszLine,_commandList[nIndex].szCommand))
{
ShowHelpFile(_commandList[nIndex].szHelp);
return;
}
nIndex++;
}
if (IsPartial(pszLine,"commands"))
{
ShowHelpFile("commands");
return;
}
if (IsPartial(pszLine,"groups"))
{
ShowHelpFile("groups");
return;
}
if (IsPartial(pszLine,"historylist"))
{
ShowHelpFile("hlist");
return;
}
if (IsPartial(pszLine,"inputline"))
{
ShowHelpFile("inputl");
return;
}
if (IsPartial(pszLine,"keyboard"))
{
ShowHelpFile("keyboard");
return;
}
if (IsPartial(pszLine,"modems"))
{
ShowHelpFile("modems");
return;
}
if (IsPartial(pszLine,"procedures"))
{
ShowHelpFile("procs");
return;
}
if (IsPartial(pszLine,"repetition"))
{
ShowHelpFile("rep");
return;
}
if (IsPartial(pszLine,"scrollbackbuffer"))
{
ShowHelpFile("scrlbuf");
return;
}
if (IsPartial(pszLine,"speed"))
{
ShowHelpFile("speed");
return;
}
if (IsPartial(pszLine,"systemvariables"))
{
ShowHelpFile("sysvars");
return;
}
if (IsPartial(pszLine,"tabcompletion"))
{
ShowHelpFile("tabcomp");
return;
}
if (IsPartial(pszLine,"ug_chat"))
{
ShowHelpFile("ug_chat");
return;
}
if (IsPartial(pszLine,"ug_dll"))
{
ShowHelpFile("ug_dll");
return;
}
if (IsPartial(pszLine,"ug_statusbar"))
{
ShowHelpFile("ug_statb");
return;
}
if (IsPartial(pszLine,"userguide"))
{
ShowHelpFile("userg");
return;
}
if (IsPartial(pszLine,"userlists"))
{
ShowHelpFile("userlist");
return;
}
}
void Highlight(CString &strLine)
{
CString strMask, strColor, strGroup;
CString strTemp;
int nHighNum;
FindStatement(strLine,strMask);
FindStatement(strLine,strColor);
FindStatement(strLine,strGroup);
ReplaceVariables(strMask);
ReplaceVariables(strGroup);
if (!strMask.IsEmpty())
{
nHighNum = _highlights.Add(strMask,strColor,strGroup);
if (_config.bHighMessages)
if (nHighNum)
{
strTemp.Format("Highlight added as #%d.",nHighNum);
PrintMessage(strTemp);
}
else
PrintMessage("Highlight not added.");
return;
}
PrintMessage("Defined Highlights:");
CommandPrintOn();
CString strText;
char *pBuf;
int nResult;
int nLineCount = 1;
int nNumLines = _terminal.GetWindowLines()-2;
int nInc;
HIGHLIGHT *pHigh = _highlights.GetFirst();
while(pHigh != NULL)
{
_highlights.HighlightToMask(pHigh,strTemp);
_highlights.AttrToText(pHigh->wAttr,strColor);
pBuf = strText.GetBuffer(strTemp.GetLength()+strColor.GetLength()+pHigh->strGroup.GetLength()+40);
nResult = sprintf(pBuf,"%s%03d:%s%c{%s} {%s} {%s}\n",
ANSI_F_BOLDWHITE,
_highlights.GetFindIndex()+1,
ANSI_RESET,
(pHigh->bEnabled ? ' ' : '*'),
(const char *)strTemp,
(const char *)strColor,
(const char *)pHigh->strGroup);
strText.ReleaseBuffer(nResult);
_terminal.Print(strText);
if (_config.bPause)
{
nInc = strText.GetLength() / 80 + 1;
nLineCount += nInc;
if (nLineCount >= nNumLines)
if (PausePrompt())
nLineCount = 0;
else
break;
}
pHigh = _highlights.GetNext();
}
CommandPrintOff();
}
void KillAll(CString &strLine)
{
_actions.RemoveAll();
_aliases.RemoveAll();
_events.RemoveAll();
_lists.RemoveAll();
_macros.RemoveAll();
_tabList.RemoveAll();
_mapVars.RemoveAll();
_arrays.RemoveAll();
_statusBar.RemoveAll();
_gags.RemoveAll();
_subs.RemoveAll();
_highlights.RemoveAll();
if (_config.bStatusBar)
_statusBar.Redraw();
PrintMessage("Memory cleared.");
}
void KillGroup(CString &strLine)
{
CString strGroup;
FindStatement(strLine,strGroup);
if (strGroup.IsEmpty())
return;
int nActions = _actions.RemoveGroup(strGroup);
int nAliases = _aliases.RemoveGroup(strGroup);
int nArrays = _arrays.RemoveGroup(strGroup);
int nEvents = _events.RemoveGroup(strGroup);
int nLists = _lists.RemoveGroup(strGroup);
int nMacros = _macros.RemoveGroup(strGroup);
int nTabLists = _tabList.RemoveGroup(strGroup);
int nVariables = _mapVars.RemoveGroup(strGroup);
int nBarItems = _statusBar.RemoveGroup(strGroup);
int nGags = _gags.RemoveGroup(strGroup);
int nHighs = _highlights.RemoveGroup(strGroup);
int nSubs = _subs.RemoveGroup(strGroup);
if (nBarItems && _config.bStatusBar)
_statusBar.Redraw();
CString strText;
char *pBuf = strText.GetBuffer(320);
int nResult = sprintf(pBuf,"Memory cleared: Actions(%d), Aliases(%d), Arrays(%d), Bar Items(%d)\n"
" Events(%d), Gags(%d), Highlights(%d), Lists(%d)\n"
" Macros(%d), Subsitutions(%d), Tab Words(%d), Variables(%d)",
nActions,nAliases,nArrays,nBarItems,nEvents,nGags,nHighs,
nLists,nMacros,nSubs,nTabLists,nVariables);
strText.ReleaseBuffer(nResult);
PrintMessage(strText);
}
void If(CString &strLine)
{
CString strCondition, strParam, strElse;
FindStatement(strLine,strCondition);
FindStatement(strLine,strParam);
FindStatement(strLine,strElse);
if (strCondition.IsEmpty() || strParam.IsEmpty())
return;
ReplaceVariables(strCondition,TRUE);
if (EvaluateLine(strCondition))
HandleInput(strParam);
else
if (!strElse.IsEmpty())
HandleInput(strElse);
}
void Ignore(CString &strLine)
{
if (_terminal.ActionsState())
{
_terminal.ActionsOff();
PrintMessage("Actions will no longer be processed.");
}
else
{
_terminal.ActionsOn();
PrintMessage("Actions are being processed.");
}
}
void IgnoreAliases(CString &strLine)
{
if (_config.bIgnoreAliases)
{
_config.bIgnoreAliases = FALSE;
PrintMessage("Aliases are being be processed.");
}
else
{
_config.bIgnoreAliases = TRUE;
PrintMessage("Aliases are not being be processed.");
}
}
void Information(CString &strLine)
{
CString strCommand;
int nCount;
FindStatement(strLine,strCommand);
strCommand.MakeLower();
strCommand.TrimRight();
CString strText;
if (strCommand.IsEmpty())
{
CommandPrintOn();
strText.Format("\n#%s%s%s Defined Commands%s:\n\n",
ANSI_RESET,
ANSI_BOLD,
ANSI_F_WHITE,
ANSI_RESET);
_terminal.Print(strText);
nCount = 0;
while(_commandList[nCount].proc)
nCount++;
strText.Format(" MM Commands: %d\n",nCount);
_terminal.Print(strText);
nCount = 0;
while(_procedureList[nCount].proc)
nCount++;
strText.Format(" MM Procs: %d\n\n",nCount);
_terminal.Print(strText);
strText.Format(" Version Check: %s\n\n",(_config.bCheckVersion ? "On" : "Off"));
_terminal.Print(strText);
strText.Format(" Actions: %d\n",_actions.GetCount());
_terminal.Print(strText);
strText.Format(" Aliases: %d\n",_aliases.GetCount());
_terminal.Print(strText);
strText.Format(" Arrays: %d\n",_arrays.GetCount());
_terminal.Print(strText);
strText.Format(" Bar Items: %d\n",_statusBar.GetCount());
_terminal.Print(strText);
strText.Format(" Events: %d\n",_events.GetCount());
_terminal.Print(strText);
strText.Format(" Gags: %d\n",_gags.GetCount());
_terminal.Print(strText);
strText.Format(" Highlights: %d\n",_highlights.GetCount());
_terminal.Print(strText);
strText.Format(" Lists: %d\n",_lists.GetCount());
_terminal.Print(strText);
strText.Format(" Macros: %d\n",_macros.GetCount());
_terminal.Print(strText);
strText.Format(" Substitutes: %d\n",_subs.GetCount());
_terminal.Print(strText);
strText.Format(" Tab List: %d\n",_tabList.GetCount());
_terminal.Print(strText);
strText.Format(" Variables: %d\n\n",_mapVars.GetCount());
_terminal.Print(strText);
_terminal.Print("Additional Information - /info paths, /info chat and /info sound\n\n");
CommandPrintOff();
return;
}
if (IsPartial(strCommand,"paths"))
{
CommandPrintOn();
strText.Format("\n#%s%s%s Paths%s:\n\n",
ANSI_RESET,
ANSI_BOLD,
ANSI_F_WHITE,
ANSI_RESET);
_terminal.Print(strText);
strText.Format(" Downloads: %s\n",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -