From 9c3fc03f3a7fa1d998018d2a46752efca1ebc72c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sat, 17 Oct 2009 18:02:40 +0000 Subject: [PATCH] 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 --- src/LyXRC.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 92850061d0..f60abd49f0 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -2491,26 +2491,36 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n"; if (tag != RC_LAST) break; - case RC_VIEWER_ALTERNATIVES: - if (ignore_system_lyxrc || - viewer_alternatives != system_lyxrc.viewer_alternatives) { - for (vector >::const_iterator it = viewer_alternatives.begin(); - it != viewer_alternatives.end(); ++it) - os << "\\viewer_alternatives " - << it->first << " " << it->second << "\n"; + case RC_VIEWER_ALTERNATIVES: { + vector >::const_iterator it = viewer_alternatives.begin(); + vector >::const_iterator const en = viewer_alternatives.end(); + vector >::const_iterator const sysbeg = + system_lyxrc.viewer_alternatives.begin(); + vector >::const_iterator const sysend = + 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) break; - case RC_EDITOR_ALTERNATIVES: - if (ignore_system_lyxrc || - editor_alternatives != system_lyxrc.editor_alternatives) { - for (vector >::const_iterator it = editor_alternatives.begin(); - it != editor_alternatives.end(); ++it) - os << "\\editor_alternatives " - << it->first << " " << it->second << "\n"; + } + case RC_EDITOR_ALTERNATIVES: { + vector >::const_iterator it = editor_alternatives.begin(); + vector >::const_iterator const en = editor_alternatives.end(); + vector >::const_iterator const sysbeg = + system_lyxrc.editor_alternatives.begin(); + vector >::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) break; + } case RC_DEFAULT_VIEW_FORMAT: if (ignore_system_lyxrc || default_view_format != system_lyxrc.default_view_format) { -- 2.39.2