#include "converter.h"
#include "format.h"
#include "gettext.h"
+#include "lastfiles.h"
#include "LColor.h"
#include "lyxlex.h"
#include "lyxfont.h"
+#include "mover.h"
#include "graphics/GraphicsTypes.h"
#include "support/filetools.h"
#include "support/lstrings.h"
-#include "support/translator.h"
#include "support/tostr.h"
#include "support/userinfo.h"
using lyx::support::ascii_lowercase;
+using lyx::support::bformat;
using lyx::support::ExpandPath;
using lyx::support::GetEnv;
using lyx::support::LibFileSearch;
{ "\\check_lastfiles", LyXRC::RC_CHECKLASTFILES },
{ "\\chktex_command", LyXRC::RC_CHKTEX_COMMAND },
{ "\\converter", LyXRC::RC_CONVERTER },
+ { "\\copier", LyXRC::RC_COPIER },
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
{ "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
{ "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
{ "\\escape_chars", LyXRC::RC_ESC_CHARS },
{ "\\font_encoding", LyXRC::RC_FONT_ENCODING },
{ "\\format", LyXRC::RC_FORMAT },
+ { "\\index_command", LyXRC::RC_INDEX_COMMAND },
{ "\\input", LyXRC::RC_INPUT },
{ "\\kbmap", LyXRC::RC_KBMAP },
{ "\\kbmap_primary", LyXRC::RC_KBMAP_PRIMARY },
chktex_command = "chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38";
bibtex_command = "bibtex";
fontenc = "default";
+ index_command = "makeindex -c -q";
dpi = 75;
// Because a screen typically is wider than a piece of paper:
zoom = 150;
auto_region_delete = true;
auto_reset_options = false;
ascii_linelen = 65;
- num_lastfiles = 4;
+ num_lastfiles = maxlastfiles;
check_lastfiles = true;
make_backup = true;
backupdir_path.erase();
}
break;
+ case RC_INDEX_COMMAND:
+ if (lexrc.next()) {
+ index_command = lexrc.getString();
+ }
+ break;
+
case RC_SCREEN_DPI:
if (lexrc.next()) {
dpi = lexrc.getInteger();
}
break;
+ case RC_COPIER: {
+ string fmt, command;
+ if (lexrc.next()) {
+ fmt = lexrc.getString();
+ }
+ if (lexrc.next()) {
+ command = lexrc.getString();
+ }
+ movers.set(fmt, command);
+ break;
+ }
+
case RC_CONVERTER: {
string from, to, command, flags;
if (lexrc.next()) {
}
+struct SameMover {
+ typedef std::pair<std::string, SpecialisedMover> Data;
+
+ SameMover(Data const & comparison)
+ : comparison_(comparison) {}
+
+ bool operator()(Data const & data) const
+ {
+ return data.first == comparison_.first &&
+ data.second.command() == comparison_.second.command();
+ }
+
+private:
+ Data comparison_;
+};
+
+
void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
{
os << "### This file is part of\n"
bibtex_command != system_lyxrc.bibtex_command) {
os << "\\bibtex_command \"" << bibtex_command << "\"\n";
}
+ case RC_INDEX_COMMAND:
+ if (ignore_system_lyxrc ||
+ index_command != system_lyxrc.index_command) {
+ os << "\\index_command \"" << index_command << "\"\n";
+ }
case RC_KBMAP:
if (ignore_system_lyxrc ||
use_kbmap != system_lyxrc.use_kbmap) {
os << "\\converter \"" << cit->from
<< "\" \"" << cit->to << "\" \"\" \"\"\n";
+ case RC_COPIER:
+ os << "\n#\n"
+ << "# COPIERS SECTION ##########################\n"
+ << "#\n\n";
+
+ // Look for new movers
+ Movers::iterator const sysbegin = system_movers.begin();
+ Movers::iterator const sysend = system_movers.end();
+
+ for (Movers::iterator it = movers.begin(), end = movers.end();
+ it != end; ++it) {
+ Movers::iterator const sysit =
+ std::find_if(sysbegin, sysend, SameMover(*it));
+ if (sysit == sysend) {
+ std::string const & fmt = it->first;
+ std::string const & command =
+ it->second.command();
+
+ os << "\\copier " << fmt
+ << " \"" << command << "\"\n";
+ }
+ }
+
+ // We don't actually delete SpecialisedMover(s) from the
+ // map, just clear their 'command', so there's no need
+ // to test for anything else.
}
+
os.flush();
}
break;
case RC_NUMLASTFILES:
- str = _("Maximal number of lastfiles. Up to 9 can appear in the file menu.");
+ str = bformat(_("Maximal number of lastfiles. Up to %1$s can appear in the file menu."), tostr(maxlastfiles));
break;
case RC_CHECKLASTFILES:
break;
case RC_BIBTEX_COMMAND:
- str = _("Define the options of bibtex (cf. man bibtex) or select and alternative compiler (e.g. mlbibtex or bibulus).");
+ str = _("Define the options of bibtex (cf. man bibtex) or select an alternative compiler (e.g. mlbibtex or bibulus).");
+ break;
+
+ case RC_INDEX_COMMAND:
+ str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler. E.g., using xindy/make-rules, the command string would be \"makeindex.sh -m $$lang\".");
break;
case RC_CURSOR_FOLLOWS_SCROLLBAR: