From 2719b0fc43a54b6710d8fa7f7ac88291ff9a4f8b Mon Sep 17 00:00:00 2001 From: David Freese Date: Thu, 6 Dec 2012 11:00:11 -0600 Subject: [PATCH] Macros LOG LNW EXEC * Added :[notes] string to LOG and LNW macro tags - - the specified text will be appended to the notes field as the string "\nappend this text" before saving the log data and behave as before. * Added post execute expansion of returned macro text. Restores ability to include macro tags such as in the returned text. The macro tag will then be expanded before transmission. --- src/misc/macroedit.cxx | 7 +++++-- src/misc/macros.cxx | 23 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/misc/macroedit.cxx b/src/misc/macroedit.cxx index 7a67cdfe..4f4dfae0 100644 --- a/src/misc/macroedit.cxx +++ b/src/misc/macroedit.cxx @@ -101,9 +101,12 @@ void loadBrowser(Fl_Widget *widget) { #endif w->add(LINE_SEP); - w->add(_("\tsave QSO data")); - w->add(_("\tlog at xmt time")); w->add(_("\tclear log fields")); + w->add(_("\tsave QSO data")); + w->add(_("\tsaveQSO data, append msg to notes")); + w->add(_("\tlog at xmt time")); + w->add(_("\tsaveQSO data, append msg to notes")); + w->add(_("\tlog eQSL")); w->add(_("\tlog eQSL optional msg")); w->add(LINE_SEP); diff --git a/src/misc/macros.cxx b/src/misc/macros.cxx index 828ac31c..93a627d3 100644 --- a/src/misc/macros.cxx +++ b/src/misc/macros.cxx @@ -860,8 +860,15 @@ static void pLOG(std::string &s, size_t &i, size_t endbracket) s.replace(i, endbracket - i + 1, ""); return; } + size_t start = s.find(':', i); + if (start != std::string::npos) { + string msg = inpNotes->value(); + if (!msg.empty()) msg.append("\n"); + msg.append(s.substr(start + 1, endbracket-start-1)); + inpNotes->value(msg.c_str()); + } + s.replace(i, endbracket - i + 1, ""); qsoSave_cb(0, 0); - s.replace(i, 5, ""); } static void pLNW(std::string &s, size_t &i, size_t endbracket) @@ -870,7 +877,14 @@ static void pLNW(std::string &s, size_t &i, size_t endbracket) s.replace(i, endbracket - i + 1, ""); return; } - s.replace(i, 5, "^L"); + size_t start = s.find(':', i); + if (start != std::string::npos) { + string msg = inpNotes->value(); + if (!msg.empty()) msg.append("\n"); + msg.append(s.substr(start + 1, endbracket-start-1)); + inpNotes->value(msg.c_str()); + } + s.replace(i, endbracket - i + 1, "^L"); } static void pCLRLOG(std::string &s, size_t &i, size_t endbracket) @@ -1697,6 +1711,7 @@ static void pEXEC(std::string &s, size_t &i, size_t endbracket) lnbuff.erase(lnbuff.length()-1,1); if (!lnbuff.empty()) { + lnbuff = m.expandMacro(lnbuff, false); s.insert(i, lnbuff); i += lnbuff.length(); } else @@ -1955,8 +1970,8 @@ static const MTAGS mtags[] = { {"", pXBEG}, {"", pXEND}, {"", pSAVEXCHG}, -{"", pLOG}, -{"", pLNW}, +{"", pCLRLOG}, {"