From 1d6c4787f9392169b78cac3a924818f2ebe1145d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 27 Apr 2007 08:05:58 +0000 Subject: [PATCH] rename kb_keymap into KeyMap git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18056 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/{kb_keymap.cpp => KeyMap.cpp} | 35 ++++++++++++++----------------- src/{kb_keymap.h => KeyMap.h} | 26 +++++++++++------------ src/LyX.cpp | 16 +++++++------- src/LyX.h | 10 ++++----- src/LyXFunc.cpp | 4 ++-- src/LyXFunc.h | 2 +- src/Makefile.am | 4 ++-- src/MenuBackend.cpp | 4 ++-- src/kb_sequence.cpp | 2 +- src/kb_sequence.h | 10 ++++----- 10 files changed, 54 insertions(+), 59 deletions(-) rename src/{kb_keymap.cpp => KeyMap.cpp} (87%) rename src/{kb_keymap.h => KeyMap.h} (88%) diff --git a/src/kb_keymap.cpp b/src/KeyMap.cpp similarity index 87% rename from src/kb_keymap.cpp rename to src/KeyMap.cpp index 8000ca3946..354a8d62bf 100644 --- a/src/kb_keymap.cpp +++ b/src/KeyMap.cpp @@ -1,5 +1,5 @@ /** - * \file kb_keymap.cpp + * \file KeyMap.cpp * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * @@ -13,7 +13,7 @@ #include -#include "kb_keymap.h" +#include "KeyMap.h" #include "debug.h" #include "kb_sequence.h" @@ -36,7 +36,7 @@ using std::endl; using std::string; -string const kb_keymap::printKeySym(LyXKeySym const & key, +string const KeyMap::printKeySym(LyXKeySym const & key, key_modifier::state mod) { string buf; @@ -55,7 +55,7 @@ string const kb_keymap::printKeySym(LyXKeySym const & key, } -string::size_type kb_keymap::bind(string const & seq, FuncRequest const & func) +size_t KeyMap::bind(string const & seq, FuncRequest const & func) { LYXERR(Debug::KBMAP) << "BIND: Sequence `" << seq << "' Action `" @@ -91,7 +91,7 @@ keyword_item bindTags[] = { } -bool kb_keymap::read(string const & bind_file) +bool KeyMap::read(string const & bind_file) { const int bindCount = sizeof(bindTags) / sizeof(keyword_item); @@ -102,7 +102,7 @@ bool kb_keymap::read(string const & bind_file) FileName const tmp(i18nLibFileSearch("bind", bind_file, "bind")); lexrc.setFile(tmp); if (!lexrc.isOK()) { - lyxerr << "kb_keymap::read: cannot open bind file:" + lyxerr << "KeyMap::read: cannot open bind file:" << tmp << endl; return false; } @@ -164,14 +164,14 @@ bool kb_keymap::read(string const & bind_file) } if (error) - lyxerr << "kb_keymap::read: error while reading bind file:" + lyxerr << "KeyMap::read: error while reading bind file:" << tmp << endl; return !error; } FuncRequest const & -kb_keymap::lookup(LyXKeySymPtr key, +KeyMap::lookup(LyXKeySymPtr key, key_modifier::state mod, kb_sequence * seq) const { static FuncRequest const unknown(LFUN_UNKNOWN_ACTION); @@ -212,7 +212,7 @@ kb_keymap::lookup(LyXKeySymPtr key, } -docstring const kb_keymap::print(bool forgui) const +docstring const KeyMap::print(bool forgui) const { docstring buf; Table::const_iterator end = table.end(); @@ -224,8 +224,7 @@ docstring const kb_keymap::print(bool forgui) const } -void kb_keymap::defkey(kb_sequence * seq, - FuncRequest const & func, unsigned int r) +void KeyMap::defkey(kb_sequence * seq, FuncRequest const & func, unsigned int r) { LyXKeySymPtr code = seq->sequence[r]; if (!code->isOK()) @@ -266,7 +265,7 @@ void kb_keymap::defkey(kb_sequence * seq, } } - Table::iterator newone = table.insert(table.end(), kb_key()); + Table::iterator newone = table.insert(table.end(), Key()); newone->code = code; newone->mod = seq->modifiers[r]; if (r + 1 == seq->length()) { @@ -274,13 +273,13 @@ void kb_keymap::defkey(kb_sequence * seq, newone->func.origin = FuncRequest::KEYBOARD; newone->table.reset(); } else { - newone->table.reset(new kb_keymap); + newone->table.reset(new KeyMap); newone->table->defkey(seq, func, r + 1); } } -docstring const kb_keymap::printbindings(FuncRequest const & func) const +docstring const KeyMap::printbindings(FuncRequest const & func) const { odocstringstream res; Bindings bindings = findbindings(func); @@ -291,15 +290,13 @@ docstring const kb_keymap::printbindings(FuncRequest const & func) const } -kb_keymap::Bindings -kb_keymap::findbindings(FuncRequest const & func) const +KeyMap::Bindings KeyMap::findbindings(FuncRequest const & func) const { return findbindings(func, kb_sequence(0, 0)); } -kb_keymap::Bindings -kb_keymap::findbindings(FuncRequest const & func, +KeyMap::Bindings KeyMap::findbindings(FuncRequest const & func, kb_sequence const & prefix) const { Bindings res; @@ -326,7 +323,7 @@ kb_keymap::findbindings(FuncRequest const & func, std::pair -kb_keymap::find1keybinding(FuncRequest const & func) const +KeyMap::find1keybinding(FuncRequest const & func) const { Table::const_iterator end = table.end(); for (Table::const_iterator cit = table.begin(); diff --git a/src/kb_keymap.h b/src/KeyMap.h similarity index 88% rename from src/kb_keymap.h rename to src/KeyMap.h index 2f486b09a9..97687a7c60 100644 --- a/src/kb_keymap.h +++ b/src/KeyMap.h @@ -1,6 +1,6 @@ -// -*- C++ -*- +// -*- C++ -*- /** - * \file kb_keymap.h + * \file KeyMap.h * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * @@ -11,8 +11,8 @@ * Full author contact details are available in file CREDITS. */ -#ifndef KB_KEYMAP_H -#define KB_KEYMAP_H +#ifndef KEYMAP_H +#define KEYMAP_H #include "FuncRequest.h" @@ -32,7 +32,7 @@ namespace lyx { class kb_sequence; /// Defines key maps and actions for key sequences -class kb_keymap { +class KeyMap { public: /** * Bind a key sequence to an action. @@ -40,7 +40,7 @@ public: * occurs. * See kb_sequence::parse for the syntax of the seq string */ - std::string::size_type bind(std::string const & seq, FuncRequest const & func); + size_t bind(std::string const & seq, FuncRequest const & func); // Parse a bind file bool read(std::string const & bind_file); @@ -93,7 +93,7 @@ public: private: /// - struct kb_key { + struct Key { /// Keysym LyXKeySymPtr code; @@ -101,7 +101,7 @@ private: modifier_pair mod; /// Keymap for prefix keys - boost::shared_ptr table; + boost::shared_ptr table; /// Action for !prefix keys FuncRequest func; @@ -123,19 +123,17 @@ private: kb_sequence const & prefix) const; /// is the table empty ? - bool empty() const { - return table.empty(); - } + bool empty() const { return table.empty(); } /// - typedef std::vector Table; + typedef std::vector Table; /// Table table; }; /// Implementation is in LyX.cpp -extern kb_keymap & theTopLevelKeymap(); +extern KeyMap & theTopLevelKeymap(); } // namespace lyx -#endif // KB_KEYMAP_H +#endif // KEYMAP_H diff --git a/src/LyX.cpp b/src/LyX.cpp index 233fe40a01..1a65c497b9 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -27,7 +27,7 @@ #include "ErrorList.h" #include "Format.h" #include "gettext.h" -#include "kb_keymap.h" +#include "KeyMap.h" #include "Language.h" #include "Session.h" #include "Color.h" @@ -161,7 +161,7 @@ struct LyX::Singletons /// BufferList buffer_list_; /// - boost::scoped_ptr toplevel_keymap_; + boost::scoped_ptr toplevel_keymap_; /// boost::scoped_ptr lyx_server_; /// @@ -307,7 +307,7 @@ frontend::Application const & LyX::application() const } -kb_keymap & LyX::topLevelKeymap() +KeyMap & LyX::topLevelKeymap() { BOOST_ASSERT(pimpl_->toplevel_keymap_.get()); return *pimpl_->toplevel_keymap_.get(); @@ -326,7 +326,7 @@ Converters & LyX::systemConverters() } -kb_keymap const & LyX::topLevelKeymap() const +KeyMap const & LyX::topLevelKeymap() const { BOOST_ASSERT(pimpl_->toplevel_keymap_.get()); return *pimpl_->toplevel_keymap_.get(); @@ -885,7 +885,7 @@ bool LyX::init() //setGuiLanguage(lyxrc.gui_language); // Set up bindings - pimpl_->toplevel_keymap_.reset(new kb_keymap); + pimpl_->toplevel_keymap_.reset(new KeyMap); defaultKeyBindings(pimpl_->toplevel_keymap_.get()); pimpl_->toplevel_keymap_->read(lyxrc.bind_file); @@ -938,7 +938,7 @@ bool LyX::init() } -void LyX::defaultKeyBindings(kb_keymap * kbmap) +void LyX::defaultKeyBindings(KeyMap * kbmap) { kbmap->bind("Right", FuncRequest(LFUN_CHAR_FORWARD)); kbmap->bind("Left", FuncRequest(LFUN_CHAR_BACKWARD)); @@ -1007,7 +1007,7 @@ void LyX::emergencyCleanup() const } -void LyX::deadKeyBindings(kb_keymap * kbmap) +void LyX::deadKeyBindings(KeyMap * kbmap) { // bindKeyings for transparent handling of deadkeys // The keysyms are gotten from XFree86 X11R6 @@ -1480,7 +1480,7 @@ LyXServerSocket & theLyXServerSocket() } -kb_keymap & theTopLevelKeymap() +KeyMap & theTopLevelKeymap() { BOOST_ASSERT(use_gui); return LyX::ref().topLevelKeymap(); diff --git a/src/LyX.h b/src/LyX.h index 33f9924179..f2e27a3498 100644 --- a/src/LyX.h +++ b/src/LyX.h @@ -34,7 +34,7 @@ class Messages; class Mover; class Movers; class Session; -class kb_keymap; +class KeyMap; extern bool use_gui; @@ -77,8 +77,8 @@ public: frontend::Application const & application() const; /// - kb_keymap & topLevelKeymap(); - kb_keymap const & topLevelKeymap() const; + KeyMap & topLevelKeymap(); + KeyMap const & topLevelKeymap() const; /// Converters & converters(); @@ -130,9 +130,9 @@ private: /// initial LyX set up bool init(); /// set up the default key bindings - void defaultKeyBindings(kb_keymap * kbmap); + void defaultKeyBindings(KeyMap * kbmap); /// set up the default dead key bindings if requested - void deadKeyBindings(kb_keymap * kbmap); + void deadKeyBindings(KeyMap * kbmap); /** Check for the existence of the user's support directory and, * if not present, create it. Exits the program if the directory * cannot be created. diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index db3f8e2fc0..c1355cc70a 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -42,7 +42,7 @@ #include "Importer.h" #include "InsetIterator.h" #include "Intl.h" -#include "kb_keymap.h" +#include "KeyMap.h" #include "Language.h" #include "Color.h" #include "Session.h" @@ -207,7 +207,7 @@ LyXFunc::LyXFunc() } -void LyXFunc::initKeySequences(kb_keymap * kb) +void LyXFunc::initKeySequences(KeyMap * kb) { keyseq.reset(new kb_sequence(kb, kb)); cancel_meta_seq.reset(new kb_sequence(kb, kb)); diff --git a/src/LyXFunc.h b/src/LyXFunc.h index ec31fc2634..370ce6ab7f 100644 --- a/src/LyXFunc.h +++ b/src/LyXFunc.h @@ -51,7 +51,7 @@ public: void setLyXView(LyXView * lv); /// - void initKeySequences(kb_keymap * kb); + void initKeySequences(KeyMap * kb); /// return the status bar state string docstring const viewStatusMessage(); diff --git a/src/Makefile.am b/src/Makefile.am index 088efd0539..d0df97ba1a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -146,8 +146,8 @@ lyx_SOURCES = \ InsetList.h \ Intl.cpp \ Intl.h \ - kb_keymap.cpp \ - kb_keymap.h \ + KeyMap.cpp \ + KeyMap.h \ kb_sequence.cpp \ kb_sequence.h \ KmodInfo.h \ diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index c96568350a..6250e49d46 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -29,7 +29,7 @@ #include "Format.h" #include "gettext.h" #include "Importer.h" -#include "kb_keymap.h" +#include "KeyMap.h" #include "Session.h" #include "LyXAction.h" #include "LyX.h" // for lastfiles @@ -139,7 +139,7 @@ docstring const MenuItem::binding(bool forgui) const // Get the keys bound to this action, but keep only the // first one later - kb_keymap::Bindings bindings = theTopLevelKeymap().findbindings(func_); + KeyMap::Bindings bindings = theTopLevelKeymap().findbindings(func_); if (bindings.size()) { return bindings.begin()->print(forgui); diff --git a/src/kb_sequence.cpp b/src/kb_sequence.cpp index a51444789d..145fffe7ad 100644 --- a/src/kb_sequence.cpp +++ b/src/kb_sequence.cpp @@ -15,7 +15,7 @@ #include "kb_sequence.h" #include "gettext.h" -#include "kb_keymap.h" +#include "KeyMap.h" #include "lfuns.h" #include "frontends/LyXKeySym.h" diff --git a/src/kb_sequence.h b/src/kb_sequence.h index 52883d689a..9c12e3bd9d 100644 --- a/src/kb_sequence.h +++ b/src/kb_sequence.h @@ -22,7 +22,7 @@ namespace lyx { -class kb_keymap; +class KeyMap; class FuncRequest; /// Holds a key sequence and the current and standard keymaps @@ -30,10 +30,10 @@ class kb_sequence { public: typedef std::vector KeySequence; - friend class kb_keymap; + friend class KeyMap; /// - kb_sequence(kb_keymap * std, kb_keymap * cur) + kb_sequence(KeyMap * std, KeyMap * cur) : stdmap(std), curmap(cur), deleted_(false) {} /** @@ -96,10 +96,10 @@ public: } /// Keymap to use if a new sequence is starting - kb_keymap * stdmap; + KeyMap * stdmap; /// Keymap to use for the next key - kb_keymap * curmap; + KeyMap * curmap; private: /**