Fix how viewer_alternatives and editor_alternatives are written

to the preferences file. The old way produced tons of duplicates.
The fix is the same as for a prior bug with bibtex_alternatives.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31652 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-10-17 18:02:40 +00:00
parent 3d19a3a820
commit 9c3fc03f3a

View File

@ -2491,26 +2491,36 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
<< "\" \"\" \"\" \"\" \"\" \"\" \"\"\n"; << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
if (tag != RC_LAST) if (tag != RC_LAST)
break; break;
case RC_VIEWER_ALTERNATIVES: case RC_VIEWER_ALTERNATIVES: {
if (ignore_system_lyxrc || vector<pair<string, string> >::const_iterator it = viewer_alternatives.begin();
viewer_alternatives != system_lyxrc.viewer_alternatives) { vector<pair<string, string> >::const_iterator const en = viewer_alternatives.end();
for (vector<pair<string, string> >::const_iterator it = viewer_alternatives.begin(); vector<pair<string, string> >::const_iterator const sysbeg =
it != viewer_alternatives.end(); ++it) system_lyxrc.viewer_alternatives.begin();
os << "\\viewer_alternatives " vector<pair<string, string> >::const_iterator const sysend =
<< it->first << " " << it->second << "\n"; system_lyxrc.viewer_alternatives.end();
for ( ; it != en; ++it) {
if (ignore_system_lyxrc || find(sysbeg, sysend, *it) == sysend)
os << "\\viewer_alternatives "
<< it->first << " " << it->second << "\n";
} }
if (tag != RC_LAST) if (tag != RC_LAST)
break; break;
case RC_EDITOR_ALTERNATIVES: }
if (ignore_system_lyxrc || case RC_EDITOR_ALTERNATIVES: {
editor_alternatives != system_lyxrc.editor_alternatives) { vector<pair<string, string> >::const_iterator it = editor_alternatives.begin();
for (vector<pair<string, string> >::const_iterator it = editor_alternatives.begin(); vector<pair<string, string> >::const_iterator const en = editor_alternatives.end();
it != editor_alternatives.end(); ++it) vector<pair<string, string> >::const_iterator const sysbeg =
os << "\\editor_alternatives " system_lyxrc.editor_alternatives.begin();
<< it->first << " " << it->second << "\n"; vector<pair<string, string> >::const_iterator const sysend =
system_lyxrc.editor_alternatives.end();
for ( ; it != en; ++it) {
if (ignore_system_lyxrc || find(sysbeg, sysend, *it) == sysend)
os << "\\editor_alternatives "
<< it->first << " " << it->second << "\n";
} }
if (tag != RC_LAST) if (tag != RC_LAST)
break; break;
}
case RC_DEFAULT_VIEW_FORMAT: case RC_DEFAULT_VIEW_FORMAT:
if (ignore_system_lyxrc || if (ignore_system_lyxrc ||
default_view_format != system_lyxrc.default_view_format) { default_view_format != system_lyxrc.default_view_format) {