* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
- * Copyright 1995-2000 The LyX Team.
+ * Copyright 1995-2001 The LyX Team.
*
* ====================================================== */
#include "converter.h"
#include "language.h"
#include "support/os.h"
+// for NO_LATEX
+#if 1
+#include "lyxfont.h"
+#endif
using std::endl;
last_loaded = bufferlist.newFile("tmpfile", string());
// try to dispatch to last loaded buffer first
- bool dispatched = last_loaded->Dispatch(batch_command);
+ bool dispatched = last_loaded->dispatch(batch_command);
// if this was successful, return.
// Maybe we could do something more clever than aborting...
// otherwise, let the GUI handle the batch command
lyxGUI->regBuf(last_loaded);
- lyxGUI->getLyXView()->getLyXFunc()->Dispatch(batch_command);
+ lyxGUI->getLyXView()->getLyXFunc()->dispatch(batch_command);
// fall through...
}
searchpath= MakeAbsPath(system_lyxdir) + ';';
// LYX_DIR_11x environment variable
- string lyxdir = GetEnvPath("LYX_DIR_11x");
+ string const lyxdir = GetEnvPath("LYX_DIR_11x");
if (!lyxdir.empty()) {
lyxerr[Debug::INIT] << "LYX_DIR_11x: " << lyxdir << endl;
build_lyxdir.erase();
}
- bool FollowLink;
+ bool followlink;
do {
// Path of binary/../share/name of binary/
searchpath += NormalizePath(AddPath(binpath, "../share/") +
// Follow Symlinks
FileInfo file(fullbinpath, true);
- FollowLink = file.isLink();
- if (FollowLink) {
- string Link;
- if (LyXReadLink(fullbinpath, Link)) {
- fullbinpath = Link;
+ followlink = file.isLink();
+ if (followlink) {
+ string link;
+ if (LyXReadLink(fullbinpath, link)) {
+ fullbinpath = link;
binpath = MakeAbsPath(OnlyPath(fullbinpath));
}
else {
- FollowLink = false;
+ followlink = false;
}
}
- } while (FollowLink);
+ } while (followlink);
// Hardcoded dir
searchpath += LYX_DIR;
<<_("set the environment variable LYX_DIR_11x to the "
"LyX system directory ")
<< _("containing the file `chkconfig.ltx'.") << endl;
- if (!path_shown)
+ if (!path_shown) {
+ FileInfo fi(LYX_DIR);
+ if (!fi.exist()) {
+ lyxerr << "Couldn't even find the default LYX_DIR." << endl
+ << "Giving up." << endl;
+ exit(1);
+ }
lyxerr << _("Using built-in default ")
<< LYX_DIR << _(" but expect problems.")
<< endl;
- else
+ } else {
lyxerr << _("Expect problems.") << endl;
+ }
system_lyxdir = LYX_DIR;
path_shown = true;
}
// Read configuration files
//
- ReadRcFile("lyxrc.defaults");
+ readRcFile("lyxrc.defaults");
system_lyxrc = lyxrc;
system_formats = formats;
system_converters = converters;
// If there is a preferences file we read that instead
// of the old lyxrc file.
- if (!ReadRcFile("preferences"))
- ReadRcFile("lyxrc");
+ if (!readRcFile("preferences"))
+ readRcFile("lyxrc");
// Read encodings
- ReadEncodingsFile("encodings");
+ readEncodingsFile("encodings");
// Read languages
- ReadLanguagesFile("languages");
+ readLanguagesFile("languages");
// Load the layouts
lyxerr[Debug::INIT] << "Reading layouts..." << endl;
lyxrc.readBindFileIfNeeded();
// Read menus
- ReadUIFile(lyxrc.ui_file);
+ readUIFile(lyxrc.ui_file);
// Bind the X dead keys to the corresponding LyX functions if
// necessary.
first_start = false;
return;
} else {
- first_start = true;
+ first_start = !explicit_userdir;
}
- // Nope
- // Different wording if the user specifically requested a directory
- if (!AskQuestion( explicit_userdir
- ? _("You have specified an invalid LyX directory.")
- : _("You don't have a personal LyX directory.") ,
-
+ // If the user specified explicitely a directory, ask whether
+ // to create it (otherwise, always create it)
+ if (explicit_userdir &&
+ !AskQuestion(_("You have specified an invalid LyX directory."),
_("It is needed to keep your own configuration."),
_("Should I try to set it up for you (recommended)?"))) {
lyxerr << _("Running without personal LyX directory.") << endl;
// Read the rc file `name'
-bool LyX::ReadRcFile(string const & name)
+bool LyX::readRcFile(string const & name)
{
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
<< " in " << lyxrc_path << endl;
if (lyxrc.read(lyxrc_path) < 0) {
WriteAlert(_("LyX Warning!"),
- _("Error while reading ")+lyxrc_path+".",
+ _("Error while reading ") + lyxrc_path + ".",
_("Using built-in defaults."));
return false;
}
// Read the ui file `name'
-void LyX::ReadUIFile(string const & name)
+void LyX::readUIFile(string const & name)
{
enum Uitags {
ui_menuset = 1,
// Read the languages file `name'
-void LyX::ReadLanguagesFile(string const & name)
+void LyX::readLanguagesFile(string const & name)
{
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
// Read the encodings file `name'
-void LyX::ReadEncodingsFile(string const & name)
+void LyX::readEncodingsFile(string const & name)
{
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;