s/kb_action/FuncCode/g

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23749 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-15 01:20:36 +00:00
parent b607775ad7
commit a98f82c292
31 changed files with 219 additions and 226 deletions

View File

@ -23,9 +23,9 @@
#include "DispatchResult.h"
#include "Encoding.h"
#include "Font.h"
#include "FuncCode.h"
#include "FuncRequest.h"
#include "Language.h"
#include "lfuns.h"
#include "LyXFunc.h" // only for setMessage()
#include "LyXRC.h"
#include "paragraph_funcs.h"

View File

@ -22,11 +22,11 @@
#include "Changes.h"
#include "Cursor.h"
#include "ErrorList.h"
#include "FuncCode.h"
#include "FuncRequest.h"
#include "InsetIterator.h"
#include "InsetList.h"
#include "Language.h"
#include "lfuns.h"
#include "LyXFunc.h"
#include "LyXRC.h"
#include "Text.h"

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file lfuns.h
* \file FuncCode.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -13,11 +13,8 @@
* - add correct test to the corresponding ::getStatus() method
*/
#ifndef LFUNS_H
#define LFUNS_H
#include "support/strfwd.h"
#ifndef FUNCCODE_H
#define FUNCCODE_H
namespace lyx {
@ -29,7 +26,8 @@ namespace lyx {
* BufferView::dispatch(), Cursor::dispatch() and
* Inset*::doDispatch();
*/
enum kb_action {
enum FuncCode
{
LFUN_UNKNOWN_ACTION = -1,
// 0
LFUN_NOACTION = 0,
@ -424,4 +422,4 @@ enum kb_action {
} // namespace lyx
#endif // LFUNS_H
#endif // FUNCCODE_H

View File

@ -29,24 +29,24 @@ FuncRequest::FuncRequest(Origin o)
{}
FuncRequest::FuncRequest(kb_action act, Origin o)
FuncRequest::FuncRequest(FuncCode act, Origin o)
: action(act), origin(o), x(0), y(0), button_(mouse_button::none)
{}
FuncRequest::FuncRequest(kb_action act, docstring const & arg, Origin o)
FuncRequest::FuncRequest(FuncCode act, docstring const & arg, Origin o)
: action(act), argument_(arg), origin(o), x(0), y(0),
button_(mouse_button::none)
{}
FuncRequest::FuncRequest(kb_action act, string const & arg, Origin o)
FuncRequest::FuncRequest(FuncCode act, string const & arg, Origin o)
: action(act), argument_(from_utf8(arg)), origin(o), x(0), y(0),
button_(mouse_button::none)
{}
FuncRequest::FuncRequest(kb_action act, int ax, int ay,
FuncRequest::FuncRequest(FuncCode act, int ax, int ay,
mouse_button::state but, Origin o)
: action(act), origin(o), x(ax), y(ay), button_(but)
{}

View File

@ -12,20 +12,21 @@
#ifndef FUNCREQUEST_H
#define FUNCREQUEST_H
#include "lfuns.h"
#include "frontends/mouse_state.h"
#include "FuncCode.h"
#include "support/docstring.h"
#include "frontends/mouse_state.h"
namespace lyx {
/**
* This class encapsulates a LyX action and its argument
* in order to pass it around easily.
*/
class FuncRequest {
class FuncRequest
{
public:
/// Where the request came from
enum Origin {
@ -39,15 +40,15 @@ public:
/// just for putting these things in std::container
explicit FuncRequest(Origin o = INTERNAL);
/// actions without extra argument
explicit FuncRequest(kb_action act, Origin o = INTERNAL);
explicit FuncRequest(FuncCode act, Origin o = INTERNAL);
/// actions without extra argument
FuncRequest(kb_action act, int x, int y, mouse_button::state button,
FuncRequest(FuncCode act, int x, int y, mouse_button::state button,
Origin o = INTERNAL);
/// actions with extra argument
FuncRequest(kb_action act, docstring const & arg,
FuncRequest(FuncCode act, docstring const & arg,
Origin o = INTERNAL);
/// actions with extra argument. FIXME: remove this
FuncRequest(kb_action act, std::string const & arg,
FuncRequest(FuncCode act, std::string const & arg,
Origin o = INTERNAL);
/// for changing requests a bit
FuncRequest(FuncRequest const & cmd, docstring const & arg,
@ -71,7 +72,7 @@ public:
static FuncRequest const noaction;
public: // should be private
/// the action
kb_action action;
FuncCode action;
private:
/// the action's string argument
docstring argument_;

View File

@ -261,7 +261,7 @@ void KeyMap::write(string const & bind_file, bool append, bool unbind) const
BindingList::const_iterator it = list.begin();
BindingList::const_iterator it_end = list.end();
for (; it != it_end; ++it) {
kb_action action = it->request.action;
FuncCode action = it->request.action;
string arg = to_utf8(it->request.argument());
os << tag << " \""
@ -476,7 +476,7 @@ KeyMap::BindingList KeyMap::listBindings(bool unbound, int tag) const
LyXAction::const_func_iterator fit = lyxaction.func_begin();
LyXAction::const_func_iterator fit_end = lyxaction.func_end();
for (; fit != fit_end; ++fit) {
kb_action action = fit->second;
FuncCode action = fit->second;
bool has_action = false;
BindingList::const_iterator it = list.begin();
BindingList::const_iterator it_end = list.end();

View File

@ -13,10 +13,9 @@
#include <config.h>
#include "KeySequence.h"
#include "KeyMap.h"
#include "support/gettext.h"
#include "KeyMap.h"
#include "lfuns.h"
#include "frontends/KeySymbol.h"
@ -38,9 +37,8 @@ FuncRequest const & KeySequence::addkey(KeySymbol const & key,
modifiers.push_back(make_pair(mod, nmod));
sequence.push_back(key);
if (curmap) {
if (curmap)
return curmap->lookup(key, mod, this);
}
static FuncRequest unknown(LFUN_UNKNOWN_ACTION);
return unknown;

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
#ifndef LYXACTION_H
#define LYXACTION_H
#include "lfuns.h"
#include "FuncCode.h"
#include <map>
#include <string>
@ -26,7 +26,7 @@ class FuncRequest;
/**
* This class is a container for LyX actions. It also
* stores and managers "pseudo-actions". Pseudo-actions
* are not part of the kb_action enum, but are created
* are not part of the FuncCode enum, but are created
* dynamically, for encapsulating a real action and an
* argument. They are used for things like the menus.
*/
@ -44,7 +44,7 @@ public:
private:
/// information for an action
struct func_info {
struct FuncInfo {
/// the action name
std::string name;
/// the func_attrib values set
@ -59,9 +59,9 @@ public:
void operator=(LyXAction const &);
/// type for map between a function name and its action
typedef std::map<std::string, kb_action> func_map;
typedef std::map<std::string, FuncCode> func_map;
/// type for map between an action and its info
typedef std::map<kb_action, func_info> info_map;
typedef std::map<FuncCode, FuncInfo> info_map;
/// possible "permissions" for an action
enum func_attrib {
@ -83,12 +83,12 @@ public:
FuncRequest lookupFunc(std::string const & func_name) const;
/// Return the name (and argument) associated with the given (pseudo) action
std::string const getActionName(kb_action action) const;
std::string const getActionName(FuncCode action) const;
func_type const getActionType(kb_action action) const;
func_type const getActionType(FuncCode action) const;
/// True if the command has `flag' set
bool funcHasFlag(kb_action action, func_attrib flag) const;
bool funcHasFlag(FuncCode action, func_attrib flag) const;
/// iterator across all real actions
typedef func_map::const_iterator const_func_iterator;
@ -103,7 +103,7 @@ private:
/// populate the action container with our actions
void init();
/// add the given action
void newFunc(kb_action, std::string const & name, unsigned int attrib, func_type type);
void newFunc(FuncCode, std::string const & name, unsigned int attrib, func_type type);
/**
* This is a list of all the LyXFunc names with the

View File

@ -216,7 +216,7 @@ void LyXFunc::setLyXView(LyXView * lv)
}
void LyXFunc::handleKeyFunc(kb_action action)
void LyXFunc::handleKeyFunc(FuncCode action)
{
char_type c = encoded_last_key;
@ -737,7 +737,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
void LyXFunc::dispatch(FuncRequest const & cmd)
{
string const argument = to_utf8(cmd.argument());
kb_action const action = cmd.action;
FuncCode const action = cmd.action;
LYXERR(Debug::ACTION, "\nLyXFunc::dispatch: cmd: " << cmd);
//lyxerr << "LyXFunc::dispatch: cmd: " << cmd << endl;
@ -1810,7 +1810,7 @@ void LyXFunc::setMessage(docstring const & m) const
}
docstring const LyXFunc::viewStatusMessage()
docstring LyXFunc::viewStatusMessage()
{
// When meta-fake key is pressed, show the key sequence so far + "M-".
if (wasMetaKey())

View File

@ -15,8 +15,8 @@
#ifndef LYXFUNC_H
#define LYXFUNC_H
#include "FuncCode.h"
#include "KeySequence.h"
#include "lfuns.h"
#include "support/docstring.h"
@ -60,7 +60,7 @@ public:
void initKeySequences(KeyMap * kb);
/// return the status bar state string
docstring const viewStatusMessage();
docstring viewStatusMessage();
///
void processKeySym(KeySymbol const & key, KeyModifier state);
@ -80,7 +80,7 @@ public:
/// Buffer to store result messages
docstring const getMessage() const { return dispatch_buffer; }
/// Handle a accented char key sequence
void handleKeyFunc(kb_action action);
void handleKeyFunc(FuncCode action);
/// goto a bookmark
/// openFile: whether or not open a file if the file is not opened
/// switchToBuffer: whether or not switch to buffer if the buffer is
@ -88,13 +88,9 @@ public:
void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
/// cursor x position before dispatch started
int cursorBeforeDispatchX() const {
return cursorPosBeforeDispatchX_;
}
int cursorBeforeDispatchX() const { return cursorPosBeforeDispatchX_; }
/// cursor y position before dispatch started
int cursorBeforeDispatchY() const {
return cursorPosBeforeDispatchY_;
}
int cursorBeforeDispatchY() const { return cursorPosBeforeDispatchY_; }
private:
///

View File

@ -141,12 +141,12 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
case TO_MINIBUFFER:
add(ToolbarItem(ToolbarItem::MINIBUFFER,
FuncRequest(kb_action(ToolbarItem::MINIBUFFER))));
FuncRequest(FuncCode(ToolbarItem::MINIBUFFER))));
break;
case TO_SEPARATOR:
add(ToolbarItem(ToolbarItem::SEPARATOR,
FuncRequest(kb_action(ToolbarItem::SEPARATOR))));
FuncRequest(FuncCode(ToolbarItem::SEPARATOR))));
break;
case TO_POPUPMENU:
@ -169,14 +169,14 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
case TO_LAYOUTS:
add(ToolbarItem(ToolbarItem::LAYOUTS,
FuncRequest(kb_action(ToolbarItem::LAYOUTS))));
FuncRequest(FuncCode(ToolbarItem::LAYOUTS))));
break;
case TO_TABLEINSERT:
if (lex.next(true)) {
docstring const tooltip = lex.getDocString();
add(ToolbarItem(ToolbarItem::TABLEINSERT,
FuncRequest(kb_action(ToolbarItem::TABLEINSERT)), tooltip));
FuncRequest(FuncCode(ToolbarItem::TABLEINSERT)), tooltip));
}
break;

View File

@ -67,7 +67,7 @@ namespace lyx {
| | semivoiced_sound | |
| | |LFUN_ACCENT_SPECIAL_CARON| special caron
*/
static tex_accent_struct lyx_accent_table[] = {
static TeXAccent lyx_accent_table[] = {
{TEX_NOACCENT, 0, "", LFUN_NOACTION},
{TEX_ACUTE, 0x0301, "acute", LFUN_ACCENT_ACUTE},
{TEX_GRAVE, 0x0300, "grave", LFUN_ACCENT_GRAVE},
@ -90,7 +90,7 @@ static tex_accent_struct lyx_accent_table[] = {
};
tex_accent_struct get_accent(kb_action action)
TeXAccent get_accent(FuncCode action)
{
int i = 0;
while (i <= TEX_MAX_ACCENT) {
@ -98,8 +98,8 @@ tex_accent_struct get_accent(kb_action action)
return lyx_accent_table[i];
++i;
}
struct tex_accent_struct temp = { static_cast<tex_accent>(0), 0,
0, static_cast<kb_action>(0)};
struct TeXAccent temp = { static_cast<tex_accent>(0), 0,
0, static_cast<FuncCode>(0)};
return temp;
}

View File

@ -14,7 +14,8 @@
#ifndef TRANS_H
#define TRANS_H
#include "lfuns.h"
#include "FuncCode.h"
#include "support/docstring.h"
#include <list>
@ -70,7 +71,7 @@ enum tex_accent {
};
struct tex_accent_struct {
struct TeXAccent {
///
tex_accent accent;
/// UCS4 code point of this accent
@ -78,11 +79,11 @@ struct tex_accent_struct {
///
char const * name;
///
kb_action action;
FuncCode action;
};
///
extern tex_accent_struct get_accent(kb_action action);
extern TeXAccent get_accent(FuncCode action);
///
@ -162,8 +163,7 @@ private:
///
inline
docstring const & Trans::match(char_type c)
inline docstring const & Trans::match(char_type c)
{
std::map<char_type, docstring>::iterator it = keymap_.find(c);
if (it != keymap_.end()) {

View File

@ -12,7 +12,7 @@
#ifndef DIALOG_H
#define DIALOG_H
#include "lfuns.h"
#include "FuncCode.h"
#include <QString>
#include <string>
@ -164,7 +164,7 @@ public:
* It should be used in dispatchParams(), too for consistency reasons.
* \returns the lfun that is sent for applying the data.
*/
virtual kb_action getLfun() const { return LFUN_INSET_APPLY; }
virtual FuncCode getLfun() const { return LFUN_INSET_APPLY; }
/** Check whether we may apply our data.
*

View File

@ -57,7 +57,7 @@ public:
};
FileDialog::FileDialog(QString const & t, kb_action s)
FileDialog::FileDialog(QString const & t, FuncCode s)
: private_(new FileDialog::Private), title_(t), success_(s)
{}

View File

@ -13,7 +13,7 @@
#ifndef FILEDIALOG_H
#define FILEDIALOG_H
#include "lfuns.h"
#include "FuncCode.h"
#include <QString>
@ -54,7 +54,7 @@ public:
* additional directories in the navigation (an empty
* directory is interpreted as FileName::getcwd())
*/
FileDialog(QString const & title, kb_action a = LFUN_SELECT_FILE_SYNC);
FileDialog(QString const & title, FuncCode a = LFUN_SELECT_FILE_SYNC);
~FileDialog();
@ -84,7 +84,7 @@ private:
QString title_;
/// success action to perform if not synchronous
kb_action success_;
FuncCode success_;
};
} // namespace lyx

View File

@ -77,7 +77,7 @@ private:
///
bool isBufferDependent() const { return true; }
///
kb_action getLfun() const { return LFUN_FONT_FREE_UPDATE; }
FuncCode getLfun() const { return LFUN_FONT_FREE_UPDATE; }
///
void setFamily(FontFamily);

View File

@ -2235,7 +2235,7 @@ DocumentClass const & GuiDocument::documentClass() const
static void dispatch_bufferparams(Dialog const & dialog,
BufferParams const & bp, kb_action lfun)
BufferParams const & bp, FuncCode lfun)
{
ostringstream ss;
ss << "\\begin_header\n";

View File

@ -63,7 +63,7 @@ GuiMath::GuiMath(GuiView & lv, QString const & name, QString const & title)
}
void GuiMath::dispatchFunc(kb_action action, string const & arg) const
void GuiMath::dispatchFunc(FuncCode action, string const & arg) const
{
dispatch(FuncRequest(action, arg));
}

View File

@ -13,7 +13,7 @@
#define GUIMATH_H
#include "GuiDialog.h"
#include "lfuns.h" // for kb_action
#include "FuncCode.h"
#include "FontEnums.h"
#include <map>
@ -45,7 +45,7 @@ public:
bool isBufferDependent() const { return true; }
/// dispatch an LFUN
void dispatchFunc(kb_action action,
void dispatchFunc(FuncCode action,
std::string const & arg = std::string()) const;
/// Insert a math symbol into the doc.
void dispatchInsert(std::string const & name) const;

View File

@ -48,7 +48,7 @@ public:
void dispatchParams();
void enableView(bool enable);
bool isBufferDependent() const { return true; }
virtual kb_action getLfun() const { return LFUN_PARAGRAPH_PARAMS_APPLY; }
virtual FuncCode getLfun() const { return LFUN_PARAGRAPH_PARAMS_APPLY; }
//@}
private:

View File

@ -2055,7 +2055,7 @@ void PrefShortcuts::setItemType(QTreeWidgetItem * item, item_type tag)
QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun,
KeySequence const & seq, item_type tag)
{
kb_action action = lfun.action;
FuncCode action = lfun.action;
string const action_name = lyxaction.getActionName(action);
QString const lfun_name = toqstr(from_utf8(action_name)
+ " " + lfun.argument());

View File

@ -19,8 +19,8 @@
#include "ColorCode.h"
#include "Converter.h"
#include "Format.h"
#include "FuncCode.h"
#include "KeyMap.h"
#include "lfuns.h"
#include "LyXRC.h"
#include "Mover.h"

View File

@ -55,7 +55,7 @@ private:
///
bool canApplyToReadOnly() const { return true; }
///
kb_action getLfun() const { return LFUN_BUFFER_PRINT; }
FuncCode getLfun() const { return LFUN_BUFFER_PRINT; }
///
PrinterParams params_;

View File

@ -57,7 +57,7 @@ private:
///
bool isBufferDependent() const { return true; }
///
kb_action getLfun() const { return LFUN_BUFFER_EXPORT_CUSTOM; }
FuncCode getLfun() const { return LFUN_BUFFER_EXPORT_CUSTOM; }
/// Return a vector of those formats that can be exported from "lyx".
std::vector<Format const *> allFormats() const;

View File

@ -36,7 +36,7 @@ public:
void dispatchParams();
void enableView(bool enable);
bool isBufferDependent() const { return true; }
virtual kb_action getLfun() const { return LFUN_SELF_INSERT; }
virtual FuncCode getLfun() const { return LFUN_SELF_INSERT; }
//@}
public Q_SLOTS:

View File

@ -86,7 +86,7 @@ private:
///
bool isBufferDependent() const { return true; }
///
kb_action getLfun() const { return LFUN_TABULAR_FEATURE; }
FuncCode getLfun() const { return LFUN_TABULAR_FEATURE; }
///
Tabular::idx_type getActiveCell() const;

View File

@ -44,7 +44,7 @@ private:
///
bool isBufferDependent() const { return true; }
///
kb_action getLfun() const { return LFUN_TABULAR_INSERT; }
FuncCode getLfun() const { return LFUN_TABULAR_INSERT; }
///
typedef std::pair<size_t, size_t> rowsCols;

View File

@ -682,7 +682,7 @@ void MenuDefinition::expandFormats(MenuItem::Kind kind, Buffer const * buf)
typedef vector<Format const *> Formats;
Formats formats;
kb_action action;
FuncCode action;
switch (kind) {
case MenuItem::ImportFormats:
@ -1228,7 +1228,7 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb)
* the hassle, though. (JMarc)
*/
struct MacMenuEntry {
kb_action action;
FuncCode action;
char const * arg;
char const * label;
QAction::MenuRole role;

View File

@ -594,7 +594,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
// reverseDirectionNeeded() function
bool forward;
kb_action finish_lfun;
FuncCode finish_lfun;
if (cmd.action == LFUN_CHAR_FORWARD
|| cmd.action == LFUN_CHAR_FORWARD_SELECT) {