The LyXRC::prepend_path patch as tested on the Mac by Andreas.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9485 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-01-16 21:01:41 +00:00
parent b60b6c6fb5
commit 3f938d4dbf
16 changed files with 815 additions and 486 deletions

View File

@ -1,3 +1,18 @@
2005-01-16 Angus Leeming <leeming@lyx.org>
* lyx_main.[Ch] (init): rewrite code to prepend the CWD to the PATH
for MacOSX and Windows to use prependEnvPath.
Strip out the hard-coded block to add elements to the PATH for
MacOSX and replace it with a call to prependEnvPath using the
contents of LyXRC::path_prefix.
(queryUserLyXDir): strip out the code to run reconfigure, instead
returning a boolean indicating the necessity to do so.
(reconfigureUserLyXDir): contains the code to reconfigure the
user support directory. Is now called after the various LyXRC data
files have been read.
* lyxrc.[Ch]: add path_prefix var and code to read/write it.
2005-01-14 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* converter.[Ch] (convert): take a new parameter try_default. Use

View File

@ -1,3 +1,8 @@
2005-01-15 Angus Leeming <leeming@lyx.org>
* QPrefs.C, QPrefsDialog.C, ui/QPrefPathsModule.ui: add an interface
to modify LyXRC::path_prefix.
2005-01-15 Angus Leeming <leeming@lyx.org>
* ui/Makefile.am: enable Qt's uic to process the .ui files

View File

@ -244,6 +244,7 @@ void QPrefs::apply()
rc.template_path = fromqstr(pathsmod->templateDirED->text());
rc.backupdir_path = fromqstr(pathsmod->backupDirED->text());
rc.tempdir_path = fromqstr(pathsmod->tempDirED->text());
rc.path_prefix = fromqstr(pathsmod->pathPrefixED->text());
// FIXME: should be a checkbox only
rc.lyxpipes = fromqstr(pathsmod->lyxserverDirED->text());
@ -560,10 +561,10 @@ void QPrefs::update_contents()
pathsmod->templateDirED->setText(toqstr(rc.template_path));
pathsmod->backupDirED->setText(toqstr(rc.backupdir_path));
pathsmod->tempDirED->setText(toqstr(rc.tempdir_path));
pathsmod->pathPrefixED->setText(toqstr(rc.path_prefix));
// FIXME: should be a checkbox only
pathsmod->lyxserverDirED->setText(toqstr(rc.lyxpipes));
QPrefSpellcheckerModule * spellmod(dialog_->spellcheckerModule);
spellmod->spellCommandCO->setCurrentItem(0);

View File

@ -248,6 +248,7 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
connect(pathsModule->backupDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(pathsModule->tempDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(pathsModule->lyxserverDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(pathsModule->pathPrefixED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(spellcheckerModule->spellCommandCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(spellcheckerModule->altLanguageED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(spellcheckerModule->escapeCharactersED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));

View File

@ -13,8 +13,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>294</width>
<height>196</height>
<width>387</width>
<height>329</height>
</rect>
</property>
<property stdset="1">
@ -34,7 +34,7 @@
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</cstring>
<cstring>Layout3</cstring>
</property>
<grid>
<property stdset="1">
@ -52,110 +52,6 @@
<cstring>tempDirED</cstring>
</property>
</widget>
<widget row="1" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>templateDirPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Browse...</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>workingDirED</cstring>
</property>
</widget>
<widget row="4" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>tempDirPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Browse...</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>templateDirED</cstring>
</property>
</widget>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>backupDirLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Backup directory:</string>
</property>
<property>
<name>buddy</name>
<cstring>backupDirED</cstring>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>templateDirLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Document templates:</string>
</property>
<property>
<name>buddy</name>
<cstring>templateDirED</cstring>
</property>
</widget>
<widget row="3" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>lyxserverDirLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Ly&amp;XServer pipe:</string>
</property>
<property>
<name>buddy</name>
<cstring>lyxserverDirED</cstring>
</property>
</widget>
<widget row="4" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>tempDirLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Temporary directory:</string>
</property>
<property>
<name>buddy</name>
<cstring>tempDirED</cstring>
</property>
</widget>
<widget row="3" column="2" >
<class>QPushButton</class>
<property stdset="1">
@ -171,6 +67,28 @@
<bool>false</bool>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>templateDirLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Document templates:</string>
</property>
<property>
<name>buddy</name>
<cstring>templateDirED</cstring>
</property>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>workingDirED</cstring>
</property>
</widget>
<widget row="2" column="1" >
<class>QLineEdit</class>
<property stdset="1">
@ -178,19 +96,49 @@
<cstring>backupDirED</cstring>
</property>
</widget>
<widget row="0" column="2" >
<class>QPushButton</class>
<widget row="2" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>workingDirPB</cstring>
<cstring>backupDirLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Browse...</string>
<string>&amp;Backup directory:</string>
</property>
<property>
<name>buddy</name>
<cstring>backupDirED</cstring>
</property>
</widget>
<widget row="4" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>tempDirLA</cstring>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
<name>text</name>
<string>&amp;Temporary directory:</string>
</property>
<property>
<name>buddy</name>
<cstring>tempDirED</cstring>
</property>
</widget>
<widget row="5" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>pathPrefixLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;PATH prefix:</string>
</property>
<property>
<name>buddy</name>
<cstring>pathPrefixED</cstring>
</property>
</widget>
<widget row="0" column="0" >
@ -208,6 +156,28 @@
<cstring>workingDirED</cstring>
</property>
</widget>
<widget row="0" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>workingDirPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Browse...</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>templateDirED</cstring>
</property>
</widget>
<widget row="3" column="1" >
<class>QLineEdit</class>
<property stdset="1">
@ -215,6 +185,21 @@
<cstring>lyxserverDirED</cstring>
</property>
</widget>
<widget row="4" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>tempDirPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Browse...</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
</widget>
<widget row="2" column="2" >
<class>QPushButton</class>
<property stdset="1">
@ -230,6 +215,43 @@
<bool>false</bool>
</property>
</widget>
<widget row="5" column="1" rowspan="1" colspan="2" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>pathPrefixED</cstring>
</property>
</widget>
<widget row="1" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>templateDirPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Browse...</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
</widget>
<widget row="3" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>lyxserverDirLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Ly&amp;XServer pipe:</string>
</property>
<property>
<name>buddy</name>
<cstring>lyxserverDirED</cstring>
</property>
</widget>
</grid>
</widget>
<spacer>

View File

@ -1,3 +1,8 @@
2005-01-15 Angus Leeming <leeming@lyx.org>
* FormPreferences.C, forms/form_preferences.fd: add an interface
to modify LyXRC::path_prefix.
2005-01-13 Angus Leeming <leeming@lyx.org>
* FormPreferences.C: code to get/set the value

View File

@ -2193,6 +2193,7 @@ void FormPreferences::Paths::apply(LyXRC & rc)
rc.document_path = getString(dialog_->input_default_path);
rc.template_path = getString(dialog_->input_template_path);
rc.tempdir_path = getString(dialog_->input_temp_dir);
rc.path_prefix = getString(dialog_->input_path_prefix);
int button = fl_get_button(dialog_->check_last_files);
string str = getString(dialog_->input_lastfiles);
@ -2225,6 +2226,7 @@ void FormPreferences::Paths::build()
fl_set_input_return(dialog_->input_default_path, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->input_template_path, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->input_temp_dir, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->input_path_prefix, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->input_lastfiles, FL_RETURN_CHANGED);
fl_set_input_return(dialog_->input_backup_path, FL_RETURN_CHANGED);
fl_set_counter_bounds(dialog_->counter_lastfiles, 0, maxlastfiles);
@ -2235,6 +2237,7 @@ void FormPreferences::Paths::build()
setPrehandler(dialog_->input_default_path);
setPrehandler(dialog_->counter_lastfiles);
setPrehandler(dialog_->input_template_path);
setPrehandler(dialog_->input_path_prefix);
setPrehandler(dialog_->check_last_files);
setPrehandler(dialog_->input_lastfiles);
setPrehandler(dialog_->check_make_backups);
@ -2265,6 +2268,10 @@ FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
return LyXRC::getDescription(LyXRC::RC_BACKUPDIR_PATH);
if (ob == dialog_->input_serverpipe)
return LyXRC::getDescription(LyXRC::RC_SERVERPIPE);
if (ob == dialog_->input_path_prefix)
return _("Specify those directories which should be"
"prepended to the PATH environment variable. "
"Use the OS native format.");
return string();
}
@ -2400,6 +2407,7 @@ void FormPreferences::Paths::update(LyXRC const & rc)
fl_set_input(dialog_->input_backup_path, str.c_str());
fl_set_input(dialog_->input_temp_dir, rc.tempdir_path.c_str());
fl_set_input(dialog_->input_path_prefix, rc.path_prefix.c_str());
str.erase();
if (rc.check_lastfiles)

View File

@ -2155,7 +2155,7 @@ argument: 0
Name: form_preferences_paths
Width: 450
Height: 350
Number of Objects: 16
Number of Objects: 17
--------------------
class: FL_BOX
@ -2451,6 +2451,24 @@ name: button_serverpipe_browse
callback: C_FormDialogView_InputCB
argument: 0
--------------------
class: FL_INPUT
type: NORMAL_INPUT
box: 170 285 170 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: PATH prefix:|#T
shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: input_path_prefix
callback: C_FormDialogView_InputCB
argument: 0
=============== FORM ===============
Name: form_preferences_inputs_misc
Width: 450

View File

@ -69,6 +69,7 @@ using lyx::support::i18nLibFileSearch;
using lyx::support::LibFileSearch;
using lyx::support::package;
using lyx::support::Path;
using lyx::support::prependEnvPath;
using lyx::support::QuoteName;
using lyx::support::rtrim;
@ -111,6 +112,20 @@ void showFileError(string const & error)
exit(EXIT_FAILURE);
}
void reconfigureUserLyXDir()
{
string const configure_script =
AddName(package().system_support(), "configure");
string const configure_command =
"sh " + QuoteName(configure_script);
lyxerr << _("LyX: reconfiguring user directory") << endl;
Path p(package().user_support());
::system(configure_command.c_str());
lyxerr << "LyX: " << _("Done!") << endl;
}
} // namespace anon
@ -346,26 +361,16 @@ void LyX::init(bool gui)
#if !defined (USE_POSIX_PACKAGING)
// Add the directory containing the LyX executable to the path
// so that LyX can find things like reLyX.
if (package.build_support().empty()) {
vector<string> path = getEnvPath("PATH");
path.insert(path.begin(), package.binary_dir());
setEnvPath("PATH", path);
}
#endif
#if defined (USE_MACOSX_PACKAGING)
// This hard-coded nastiness should be moved into a LyXRC variable.
vector<string> path = getEnvPath("PATH");
path.insert(path.begin(), "/usr/local/teTeX/bin/powerpc-apple-darwin-current");
path.insert(path.begin(), "/usr/local/bin");
path.insert(path.begin(), "/sw/bin");
lyxerr[Debug::INIT] << "Running from LyX/Mac bundle. "
"Setting PATH to: " << GetEnv("PATH") << endl;
if (package.build_support().empty())
prependEnvPath("PATH", package.binary_dir());
#endif
// Check that user LyX directory is ok. We don't do that if
// running in batch mode.
bool reconfigure = false;
if (gui) {
queryUserLyXDir(package().explicit_user_support());
reconfigure =
queryUserLyXDir(package().explicit_user_support());
} else {
first_start = false;
}
@ -430,7 +435,17 @@ void LyX::init(bool gui)
if (lyxerr.debugging(Debug::LYXRC))
lyxrc.print();
package().document_dir() = lyxrc.document_path;
os::cygwin_path_fix(lyxrc.cygwin_path_fix);
prependEnvPath("PATH", lyxrc.path_prefix);
// Having reset the PATH we're now in a position to run configure
// if necessary.
if (reconfigure)
reconfigureUserLyXDir();
FileInfo fi(lyxrc.document_path);
if (fi.isOK() && fi.isDir())
package().document_dir() = lyxrc.document_path;
package().temp_dir() = createLyXTmpDir(lyxrc.tempdir_path);
if (package().temp_dir().empty()) {
@ -552,26 +567,23 @@ void LyX::deadKeyBindings(kb_keymap * kbmap)
}
void LyX::queryUserLyXDir(bool explicit_userdir)
bool LyX::queryUserLyXDir(bool explicit_userdir)
{
string const configure_script = AddName(package().system_support(), "configure");
string const configure_command = "sh " + QuoteName(configure_script);
bool reconfigure = false;
// Does user directory exist?
FileInfo fileInfo(package().user_support());
if (fileInfo.isOK() && fileInfo.isDir()) {
first_start = false;
string const configure_script =
AddName(package().system_support(), "configure");
FileInfo script(configure_script);
FileInfo defaults(AddName(package().user_support(), "lyxrc.defaults"));
if (defaults.isOK() && script.isOK()
&& defaults.getModificationTime() < script.getModificationTime()) {
lyxerr << _("LyX: reconfiguring user directory")
<< endl;
Path p(package().user_support());
::system(configure_command.c_str());
lyxerr << "LyX: " << _("Done!") << endl;
reconfigure = true;
}
return;
return reconfigure;
}
first_start = !explicit_userdir;
@ -592,8 +604,10 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
exit(1);
}
lyxerr << bformat(_("LyX: Creating directory %1$s"
" and running configure..."), package().user_support()) << endl;
lyxerr << bformat(_("LyX: Creating directory %1$s"),
package().user_support())
<< endl;
reconfigure = true;
if (!createDirectory(package().user_support(), 0755)) {
// Failed, so let's exit.
@ -602,10 +616,7 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
exit(1);
}
// Run configure in user lyx directory
Path p(package().user_support());
::system(configure_command.c_str());
lyxerr << "LyX: " << _("Done!") << endl;
return reconfigure;
}

View File

@ -61,8 +61,13 @@ private:
void defaultKeyBindings(kb_keymap * kbmap);
/// set up the default dead key bindings if requested
void deadKeyBindings(kb_keymap * kbmap);
/// check, set up and configure the user dir if necessary
void queryUserLyXDir(bool explicit_userdir);
/** Check for the existence of the user's support directory and,
* if not present, create it. Exits the program if the directory
* cannot be created.
* \returns true if the user-side configuration script
* (lib/configure) should be re-run in this directory.
*/
bool queryUserLyXDir(bool explicit_userdir);
/// read lyxrc/preferences
void readRcFile(std::string const & name);
/// read the given ui (menu/toolbar) file

View File

@ -650,6 +650,9 @@ void loadTextclass(string const & name)
}
}
void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
} //namespace anon
@ -1486,6 +1489,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
break;
case LFUN_LYXRC_APPLY: {
LyXRC const lyxrc_orig = lyxrc;
istringstream ss(argument);
bool const success = lyxrc.read(ss) == 0;
@ -1493,7 +1498,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
lyxerr << "Warning in LFUN_LYXRC_APPLY!\n"
<< "Unable to read lyxrc data"
<< endl;
break;
}
actOnUpdatedPrefs(lyxrc_orig, lyxrc);
break;
}
@ -1854,3 +1862,139 @@ bool LyXFunc::wasMetaKey() const
{
return (meta_fake_bit != key_modifier::none);
}
namespace {
void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
{
// Why the switch you might ask. It is a trick to ensure that all
// the elements in the LyXRCTags enum is handled. As you can see
// there are no breaks at all. So it is just a huge fall-through.
// The nice thing is that we will get a warning from the compiler
// if we forget an element.
LyXRC::LyXRCTags tag = LyXRC::RC_LAST;
switch (tag) {
case LyXRC::RC_ACCEPT_COMPOUND:
case LyXRC::RC_ALT_LANG:
case LyXRC::RC_ASCIIROFF_COMMAND:
case LyXRC::RC_ASCII_LINELEN:
case LyXRC::RC_AUTOREGIONDELETE:
case LyXRC::RC_AUTORESET_OPTIONS:
case LyXRC::RC_AUTOSAVE:
case LyXRC::RC_AUTO_NUMBER:
case LyXRC::RC_BACKUPDIR_PATH:
case LyXRC::RC_BIBTEX_COMMAND:
case LyXRC::RC_BINDFILE:
case LyXRC::RC_CHECKLASTFILES:
case LyXRC::RC_CHKTEX_COMMAND:
case LyXRC::RC_CONVERTER:
case LyXRC::RC_COPIER:
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
case LyXRC::RC_CUSTOM_EXPORT_COMMAND:
case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
case LyXRC::RC_CYGWIN_PATH_FIX:
if (lyxrc_orig.cygwin_path_fix != lyxrc_new.cygwin_path_fix) {
namespace os = lyx::support::os;
os::cygwin_path_fix(lyxrc_new.cygwin_path_fix);
}
case LyXRC::RC_DATE_INSERT_FORMAT:
case LyXRC::RC_DEFAULT_LANGUAGE:
case LyXRC::RC_DEFAULT_PAPERSIZE:
case LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN:
case LyXRC::RC_DISPLAY_GRAPHICS:
case LyXRC::RC_DOCUMENTPATH:
if (lyxrc_orig.document_path != lyxrc_new.document_path) {
FileInfo fi(lyxrc_new.document_path);
if (fi.isOK() && fi.isDir()) {
using lyx::support::package;
package().document_dir() = lyxrc.document_path;
}
}
case LyXRC::RC_ESC_CHARS:
case LyXRC::RC_FONT_ENCODING:
case LyXRC::RC_FORMAT:
case LyXRC::RC_INDEX_COMMAND:
case LyXRC::RC_INPUT:
case LyXRC::RC_KBMAP:
case LyXRC::RC_KBMAP_PRIMARY:
case LyXRC::RC_KBMAP_SECONDARY:
case LyXRC::RC_LABEL_INIT_LENGTH:
case LyXRC::RC_LANGUAGE_AUTO_BEGIN:
case LyXRC::RC_LANGUAGE_AUTO_END:
case LyXRC::RC_LANGUAGE_COMMAND_BEGIN:
case LyXRC::RC_LANGUAGE_COMMAND_END:
case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
case LyXRC::RC_LANGUAGE_PACKAGE:
case LyXRC::RC_LANGUAGE_USE_BABEL:
case LyXRC::RC_LASTFILES:
case LyXRC::RC_MAKE_BACKUP:
case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
case LyXRC::RC_NUMLASTFILES:
case LyXRC::RC_PATH_PREFIX:
if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
using lyx::support::prependEnvPath;
prependEnvPath("PATH", lyxrc.path_prefix);
}
case LyXRC::RC_PERS_DICT:
case LyXRC::RC_POPUP_BOLD_FONT:
case LyXRC::RC_POPUP_FONT_ENCODING:
case LyXRC::RC_POPUP_NORMAL_FONT:
case LyXRC::RC_PREVIEW:
case LyXRC::RC_PREVIEW_HASHED_LABELS:
case LyXRC::RC_PREVIEW_SCALE_FACTOR:
case LyXRC::RC_PRINTCOLLCOPIESFLAG:
case LyXRC::RC_PRINTCOPIESFLAG:
case LyXRC::RC_PRINTER:
case LyXRC::RC_PRINTEVENPAGEFLAG:
case LyXRC::RC_PRINTEXSTRAOPTIONS:
case LyXRC::RC_PRINTFILEEXTENSION:
case LyXRC::RC_PRINTLANDSCAPEFLAG:
case LyXRC::RC_PRINTODDPAGEFLAG:
case LyXRC::RC_PRINTPAGERANGEFLAG:
case LyXRC::RC_PRINTPAPERDIMENSIONFLAG:
case LyXRC::RC_PRINTPAPERFLAG:
case LyXRC::RC_PRINTREVERSEFLAG:
case LyXRC::RC_PRINTSPOOL_COMMAND:
case LyXRC::RC_PRINTSPOOL_PRINTERPREFIX:
case LyXRC::RC_PRINTTOFILE:
case LyXRC::RC_PRINTTOPRINTER:
case LyXRC::RC_PRINT_ADAPTOUTPUT:
case LyXRC::RC_PRINT_COMMAND:
case LyXRC::RC_RTL_SUPPORT:
case LyXRC::RC_SCREEN_DPI:
case LyXRC::RC_SCREEN_FONT_ENCODING:
case LyXRC::RC_SCREEN_FONT_ROMAN:
case LyXRC::RC_SCREEN_FONT_ROMAN_FOUNDRY:
case LyXRC::RC_SCREEN_FONT_SANS:
case LyXRC::RC_SCREEN_FONT_SANS_FOUNDRY:
case LyXRC::RC_SCREEN_FONT_SCALABLE:
case LyXRC::RC_SCREEN_FONT_SIZES:
case LyXRC::RC_SCREEN_FONT_TYPEWRITER:
case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
case LyXRC::RC_SCREEN_ZOOM:
case LyXRC::RC_SERVERPIPE:
case LyXRC::RC_SET_COLOR:
case LyXRC::RC_SHOW_BANNER:
case LyXRC::RC_SPELL_COMMAND:
case LyXRC::RC_TEMPDIRPATH:
case LyXRC::RC_TEMPLATEPATH:
case LyXRC::RC_UIFILE:
case LyXRC::RC_USER_EMAIL:
case LyXRC::RC_USER_NAME:
case LyXRC::RC_USETEMPDIR:
case LyXRC::RC_USE_ALT_LANG:
case LyXRC::RC_USE_ESC_CHARS:
case LyXRC::RC_USE_INP_ENC:
case LyXRC::RC_USE_PERS_DICT:
case LyXRC::RC_USE_SPELL_LIB:
case LyXRC::RC_VIEWDVI_PAPEROPTION:
case LyXRC::RC_VIEWER:
case LyXRC::RC_WHEEL_JUMP:
case LyXRC::RC_LAST:
break;
}
}
} // namespace anon

View File

@ -36,7 +36,6 @@
#include "support/convert.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/os.h"
#include "support/userinfo.h"
using lyx::support::ascii_lowercase;
@ -46,8 +45,6 @@ using lyx::support::GetEnv;
using lyx::support::LibFileSearch;
using lyx::support::token;
namespace os = lyx::support::os;
using std::cout;
using std::endl;
@ -107,6 +104,7 @@ keyword_item lyxrcTags[] = {
{ "\\make_backup", LyXRC::RC_MAKE_BACKUP },
{ "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
{ "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
{ "\\path_prefix", LyXRC::RC_PATH_PREFIX },
{ "\\personal_dictionary", LyXRC::RC_PERS_DICT },
{ "\\popup_bold_font", LyXRC::RC_POPUP_BOLD_FONT },
{ "\\popup_font_encoding", LyXRC::RC_POPUP_FONT_ENCODING },
@ -394,10 +392,9 @@ int LyXRC::read(LyXLex & lexrc)
case RC_CYGWIN_PATH_FIX:
if (lexrc.next()) {
cygwin_path_fix = lexrc.getBool();
os::cygwin_path_fix(cygwin_path_fix);
}
break;
case RC_KBMAP_PRIMARY:
if (lexrc.next()) {
string const kmap(lexrc.getString());
@ -1131,6 +1128,11 @@ int LyXRC::read(LyXLex & lexrc)
user_email = lexrc.getString();
break;
case RC_PATH_PREFIX:
if (lexrc.next())
path_prefix = lexrc.getString();
break;
case RC_LAST: break; // this is just a dummy
}
}
@ -1215,6 +1217,13 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc) const
<< "#\n\n";
// bind files are not done here.
case RC_PATH_PREFIX:
if (ignore_system_lyxrc ||
path_prefix != system_lyxrc.path_prefix) {
os << "\\path_prefix \"" << path_prefix << "\"\n";
}
case RC_UIFILE:
if (ignore_system_lyxrc ||
ui_file != system_lyxrc.ui_file) {
@ -2021,164 +2030,13 @@ string const LyXRC::getDescription(LyXRCTags tag)
string str;
switch (tag) {
case RC_FONT_ENCODING:
str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
case RC_ACCEPT_COMPOUND:
str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
break;
case RC_PRINTER:
str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
break;
case RC_PRINT_COMMAND:
str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
break;
case RC_PRINTEVENPAGEFLAG:
str = _("The option to print only even pages.");
break;
case RC_PRINTODDPAGEFLAG:
str = _("The option to print only odd pages.");
break;
case RC_PRINTPAGERANGEFLAG:
str = _("The option for specifying a comma-separated list of pages to print.");
break;
case RC_PRINTCOPIESFLAG:
str = _("The option for specifying the number of copies to print.");
break;
case RC_PRINTCOLLCOPIESFLAG:
str = _("The option for specifying whether the copies should be collated.");
break;
case RC_PRINTREVERSEFLAG:
str = _("The option to reverse the order of the pages printed.");
break;
case RC_PRINTLANDSCAPEFLAG:
str = _("The option to print out in landscape.");
break;
case RC_PRINTPAPERFLAG:
str = _("The option to specify paper type.");
break;
case RC_PRINTPAPERDIMENSIONFLAG:
str = _("Option to specify the dimensions of the print paper.");
break;
case RC_PRINTTOPRINTER:
str = _("Option to pass to the print program to print on a specific printer.");
break;
case RC_PRINT_ADAPTOUTPUT:
str = _("Select for LyX to pass the name of the destination printer to your print command.");
break;
case RC_PRINTTOFILE:
str = _("Option to pass to the print program to print to a file.");
break;
case RC_PRINTFILEEXTENSION:
str = _("Extension of printer program output file. Usually \".ps\".");
break;
case RC_PRINTEXSTRAOPTIONS:
str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
break;
case RC_PRINTSPOOL_COMMAND:
str = _("When set, this printer option automatically prints to a file and then calls a separate print spooling program on that file with the given name and arguments.");
break;
case RC_PRINTSPOOL_PRINTERPREFIX:
str = _("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command.");
break;
case RC_SCREEN_DPI:
str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
break;
case RC_SCREEN_ZOOM:
//xgettext:no-c-format
str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
break;
case RC_SCREEN_FONT_SIZES:
str = _("The font sizes used for calculating the scaling of the screen fonts.");
break;
case RC_SCREEN_FONT_ROMAN:
case RC_SCREEN_FONT_SANS:
case RC_SCREEN_FONT_TYPEWRITER:
str = _("The screen fonts used to display the text while editing.");
break;
case RC_POPUP_BOLD_FONT:
str = _("The bold font in the dialogs.");
break;
case RC_POPUP_NORMAL_FONT:
str = _("The normal font in the dialogs.");
break;
case RC_SCREEN_FONT_ENCODING:
str = _("The encoding for the screen fonts.");
break;
case RC_POPUP_FONT_ENCODING:
str = _("The encoding for the menu/popups fonts.");
break;
case RC_SET_COLOR:
break;
case RC_AUTOSAVE:
str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
break;
case RC_DOCUMENTPATH:
str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
break;
case RC_TEMPLATEPATH:
str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
break;
case RC_TEMPDIRPATH:
str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
break;
case RC_LASTFILES:
str = _("The file where the last-files information should be stored.");
break;
case RC_AUTOREGIONDELETE:
str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
break;
case RC_AUTORESET_OPTIONS:
str = _("De-select if you don't want the class options to be reset to defaults after class change.");
break;
case RC_SERVERPIPE:
str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
break;
case RC_BINDFILE:
str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
break;
case RC_UIFILE:
str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
break;
case RC_KBMAP:
case RC_KBMAP_PRIMARY:
case RC_KBMAP_SECONDARY:
str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
case RC_ALT_LANG:
case RC_USE_ALT_LANG:
str = _("Specify an alternate language. The default is to use the language of the document.");
break;
case RC_ASCIIROFF_COMMAND:
@ -2189,69 +2047,73 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("This is the maximum line length of an exported ASCII file (LaTeX, SGML or plain text).");
break;
case RC_NUMLASTFILES:
str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."), maxlastfiles);
case RC_AUTOREGIONDELETE:
str = _("De-select if you don't want the current selection to be replaced automatically by what you type.");
break;
case RC_CHECKLASTFILES:
str = _("Select to check whether the lastfiles still exist.");
case RC_AUTORESET_OPTIONS:
str = _("De-select if you don't want the class options to be reset to defaults after class change.");
break;
case RC_VIEWDVI_PAPEROPTION:
str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
case RC_AUTOSAVE:
str = _("The time interval between auto-saves (in seconds). 0 means no auto-save.");
break;
case RC_DEFAULT_PAPERSIZE:
str = _("Specify the default paper size.");
case RC_AUTO_NUMBER:
break;
case RC_ACCEPT_COMPOUND:
str = _("Consider run-together words, such as \"diskdrive\" for \"disk drive\", as legal words?");
break;
case RC_SPELL_COMMAND:
str = _("What command runs the spell checker?");
break;
case RC_USE_INP_ENC:
str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you can't spellcheck words with international letters in them. This may not work with all dictionaries.");
break;
case RC_USE_ALT_LANG:
case RC_ALT_LANG:
str = _("Specify an alternate language. The default is to use the language of the document.");
break;
case RC_USE_PERS_DICT:
case RC_PERS_DICT:
str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
break;
case RC_USE_ESC_CHARS:
case RC_ESC_CHARS:
str = _("Specify additional chars that can be part of a word.");
break;
case RC_SCREEN_FONT_SCALABLE:
str = _("Allow bitmap fonts to be resized. If you are using a bitmap font, selecting this option may make some fonts look blocky in LyX. Deselecting this option makes LyX use the nearest bitmap font size available, instead of scaling.");
break;
case RC_CHKTEX_COMMAND:
str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
case RC_BACKUPDIR_PATH:
str = _("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file.");
break;
case RC_BIBTEX_COMMAND:
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\".");
case RC_BINDFILE:
str = _("Keybindings file. Can either specify an absolute path, or LyX will look in its global and local bind/ directories.");
break;
case RC_CHECKLASTFILES:
str = _("Select to check whether the lastfiles still exist.");
break;
case RC_CHKTEX_COMMAND:
str = _("Define how to run chktex. E.g. \"chktex -n11 -n1 -n3 -n6 -n9 -22 -n25 -n30 -n38\" Refer to the ChkTeX documentation.");
break;
case RC_CONVERTER:
break;
case RC_COPIER:
break;
case RC_CURSOR_FOLLOWS_SCROLLBAR:
str = _("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen.");
break;
case RC_CUSTOM_EXPORT_COMMAND:
break;
case RC_CUSTOM_EXPORT_FORMAT:
break;
case RC_CYGWIN_PATH_FIX:
break;
case RC_DATE_INSERT_FORMAT:
//xgettext:no-c-format
str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
break;
case RC_DEFAULT_LANGUAGE:
str = _("New documents will be assigned this language.");
break;
case RC_DEFAULT_PAPERSIZE:
str = _("Specify the default paper size.");
break;
case RC_DIALOGS_ICONIFY_WITH_MAIN:
str = _("Iconify the dialogs when the main window is iconified. (Affects only dialogs shown after the change has been made.)");
break;
@ -2260,32 +2122,37 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Select how LyX will display any graphics.");
break;
case RC_MAKE_BACKUP:
str = _("De-select if you don't want LyX to create backup files.");
case RC_DOCUMENTPATH:
str = _("The default path for your documents. An empty value selects the directory LyX was started from.");
break;
case RC_BACKUPDIR_PATH:
str = _("The path for storing backup files. If it is an empty string, LyX will store the backup file in the same directory as the original file.");
case RC_ESC_CHARS:
case RC_USE_ESC_CHARS:
str = _("Specify additional chars that can be part of a word.");
break;
case RC_RTL_SUPPORT:
str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
case RC_FONT_ENCODING:
str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
break;
case RC_MARK_FOREIGN_LANGUAGE:
str = _("Select to control the highlighting of words with a language foreign to that of the document.");
case RC_FORMAT:
break;
case RC_LANGUAGE_PACKAGE:
str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
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_LANGUAGE_GLOBAL_OPTIONS:
str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
case RC_INPUT:
break;
case RC_LANGUAGE_USE_BABEL:
str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
case RC_KBMAP:
case RC_KBMAP_PRIMARY:
case RC_KBMAP_SECONDARY:
str = _("Use this to set the correct mapping file for your keyboard. You'll need this if you for instance want to type German documents on an American keyboard.");
break;
case RC_LABEL_INIT_LENGTH:
str = _("Maximum number of words in the initialization string for a new label");
break;
case RC_LANGUAGE_AUTO_BEGIN:
@ -2308,34 +2175,52 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("The LaTeX command for local changing of the language.");
break;
case RC_DATE_INSERT_FORMAT:
//xgettext:no-c-format
str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
case RC_LANGUAGE_GLOBAL_OPTIONS:
str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
break;
case RC_SHOW_BANNER:
str = _("De-select if you don't want the startup banner.");
case RC_LANGUAGE_PACKAGE:
str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
break;
case RC_WHEEL_JUMP:
str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
case RC_LANGUAGE_USE_BABEL:
str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
break;
case RC_CONVERTER:
case RC_LASTFILES:
str = _("The file where the last-files information should be stored.");
break;
case RC_VIEWER:
case RC_MAKE_BACKUP:
str = _("De-select if you don't want LyX to create backup files.");
break;
case RC_FORMAT:
case RC_MARK_FOREIGN_LANGUAGE:
str = _("Select to control the highlighting of words with a language foreign to that of the document.");
break;
case RC_DEFAULT_LANGUAGE:
str = _("New documents will be assigned this language.");
case RC_NUMLASTFILES:
str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."), maxlastfiles);
break;
case RC_LABEL_INIT_LENGTH:
str = _("Maximum number of words in the initialization string for a new label");
case RC_PATH_PREFIX:
break;
case RC_PERS_DICT:
case RC_USE_PERS_DICT:
str = _("Specify an alternate personal dictionary file. E.g. \".ispell_english\".");
break;
case RC_POPUP_BOLD_FONT:
str = _("The bold font in the dialogs.");
break;
case RC_POPUP_FONT_ENCODING:
str = _("The encoding for the menu/popups fonts.");
break;
case RC_POPUP_NORMAL_FONT:
str = _("The normal font in the dialogs.");
break;
case RC_PREVIEW:
@ -2350,7 +2235,169 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Scale the preview size to suit.");
break;
default:
case RC_PRINTCOLLCOPIESFLAG:
str = _("The option for specifying whether the copies should be collated.");
break;
case RC_PRINTCOPIESFLAG:
str = _("The option for specifying the number of copies to print.");
break;
case RC_PRINTER:
str = _("The default printer to print on. If none is specified, LyX will use the environment variable PRINTER.");
break;
case RC_PRINTEVENPAGEFLAG:
str = _("The option to print only even pages.");
break;
case RC_PRINTEXSTRAOPTIONS:
str = _("Extra options to pass to printing program after everything else, but before the filename of the DVI file to be printed.");
break;
case RC_PRINTFILEEXTENSION:
str = _("Extension of printer program output file. Usually \".ps\".");
break;
case RC_PRINTLANDSCAPEFLAG:
str = _("The option to print out in landscape.");
break;
case RC_PRINTODDPAGEFLAG:
str = _("The option to print only odd pages.");
break;
case RC_PRINTPAGERANGEFLAG:
str = _("The option for specifying a comma-separated list of pages to print.");
break;
case RC_PRINTPAPERDIMENSIONFLAG:
str = _("Option to specify the dimensions of the print paper.");
break;
case RC_PRINTPAPERFLAG:
str = _("The option to specify paper type.");
break;
case RC_PRINTREVERSEFLAG:
str = _("The option to reverse the order of the pages printed.");
break;
case RC_PRINTSPOOL_COMMAND:
str = _("When set, this printer option automatically prints to a file and then calls a separate print spooling program on that file with the given name and arguments.");
break;
case RC_PRINTSPOOL_PRINTERPREFIX:
str = _("If you specify a printer name in the print dialog, the following argument is prepended along with the printer name after the spool command.");
break;
case RC_PRINTTOFILE:
str = _("Option to pass to the print program to print to a file.");
break;
case RC_PRINTTOPRINTER:
str = _("Option to pass to the print program to print on a specific printer.");
break;
case RC_PRINT_ADAPTOUTPUT:
str = _("Select for LyX to pass the name of the destination printer to your print command.");
break;
case RC_PRINT_COMMAND:
str = _("Your favorite print program, e.g. \"dvips\", \"dvilj4\".");
break;
case RC_RTL_SUPPORT:
str = _("Select to enable support of right-to-left languages (e.g. Hebrew, Arabic).");
break;
case RC_SCREEN_DPI:
str = _("DPI (dots per inch) of your monitor is auto-detected by LyX. If that goes wrong, override the setting here.");
break;
case RC_SCREEN_FONT_ENCODING:
str = _("The encoding for the screen fonts.");
break;
case RC_SCREEN_FONT_ROMAN:
case RC_SCREEN_FONT_SANS:
case RC_SCREEN_FONT_TYPEWRITER:
str = _("The screen fonts used to display the text while editing.");
break;
case RC_SCREEN_FONT_ROMAN_FOUNDRY:
case RC_SCREEN_FONT_SANS_FOUNDRY:
case RC_SCREEN_FONT_TYPEWRITER_FOUNDRY:
break;
case RC_SCREEN_FONT_SCALABLE:
str = _("Allow bitmap fonts to be resized. If you are using a bitmap font, selecting this option may make some fonts look blocky in LyX. Deselecting this option makes LyX use the nearest bitmap font size available, instead of scaling.");
break;
case RC_SCREEN_FONT_SIZES:
str = _("The font sizes used for calculating the scaling of the screen fonts.");
break;
case RC_SCREEN_ZOOM:
//xgettext:no-c-format
str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
break;
case RC_SERVERPIPE:
str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
break;
case RC_SET_COLOR:
break;
case RC_SHOW_BANNER:
str = _("De-select if you don't want the startup banner.");
break;
case RC_SPELL_COMMAND:
str = _("What command runs the spell checker?");
break;
case RC_TEMPDIRPATH:
str = _("LyX will place its temporary directories in this path. They will be deleted when you quit LyX.");
break;
case RC_TEMPLATEPATH:
str = _("The path that LyX will set when offering to choose a template. An empty value selects the directory LyX was started from.");
break;
case RC_UIFILE:
str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
break;
case RC_USER_EMAIL:
break;
case RC_USER_NAME:
break;
case RC_USETEMPDIR:
break;
case RC_USE_INP_ENC:
str = _("Specify whether to pass the -T input encoding option to ispell. Enable this if you can't spellcheck words with international letters in them. This may not work with all dictionaries.");
break;
case RC_USE_SPELL_LIB:
break;
case RC_VIEWDVI_PAPEROPTION:
str = _("Specify the paper command to DVI viewer (leave empty or use \"-paper\")");
break;
case RC_VIEWER:
break;
case RC_WHEEL_JUMP:
str = _("The number of lines that are scrolled by mice with wheels or five button mice.");
break;
case RC_LAST:
break;
}

View File

@ -32,111 +32,111 @@ class LyXRC //: public noncopyable {
// noncopyable again. For now I want to minimise changes. ARRae 20001010
{
public:
enum LyXRCTags {
RC_FONT_ENCODING = 1,
RC_PRINTER,
RC_PRINT_COMMAND,
RC_PRINTEVENPAGEFLAG,
RC_PRINTODDPAGEFLAG,
RC_PRINTPAGERANGEFLAG,
RC_PRINTCOPIESFLAG,
RC_PRINTCOLLCOPIESFLAG,
RC_PRINTREVERSEFLAG,
RC_PRINTLANDSCAPEFLAG,
RC_PRINTTOPRINTER,
RC_PRINT_ADAPTOUTPUT,
RC_PRINTTOFILE,
RC_PRINTFILEEXTENSION,
RC_PRINTEXSTRAOPTIONS,
RC_PRINTSPOOL_COMMAND,
RC_PRINTSPOOL_PRINTERPREFIX,
RC_PRINTPAPERFLAG,
RC_PRINTPAPERDIMENSIONFLAG,
RC_CUSTOM_EXPORT_COMMAND,
RC_CUSTOM_EXPORT_FORMAT,
RC_SCREEN_DPI,
RC_SCREEN_ZOOM,
RC_SCREEN_FONT_SIZES,
RC_SCREEN_FONT_ROMAN,
RC_SCREEN_FONT_SANS,
RC_SCREEN_FONT_TYPEWRITER,
RC_SCREEN_FONT_ROMAN_FOUNDRY,
RC_SCREEN_FONT_SANS_FOUNDRY,
RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
RC_SCREEN_FONT_ENCODING,
RC_POPUP_BOLD_FONT,
RC_POPUP_NORMAL_FONT,
RC_POPUP_FONT_ENCODING,
RC_SET_COLOR,
RC_AUTOSAVE,
RC_DOCUMENTPATH,
RC_TEMPLATEPATH,
RC_TEMPDIRPATH,
RC_USETEMPDIR,
RC_LASTFILES,
RC_AUTOREGIONDELETE,
RC_AUTORESET_OPTIONS,
RC_SERVERPIPE,
RC_INPUT,
RC_BINDFILE,
RC_UIFILE,
RC_KBMAP,
RC_KBMAP_PRIMARY,
RC_KBMAP_SECONDARY,
RC_ASCIIROFF_COMMAND,
RC_ASCII_LINELEN,
RC_NUMLASTFILES,
RC_CHECKLASTFILES,
RC_VIEWDVI_PAPEROPTION,
RC_DEFAULT_PAPERSIZE,
RC_ACCEPT_COMPOUND,
RC_SPELL_COMMAND,
RC_USE_INP_ENC,
RC_USE_ALT_LANG,
RC_USE_PERS_DICT,
RC_USE_ESC_CHARS,
RC_SCREEN_FONT_SCALABLE,
RC_ALT_LANG,
RC_PERS_DICT,
RC_ESC_CHARS,
RC_CHKTEX_COMMAND,
RC_BIBTEX_COMMAND,
RC_CURSOR_FOLLOWS_SCROLLBAR,
RC_DIALOGS_ICONIFY_WITH_MAIN,
RC_MAKE_BACKUP,
RC_BACKUPDIR_PATH,
RC_RTL_SUPPORT,
RC_AUTO_NUMBER,
RC_MARK_FOREIGN_LANGUAGE,
RC_LANGUAGE_PACKAGE,
RC_LANGUAGE_AUTO_BEGIN,
RC_LANGUAGE_AUTO_END,
RC_LANGUAGE_COMMAND_BEGIN,
RC_LANGUAGE_COMMAND_END,
RC_LANGUAGE_COMMAND_LOCAL,
RC_LANGUAGE_GLOBAL_OPTIONS,
RC_LANGUAGE_USE_BABEL,
RC_DATE_INSERT_FORMAT,
RC_SHOW_BANNER,
RC_WHEEL_JUMP,
RC_CONVERTER,
RC_COPIER,
RC_VIEWER,
RC_FORMAT,
RC_DEFAULT_LANGUAGE,
RC_LABEL_INIT_LENGTH,
RC_DISPLAY_GRAPHICS,
RC_PREVIEW,
RC_PREVIEW_HASHED_LABELS,
RC_PREVIEW_SCALE_FACTOR,
RC_USE_SPELL_LIB,
RC_USER_NAME,
RC_USER_EMAIL,
RC_INDEX_COMMAND,
RC_CYGWIN_PATH_FIX,
RC_LAST
};
enum LyXRCTags {
RC_ACCEPT_COMPOUND = 1,
RC_ALT_LANG,
RC_ASCIIROFF_COMMAND,
RC_ASCII_LINELEN,
RC_AUTOREGIONDELETE,
RC_AUTORESET_OPTIONS,
RC_AUTOSAVE,
RC_AUTO_NUMBER,
RC_BACKUPDIR_PATH,
RC_BIBTEX_COMMAND,
RC_BINDFILE,
RC_CHECKLASTFILES,
RC_CHKTEX_COMMAND,
RC_CONVERTER,
RC_COPIER,
RC_CURSOR_FOLLOWS_SCROLLBAR,
RC_CUSTOM_EXPORT_COMMAND,
RC_CUSTOM_EXPORT_FORMAT,
RC_CYGWIN_PATH_FIX,
RC_DATE_INSERT_FORMAT,
RC_DEFAULT_LANGUAGE,
RC_DEFAULT_PAPERSIZE,
RC_DIALOGS_ICONIFY_WITH_MAIN,
RC_DISPLAY_GRAPHICS,
RC_DOCUMENTPATH,
RC_ESC_CHARS,
RC_FONT_ENCODING,
RC_FORMAT,
RC_INDEX_COMMAND,
RC_INPUT,
RC_KBMAP,
RC_KBMAP_PRIMARY,
RC_KBMAP_SECONDARY,
RC_LABEL_INIT_LENGTH,
RC_LANGUAGE_AUTO_BEGIN,
RC_LANGUAGE_AUTO_END,
RC_LANGUAGE_COMMAND_BEGIN,
RC_LANGUAGE_COMMAND_END,
RC_LANGUAGE_COMMAND_LOCAL,
RC_LANGUAGE_GLOBAL_OPTIONS,
RC_LANGUAGE_PACKAGE,
RC_LANGUAGE_USE_BABEL,
RC_LASTFILES,
RC_MAKE_BACKUP,
RC_MARK_FOREIGN_LANGUAGE,
RC_NUMLASTFILES,
RC_PATH_PREFIX,
RC_PERS_DICT,
RC_POPUP_BOLD_FONT,
RC_POPUP_FONT_ENCODING,
RC_POPUP_NORMAL_FONT,
RC_PREVIEW,
RC_PREVIEW_HASHED_LABELS,
RC_PREVIEW_SCALE_FACTOR,
RC_PRINTCOLLCOPIESFLAG,
RC_PRINTCOPIESFLAG,
RC_PRINTER,
RC_PRINTEVENPAGEFLAG,
RC_PRINTEXSTRAOPTIONS,
RC_PRINTFILEEXTENSION,
RC_PRINTLANDSCAPEFLAG,
RC_PRINTODDPAGEFLAG,
RC_PRINTPAGERANGEFLAG,
RC_PRINTPAPERDIMENSIONFLAG,
RC_PRINTPAPERFLAG,
RC_PRINTREVERSEFLAG,
RC_PRINTSPOOL_COMMAND,
RC_PRINTSPOOL_PRINTERPREFIX,
RC_PRINTTOFILE,
RC_PRINTTOPRINTER,
RC_PRINT_ADAPTOUTPUT,
RC_PRINT_COMMAND,
RC_RTL_SUPPORT,
RC_SCREEN_DPI,
RC_SCREEN_FONT_ENCODING,
RC_SCREEN_FONT_ROMAN,
RC_SCREEN_FONT_ROMAN_FOUNDRY,
RC_SCREEN_FONT_SANS,
RC_SCREEN_FONT_SANS_FOUNDRY,
RC_SCREEN_FONT_SCALABLE,
RC_SCREEN_FONT_SIZES,
RC_SCREEN_FONT_TYPEWRITER,
RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
RC_SCREEN_ZOOM,
RC_SERVERPIPE,
RC_SET_COLOR,
RC_SHOW_BANNER,
RC_SPELL_COMMAND,
RC_TEMPDIRPATH,
RC_TEMPLATEPATH,
RC_UIFILE,
RC_USER_EMAIL,
RC_USER_NAME,
RC_USETEMPDIR,
RC_USE_ALT_LANG,
RC_USE_ESC_CHARS,
RC_USE_INP_ENC,
RC_USE_PERS_DICT,
RC_USE_SPELL_LIB,
RC_VIEWDVI_PAPEROPTION,
RC_VIEWER,
RC_WHEEL_JUMP,
RC_LAST
};
///
LyXRC();
@ -377,6 +377,10 @@ public:
std::string user_email;
///
bool cygwin_path_fix;
/** Prepend paths to the PATH environment variable.
* The string is input, stored and output in native format.
*/
std::string path_prefix;
};

View File

@ -1,3 +1,9 @@
2005-01-16 Angus Leeming <leeming@lyx.org>
* filetools.[Ch] (prependEnvPath): prepend a list of paths to
that returned by the environment variable. Identical paths occurring
later in the list are removed.
2005-01-16 Angus Leeming <leeming@lyx.org>
* filetools.C (createLyXTmpDir): add some missing brackets to the

View File

@ -428,6 +428,34 @@ void setEnvPath(string const & name, vector<string> const & env)
}
void prependEnvPath(string const & name, string const & prefix)
{
vector<string> env_var = getEnvPath(name);
typedef boost::char_separator<char> Separator;
typedef boost::tokenizer<Separator> Tokenizer;
Separator const separator(string(1, os::path_separator()).c_str());
// Prepend each new element to the list, removing identical elements
// that occur later in the list.
Tokenizer const tokens(prefix, separator);
vector<string> reversed_tokens(tokens.begin(), tokens.end());
typedef vector<string>::const_reverse_iterator token_iterator;
token_iterator it = reversed_tokens.rbegin();
token_iterator const end = reversed_tokens.rend();
for (; it != end; ++it) {
vector<string>::iterator remove_it =
std::remove(env_var.begin(), env_var.end(), *it);
env_var.erase(remove_it, env_var.end());
env_var.insert(env_var.begin(), *it);
}
setEnvPath(name, env_var);
}
bool putEnv(string const & envstr)
{
// CHECK Look at and fix this.

View File

@ -129,6 +129,15 @@ std::vector<std::string> const getEnvPath(std::string const & name);
*/
void setEnvPath(std::string const & name, std::vector<std::string> const & env);
/** Prepend a list of paths to that returned by the environment variable.
* Identical paths occurring later in the list are removed.
* @param name the name of the environment variable.
* @prefix the list of paths in OS-native syntax.
* Eg "/foo/bar:/usr/bin:/usr/local/bin" on *nix,
* "C:\foo\bar;C:\windows" on Windows.
*/
void prependEnvPath(std::string const & name, std::string const & prefix);
/// Set an environment variable using a string of the form "name=FOO".
bool putEnv(std::string const & envstr);