#include <config.h>
#include <version.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "lyx_main.h"
#include "support/filetools.h"
#include "lastfiles.h"
#include "encoding.h"
#include "converter.h"
+#include "format.h"
#include "lyxtextclasslist.h"
#include "frontends/Alert.h"
#include "frontends/lyx_gui.h"
+#include "BoostFormat.h"
#include <boost/function.hpp>
#include <cstdlib>
// if this should not be in this file, please also remove
// #include "graphics/GraphicsTypes.h" at the top -- Rob Lahaye.
grfx::setDisplayTranslator();
-
+
if (want_gui) {
lyx_gui::parse_init(argc, argv);
}
// other than documents
for (int argi = 1; argi < argc ; ++argi) {
if (argv[argi][0] == '-') {
+#if USE_BOOST_FORMAT
+ lyxerr << boost::format(_("Wrong command line option `%1$s'. Exiting."))
+ % argv[argi]
+ << endl;
+#else
lyxerr << _("Wrong command line option `")
- << argv[argi]
- << _("'. Exiting.") << endl;
+ << argv[argi] << _("'. Exiting.")
+ << endl;
+#endif
exit(1);
}
}
// Execute batch commands if available
if (!batch_command.empty()) {
lyxerr[Debug::INIT] << "About to handle -x '"
- << batch_command << "'" << endl;
+ << batch_command << '\'' << endl;
Buffer * last_loaded = 0;
FileInfo file(fullbinpath, true);
followlink = file.isLink();
if (followlink) {
- lyxerr << " directory " << fullbinpath
- << " is a link" << endl;
+ lyxerr[Debug::INIT] << " directory " << fullbinpath
+ << " is a link" << endl;
string link;
if (LyXReadLink(fullbinpath, link, true)) {
fullbinpath = link;
<< "Giving up." << endl;
exit(1);
}
- lyxerr << _("Using built-in default ")
- << LYX_DIR << _(" but expect problems.")
+#if USE_BOOST_FORMAT
+ lyxerr << boost::format(_("Using built-in default %1$s"
+ " but expect problems."))
+ % static_cast<char *>(LYX_DIR)
+ << endl;
+#else
+ lyxerr << _("Using built-in default ") << LYX_DIR
+ << _(" but expect problems.")
<< endl;
+#endif
} else {
lyxerr << _("Expect problems.") << endl;
}
// If there is a preferences file we read that instead
// of the old lyxrc file.
if (!readRcFile("preferences"))
- readRcFile("lyxrc");
+ readRcFile("lyxrc");
readEncodingsFile("encodings");
readLanguagesFile("languages");
// Read menus
readUIFile(lyxrc.ui_file);
- // Bind the X dead keys to the corresponding LyX functions if
- // necessary.
- if (lyxrc.override_x_deadkeys)
- deadKeyBindings(toplevel_keymap.get());
-
if (lyxerr.debugging(Debug::LYXRC)) {
lyxrc.print();
}
return;
}
+#if USE_BOOST_FORMAT
+ lyxerr << boost::format(_("LyX: Creating directory %1$s"
+ " and running configure..."))
+ % user_lyxdir
+ << endl;
+#else
lyxerr << _("LyX: Creating directory ") << user_lyxdir
- << _(" and running configure...") << endl;
+ << _(" and running configure...")
+ << endl;
+#endif
if (!createDirectory(user_lyxdir, 0755)) {
// Failed, let's use $HOME instead.
user_lyxdir = GetEnvPath("HOME");
- lyxerr << _("Failed. Will use ") << user_lyxdir
- << _(" instead.") << endl;
+#if USE_BOOST_FORMAT
+ lyxerr << boost::format(_("Failed. Will use %1$s instead."))
+ % user_lyxdir
+ << endl;
+#else
+ lyxerr << _("Failed. Will use ") << user_lyxdir <<
+ _(" instead.")
+ << endl;
+#endif
return;
}
lyxerr[Debug::INIT] << "Found " << name
<< " in " << lyxrc_path << endl;
if (lyxrc.read(lyxrc_path) < 0) {
+#if USE_BOOST_FORMAT
Alert::alert(_("LyX Warning!"),
- _("Error while reading ") + lyxrc_path + ".",
+ boost::io::str(boost::format(_("Error while reading %1$s.")) % lyxrc_path),
_("Using built-in defaults."));
+#else
+ Alert::alert(_("LyX Warning!"),
+ _("Error while reading ") + lyxrc_path,
+ _("Using built-in defaults."));
+#endif
return false;
}
return true;
string batch;
/// return the the number of arguments consumed
-typedef boost::function<int, string const &, string const &> cmd_helper;
+typedef boost::function<int(string const &, string const &)> cmd_helper;
int parse_dbg(string const & arg, string const &)
{
Debug::showTags(lyxerr);
exit(0);
}
+#if USE_BOOST_FORMAT
+ lyxerr << boost::format(_("Setting debug level to %1$s"))
+ % arg
+ << endl;
+#else
lyxerr << _("Setting debug level to ") << arg << endl;
+#endif
+
lyxerr.level(Debug::value(arg));
Debug::showLevel(lyxerr, lyxerr.level());
return 1;
exit(1);
}
- batch = "buffer-import " + type + " " + file;
+ batch = "buffer-import " + type + ' ' + file;
return 2;
}