mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
rename kb_keymap into KeyMap
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18056 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a918cc2543
commit
1d6c4787f9
@ -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 <config.h>
|
||||
|
||||
#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<LyXKeySym const *, key_modifier::state>
|
||||
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();
|
@ -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<kb_keymap> table;
|
||||
boost::shared_ptr<KeyMap> 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<kb_key> Table;
|
||||
typedef std::vector<Key> Table;
|
||||
///
|
||||
Table table;
|
||||
};
|
||||
|
||||
/// Implementation is in LyX.cpp
|
||||
extern kb_keymap & theTopLevelKeymap();
|
||||
extern KeyMap & theTopLevelKeymap();
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif // KB_KEYMAP_H
|
||||
#endif // KEYMAP_H
|
16
src/LyX.cpp
16
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<kb_keymap> toplevel_keymap_;
|
||||
boost::scoped_ptr<KeyMap> toplevel_keymap_;
|
||||
///
|
||||
boost::scoped_ptr<LyXServer> 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();
|
||||
|
10
src/LyX.h
10
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.
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
|
@ -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 \
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -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<LyXKeySymPtr> 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:
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user