10 #include "commandtags.h"
13 /** This class encapsulates LyX action and user command operations.
31 typedef map<string, kb_action, less<string> > func_map;
33 typedef map<kb_action, func_info, less<kb_action> > info_map;
35 typedef map<unsigned int, pseudo_func, less<unsigned int> > pseudo_map;
37 typedef map<string, unsigned int, less<string> > arg_item;
39 typedef map<kb_action, arg_item, less<kb_action> > arg_map;
43 /// nothing special about this func
45 /// can not be used in RO mode (perhaps this should change)
47 /// Can be used when there is no document open
49 //Interactive = 2, // Is interactive (requires a GUI)
50 Argument=4 // Requires argument
51 //MathOnly = 8, // Only math mode
52 //EtcEtc = ... // Or other attributes...
58 /** Returns an action tag from a string. Returns kb_action.
59 Include arguments in func_name ONLY if you
60 want to create new pseudo actions. */
61 int LookupFunc(string const & func_name) const;
63 /** Returns an action tag which name is the most similar to a string.
64 Don't include arguments, they would be ignored. */
65 int getApproxFunc(string const & func) const;
67 /** Returns an action name the most similar to a string.
68 Don't include arguments, they would be ignored. */
69 string getApproxFuncName(string const & func) const;
71 /// Returns a pseudo-action given an action and its argument.
72 int getPseudoAction(kb_action action, string const & arg) const;
74 /// Retrieves the real action and its argument.
75 kb_action retrieveActionArg(int i, string & arg) const;
77 /// Search for an existent pseudoaction, return -1 if it doesn't exist.
78 int searchActionArg(kb_action action, string const & arg) const;
80 /// Check if a value is a pseudo-action.
81 bool isPseudoAction(int) const;
83 /// Return the name associated with command
84 string getActionName(int action) const;
86 /// Return one line help text associated with (pseudo)action
87 string helpText(int action) const;
89 /// True if the command has `flag' set
90 bool funcHasFlag(kb_action action, func_attrib flag) const;
96 void newFunc(kb_action, string const & name,
97 string const & helpText, unsigned int attrib);
99 /** This is a list of all the LyXFunc names with the
100 coresponding action number. It is usually only used by the
101 minibuffer or when assigning commands to keys during init. */
102 func_map lyx_func_map;
104 /** This is a mapping from action number to an object holding
105 info about this action. f.ex. helptext, command name (string),
106 command attributes (ro) */
107 info_map lyx_info_map;
109 /** A mapping from the automatically created pseudo action number
110 to the real action and its argument. */
111 mutable pseudo_map lyx_pseudo_map;
113 /** A (multi) mapping from the lyx action to all the generated
114 pseudofuncs and the arguments the action should use. */
115 mutable arg_map lyx_arg_map;
119 /* -------------------- Inlines ------------------ */
123 bool LyXAction::isPseudoAction(int a) const
125 return a > int(LFUN_LASTACTION);