!!!The following new LyX functions have been introduced in 2.4:
+* bibtex-database-list: output a list of all bibtex files used in the current buffer.
+ The function outputs absolute paths in the OS style and separated by the os-specific
+ path separator. This function is intended for bibliography managers.
+
* buffer-reset-export advises LyX to remove the auxiliary files before doing the next
export.
#include "Buffer.h"
#include "BufferList.h"
#include "BufferParams.h"
+#include "BiblioInfo.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "CutAndPaste.h"
#include "support/convert.h"
#include "support/debug.h"
#include "support/docstring.h"
+#include "support/docstring_list.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lassert.h"
case LFUN_SCREEN_SHOW_CURSOR:
case LFUN_BIBTEX_DATABASE_ADD:
case LFUN_BIBTEX_DATABASE_DEL:
+ case LFUN_BIBTEX_DATABASE_LIST:
case LFUN_STATISTICS:
case LFUN_KEYMAP_OFF:
case LFUN_KEYMAP_PRIMARY:
break;
}
+ case LFUN_BIBTEX_DATABASE_LIST: {
+ docstring_list const & files = buffer_.getBibfiles();
+ bool first = true;
+ docstring result;
+ char const separator(os::path_separator());
+ for (auto const & file : files) {
+ if (first)
+ first = false;
+ else
+ result += separator;
+
+ FileName const fn = buffer_.getBibfilePath(file);
+ string const path = fn.realPath();
+ result += from_utf8(os::external_path(path));
+ }
+ dr.setMessage(result);
+ break;
+ }
+
case LFUN_STATISTICS: {
DocIterator from, to;
if (cur.selection()) {
string icstr = InsetCommand::params2string(icp);
FuncRequest fr(LFUN_INSET_INSERT, icstr);
lyx::dispatch(fr);
+
+ // if the request comes from the LyX server, then we
+ // return a list of the undefined keys, in case some
+ // action could be taken.
+ if (cmd.origin() != FuncRequest::LYXSERVER)
+ break;
+
+ vector<docstring> keys = getVectorFromString(from_utf8(arg));
+ vector<docstring>::iterator it = keys.begin();
+ vector<docstring>::const_iterator end = keys.end();
+
+ BiblioInfo const & bibInfo = buffer_.masterBibInfo();
+ const BiblioInfo::const_iterator bibEnd = bibInfo.end();
+ while (it != end) {
+ if (bibInfo.find(*it) != bibEnd) {
+ it = keys.erase(it);
+ end = keys.end();
+ } else
+ ++it;
+ }
+ dr.setMessage(getStringFromVector(keys));
+
break;
}
*/
{ LFUN_BIBTEX_DATABASE_DEL, "bibtex-database-del", Noop, Edit },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_BIBTEX_DATABASE_LIST
+ * \li Action: Lists the available databases (separated by path separator common
+ * on the used OS).
+ * \li Notion: Used by bibliographic managers
+ * \li Syntax: bibtex-database-list
+ * \li Origin: bpiwowar, 11 june 2012
+ * \endvar
+ */
+ { LFUN_BIBTEX_DATABASE_LIST, "bibtex-database-list", ReadOnly, System },
/*!
* \var lyx::FuncCode lyx::LFUN_BOOKMARK_CLEAR