X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FKeyMap.cpp;h=32f99265dd779106d2ab4626a784b460d5672938;hb=589f49ff366f88e3f3be9424397d9d99ebf44dfe;hp=50833c923a755d694fd7042082aca99362cc6156;hpb=dd2189656b2659a490c5336bb17525b6b5f83f0d;p=lyx.git diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index 50833c923a..32f99265dd 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; } @@ -443,7 +446,7 @@ FuncRequest const & KeyMap::lookup(KeySymbol const &key, if (cit->prefixes) { // this is a prefix key - set new map seq->curmap = cit->prefixes.get(); - static FuncRequest prefix(LFUN_COMMAND_PREFIX); + static const FuncRequest prefix(LFUN_COMMAND_PREFIX); return prefix; } else { // final key - reset map