- case RC_VIEWER_ALTERNATIVES:
- if (ignore_system_lyxrc ||
- viewer_alternatives != system_lyxrc.viewer_alternatives) {
- for (vector<pair<string, string> >::const_iterator it = viewer_alternatives.begin();
- it != viewer_alternatives.end(); ++it)
- os << "\\viewer_alternatives "
- << it->first << " " << it->second << "\n";
+ case RC_VIEWER_ALTERNATIVES: {
+ Alternatives::const_iterator it = viewer_alternatives.begin();
+ Alternatives::const_iterator const en = viewer_alternatives.end();
+ Alternatives::const_iterator const sysend =
+ system_lyxrc.viewer_alternatives.end();
+ for (; it != en; ++it) {
+ string const & fmt = it->first;
+ CommandSet const & cmd = it->second;
+ CommandSet::const_iterator sit = cmd.begin();
+ CommandSet::const_iterator const sen = cmd.end();
+ Alternatives::const_iterator const sysfmt = ignore_system_lyxrc ?
+ system_lyxrc.viewer_alternatives.begin() : // we won't use it in this case
+ system_lyxrc.viewer_alternatives.find(fmt);
+ for (; sit != sen; ++sit) {
+ string const & cmd = *sit;
+ if (ignore_system_lyxrc
+ || sysfmt == sysend // format not found
+ || sysfmt->second.count(cmd) == 0 // this command not found
+ )
+ os << "\\viewer_alternatives " << fmt << " " << cmd << "\n";
+ }