using std::system;
#endif
-namespace grfx = lyx::graphics;
-
extern void LoadLyXFile(string const &);
extern void QuitLyX();
string system_lyxdir;
string build_lyxdir;
-string system_tempdir;
string user_lyxdir;
DebugStream lyxerr;
// we need to parse for "-dbg" and "-help"
bool const want_gui = easyParse(argc, argv);
- // Global bindings (this must be done as early as possible.) (Lgb)
- toplevel_keymap.reset(new kb_keymap);
- defaultKeyBindings(toplevel_keymap.get());
-
// set the DisplayTranslator only once; should that be done here??
// if this should not be in this file, please also remove
// #include "graphics/GraphicsTypes.h" at the top -- Rob Lahaye.
- grfx::setDisplayTranslator();
+ lyx::graphics::setDisplayTranslator();
if (want_gui) {
lyx_gui::parse_init(argc, argv);
}
}
- bool success = false;
-
// try to dispatch to last loaded buffer first
- if (last_loaded)
- last_loaded->dispatch(batch_command, &success);
- else
- lyxerr << _("Batch command specified but no "
- "file loaded. Exiting.") << endl;
-
- QuitLyX();
- exit(!success);
+ if (last_loaded) {
+ bool success = false;
+ if (last_loaded->dispatch(batch_command, &success)) {
+ QuitLyX();
+ exit(!success);
+ }
+ }
+ files.clear(); // the files are already loaded
}
lyx_gui::start(batch_command, files);
lyxerr[Debug::INIT] << "Reading layouts..." << endl;
LyXSetStyle();
- // Ensure that we have really read a bind file, so that LyX is
- // usable.
- lyxrc.readBindFileIfNeeded();
+ if (gui) {
+ // Set up bindings
+ toplevel_keymap.reset(new kb_keymap);
+ defaultKeyBindings(toplevel_keymap.get());
+ toplevel_keymap->read(lyxrc.bind_file);
- // Read menus
- readUIFile(lyxrc.ui_file);
+ // Read menus
+ readUIFile(lyxrc.ui_file);
+ }
if (lyxerr.debugging(Debug::LYXRC))
lyxrc.print();
os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path));
- system_tempdir = os::getTmpDir();
if (lyxerr.debugging(Debug::INIT)) {
- lyxerr << "LyX tmp dir: `" << system_tempdir << '\'' << endl;
+ lyxerr << "LyX tmp dir: `" << os::getTmpDir() << '\'' << endl;
}
lyxerr[Debug::INIT] << "Reading lastfiles `"