X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FKeyMap.cpp;h=e18fb74e7e4299ca221449d42ea5e65c7c57a590;hb=1e519d1115f41f71c253cb9e2fbb7803e9a583a9;hp=23acee0f9feb3185db9ccfbddace6d0a30829166;hpb=fdbe775b9f5468e8f53dc83a66583f412b5970fb;p=lyx.git diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index 23acee0f9f..e18fb74e7e 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -25,6 +25,7 @@ #include "support/filetools.h" #include "support/gettext.h" #include "support/lstrings.h" +#include "support/TempFile.h" #include "frontends/alert.h" @@ -105,6 +106,8 @@ void KeyMap::bind(KeySequence * seq, FuncRequest const & func, unsigned int r) KeyModifier const mod2 = seq->modifiers[r].second; // check if key is already there + // FIXME perf: Profiling shows that this is responsible of 99% of the + // cost of GuiPrefs::applyView() Table::iterator end = table.end(); for (Table::iterator it = table.begin(); it != end; ++it) { if (code == it->code @@ -254,7 +257,8 @@ bool KeyMap::read(FileName const & bind_file, KeyMap * unbind_map) return retval == ReadOK; LYXERR(Debug::FILES, "Converting bind file to " << LFUN_FORMAT); - FileName const tempfile = FileName::tempName("convert_bind"); + TempFile tmp("convert_bind"); + FileName const tempfile = tmp.name(); bool const success = prefs2prefs(bind_file, tempfile, true); if (!success) { LYXERR0 ("Unable to convert " << bind_file << @@ -262,7 +266,6 @@ bool KeyMap::read(FileName const & bind_file, KeyMap * unbind_map) return false; } retval = readWithoutConv(tempfile, unbind_map); - tempfile.removeFile(); return retval == ReadOK; } @@ -473,20 +476,21 @@ docstring const KeyMap::print(bool forgui) const docstring KeyMap::printBindings(FuncRequest const & func, - KeySequence::outputFormat format) const + KeySequence::outputFormat format, + bool const untranslated) const { Bindings bindings = findBindings(func); if (bindings.empty()) return docstring(); - + odocstringstream res; Bindings::const_iterator cit = bindings.begin(); Bindings::const_iterator cit_end = bindings.end(); // print the first item - res << cit->print(format); + res << cit->print(format, untranslated); // more than one shortcuts? for (++cit; cit != cit_end; ++cit) - res << ", " << cit->print(format); + res << ", " << cit->print(format, untranslated); return res.str(); } @@ -541,7 +545,7 @@ KeyMap::BindingList KeyMap::listBindings(bool unbound, KeyMap::ItemType tag) con } if (!has_action) list.push_back(Binding(FuncRequest(action), KeySequence(0, 0), tag)); - } + } } return list; }