4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
24 // current LFUN format
25 static unsigned int const LFUN_FORMAT = 5; // spitz: 2.4.x changes
31 * This class is a container for LyX actions. It associates a name to
32 * most of them and describes some of their properties.
36 /// category of an action, used in the Shortcuts dialog
38 Hidden, //< Not listed for configuration
39 Edit, //< Cursor and mouse movement, copy/paste etc
41 Buffer, //< Buffer and window related
42 Layout, //< Font, Layout and textclass related
43 System //< Lyx preference, server etc
47 /// information for an action
51 /// the FuncAttribs values set
53 /// the category of this func
56 /// type for map between a function name and its action
57 typedef std::map<std::string, FuncCode> FuncMap;
58 /// type for map between an action and its info
59 typedef std::map<FuncCode, FuncInfo> InfoMap;
62 /// possible "permissions" for an action
64 Noop = 0, //< Nothing special about this func
65 ReadOnly = 1, //< Can be used in RO mode (perhaps this should change)
66 NoBuffer = 2, //< Can be used when there is no document open
67 Argument = 4, //< Requires argument
68 NoUpdate = 8, //< Does not (usually) require update
69 SingleParUpdate = 16, //< Usually only requires this par updated
70 AtPoint = 32, //< dispatch first to inset at cursor if there is one
71 NoInternal = 64 //< Cannot be used for internal, non-document Buffers
77 * Creates a FuncRequest from a string of the form:
78 * lyx-function [argument]
79 * where the argument is optional and "lyx-function" is in the form you'd
80 * enter it in the mini-buffer.
82 FuncRequest lookupFunc(std::string const & func_name) const;
84 /// Return the command name associated with the given action
85 /// Thus: getActionName(LFUN_ERT_INSERT) --> "ert-insert".
86 std::string const getActionName(FuncCode action) const;
88 FuncType getActionType(FuncCode action) const;
90 /// True if the command has `flag' set
91 bool funcHasFlag(FuncCode action, FuncAttribs flag) const;
93 /// iterator across all LFUNs
94 typedef FuncMap::const_iterator const_iterator;
96 /// return an iterator to the start of the list of LFUNs
97 const_iterator begin() const;
99 /// return an iterator to one past the end of the list of LFUNs
100 const_iterator end() const;
104 LyXAction(LyXAction const &);
105 void operator=(LyXAction const &);
107 /// populate the action container with our actions
109 /// add the given action
110 void newFunc(FuncCode, std::string const & name, unsigned int attrib, FuncType type);
113 * This maps LyX function names to function codes, e.g.:
114 * lyx_func_map["ert-insert"] == LFUN_ERT_INSERT
116 FuncMap lyx_func_map;
119 * This maps function codes to objects holding info about the corresponding
121 * FuncInfo const & ert = lyx_info_map[LFUN_ERT_INSERT];
123 * ert.name == "ert-insert"'
127 InfoMap lyx_info_map;
130 LyXErr & operator<<(LyXErr &, FuncCode);
132 /// singleton instance
133 extern LyXAction lyxaction;
138 #endif // LYXACTION_H