3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
11 * Full author contact details are available in file CREDITS.
16 #include "LyXAction.h"
18 #include "support/debug.h"
19 #include "FuncRequest.h"
21 #include "support/lstrings.h"
23 #include <boost/assert.hpp>
26 using namespace lyx::support;
31 NAMING RULES FOR USER-COMMANDS
32 Here's the set of rules to apply when a new command name is introduced:
34 1) Use the object.event order. That is, use `word-forward'
35 instead of `forward-word'.
36 2) Don't introduce an alias for an already named object. Same for events.
37 3) Forward movement or focus is called `forward' (not `right').
38 4) Backward movement or focus is called `backward' (not `left').
39 5) Upward movement of focus is called `up'.
40 6) Downward movement is called `down'.
41 7) The begin of an object is called `begin' (not `start').
42 8) The end of an object is called `end'.
44 (May 19 1996, 12:04, RvdK)
50 void LyXAction::newFunc(kb_action action, string const & name,
51 unsigned int attrib, LyXAction::func_type type)
53 lyx_func_map[name] = action;
56 tmpinfo.attrib = attrib;
58 lyx_info_map[action] = tmpinfo;
62 void LyXAction::init()
64 // This function was changed to use the array below in initalization
65 // instead of calling newFunc numerous times because of compilation
66 // times. Since the array is not static we get back the memory it
67 // occupies after the init is completed. It compiles several
80 ev_item const items[] = {
81 { LFUN_ACCENT_ACUTE, "accent-acute", Noop, Layout },
82 { LFUN_ACCENT_BREVE, "accent-breve", Noop, Layout },
83 { LFUN_ACCENT_CARON, "accent-caron", Noop, Layout },
84 { LFUN_ACCENT_CEDILLA, "accent-cedilla", Noop, Layout },
85 { LFUN_ACCENT_CIRCLE, "accent-circle", Noop, Layout },
86 { LFUN_ACCENT_CIRCUMFLEX, "accent-circumflex", Noop, Layout },
87 { LFUN_ACCENT_DOT, "accent-dot", Noop, Layout },
88 { LFUN_ACCENT_GRAVE, "accent-grave", Noop, Layout },
89 { LFUN_ACCENT_HUNGARIAN_UMLAUT, "accent-hungarian-umlaut", Noop, Layout },
90 { LFUN_ACCENT_MACRON, "accent-macron", Noop, Layout },
91 { LFUN_ACCENT_OGONEK, "accent-ogonek", Noop, Layout },
92 { LFUN_ACCENT_SPECIAL_CARON, "accent-special-caron", Noop, Layout },
93 { LFUN_ACCENT_TIE, "accent-tie", Noop, Layout },
94 { LFUN_ACCENT_TILDE, "accent-tilde", Noop, Layout },
95 { LFUN_ACCENT_UMLAUT, "accent-umlaut", Noop, Layout },
96 { LFUN_ACCENT_UNDERBAR, "accent-underbar", Noop, Layout },
97 { LFUN_ACCENT_UNDERDOT, "accent-underdot", Noop, Layout },
98 { LFUN_APPENDIX, "appendix", Noop, Edit },
99 { LFUN_BOOKMARK_GOTO, "bookmark-goto", NoBuffer, Edit },
100 { LFUN_BOOKMARK_SAVE, "bookmark-save", ReadOnly, Edit },
101 { LFUN_BOOKMARK_CLEAR, "bookmark-clear", NoBuffer, Edit },
102 { LFUN_BREAK_PARAGRAPH, "break-paragraph", Noop, Edit },
103 { LFUN_BREAK_PARAGRAPH_SKIP, "break-paragraph-skip", Noop, Edit },
104 { LFUN_BUILD_PROGRAM, "build-program", ReadOnly, Buffer },
105 { LFUN_BUFFER_AUTO_SAVE, "buffer-auto-save", Noop, Buffer },
106 { LFUN_BUFFER_BEGIN, "buffer-begin", ReadOnly, Edit },
107 { LFUN_BUFFER_BEGIN_SELECT, "buffer-begin-select", ReadOnly, Edit },
108 { LFUN_BUFFER_CHILD_OPEN, "buffer-child-open", ReadOnly, Buffer },
109 { LFUN_BUFFER_CHKTEX, "buffer-chktex", ReadOnly, Buffer },
110 { LFUN_BUFFER_TOGGLE_COMPRESSION, "buffer-toggle-compression", Noop, Buffer },
111 { LFUN_BUFFER_CLOSE, "buffer-close", ReadOnly, Buffer },
112 { LFUN_BUFFER_END, "buffer-end", ReadOnly, Edit },
113 { LFUN_BUFFER_END_SELECT, "buffer-end-select", ReadOnly, Edit },
114 { LFUN_BUFFER_EXPORT, "buffer-export", ReadOnly, Buffer },
115 { LFUN_BUFFER_EXPORT_CUSTOM, "buffer-export-custom", ReadOnly, Buffer },
116 { LFUN_BUFFER_PRINT, "buffer-print", ReadOnly, Buffer },
117 { LFUN_BUFFER_IMPORT, "buffer-import", NoBuffer, Buffer },
118 { LFUN_BUFFER_NEW, "buffer-new", NoBuffer, Buffer },
119 { LFUN_BUFFER_NEW_TEMPLATE,"buffer-new-template", NoBuffer, Buffer },
120 { LFUN_BUFFER_RELOAD, "buffer-reload", ReadOnly, Buffer },
121 { LFUN_BUFFER_SWITCH, "buffer-switch", NoBuffer | ReadOnly, Edit },
122 { LFUN_BUFFER_TOGGLE_READ_ONLY, "buffer-toggle-read-only", ReadOnly, Buffer },
123 { LFUN_BUFFER_UPDATE, "buffer-update", ReadOnly, Edit },
124 { LFUN_BUFFER_VIEW, "buffer-view", ReadOnly, Edit },
125 { LFUN_MASTER_BUFFER_UPDATE, "master-buffer-update", ReadOnly, Edit },
126 { LFUN_MASTER_BUFFER_VIEW, "master-buffer-view", ReadOnly, Edit },
127 { LFUN_BUFFER_WRITE, "buffer-write", ReadOnly, Buffer },
128 { LFUN_BUFFER_WRITE_AS, "buffer-write-as", ReadOnly, Buffer },
129 { LFUN_BUFFER_WRITE_ALL, "buffer-write-all", ReadOnly, Buffer },
130 { LFUN_CALL, "call", NoBuffer, System },
131 { LFUN_CANCEL, "cancel", NoBuffer, System },
132 { LFUN_CAPTION_INSERT, "caption-insert", Noop, Edit },
133 { LFUN_CHAR_BACKWARD, "char-backward", ReadOnly | NoUpdate, Edit },
134 { LFUN_CHAR_BACKWARD_SELECT, "char-backward-select", ReadOnly | SingleParUpdate, Edit },
135 { LFUN_CHAR_DELETE_BACKWARD, "delete-backward", SingleParUpdate, Edit },
136 { LFUN_CHAR_DELETE_FORWARD, "delete-forward", SingleParUpdate, Edit },
137 { LFUN_CHAR_FORWARD, "char-forward", ReadOnly | NoUpdate, Edit },
138 { LFUN_CHAR_FORWARD_SELECT, "char-forward-select", ReadOnly | SingleParUpdate, Edit },
139 { LFUN_CHAR_LEFT, "char-left", ReadOnly | NoUpdate, Edit },
140 { LFUN_CHAR_LEFT_SELECT, "char-left-select", ReadOnly | SingleParUpdate, Edit },
141 { LFUN_CHAR_RIGHT, "char-right", ReadOnly | NoUpdate, Edit },
142 { LFUN_CHAR_RIGHT_SELECT, "char-right-select", ReadOnly | SingleParUpdate, Edit },
143 { LFUN_CLIPBOARD_PASTE, "clipboard-paste", Noop, Edit },
144 { LFUN_COMMAND_EXECUTE, "command-execute", NoBuffer, Edit },
145 { LFUN_COMMAND_PREFIX, "command-prefix", NoBuffer, Hidden },
146 { LFUN_COMMAND_SEQUENCE, "command-sequence", NoBuffer, System },
147 { LFUN_COPY, "copy", ReadOnly, Edit },
148 { LFUN_CUT, "cut", Noop, Edit },
149 { LFUN_DATE_INSERT, "date-insert", Noop, Edit },
150 { LFUN_DELETE_BACKWARD_SKIP, "delete-backward-skip", Noop, Edit },
151 { LFUN_DELETE_FORWARD_SKIP, "delete-forward-skip", Noop, Edit },
152 { LFUN_DEPTH_DECREMENT, "depth-decrement", Noop, Edit },
153 { LFUN_DEPTH_INCREMENT, "depth-increment", Noop, Edit },
154 { LFUN_DOWN, "down", ReadOnly | NoUpdate, Edit },
155 { LFUN_DOWN_SELECT, "down-select", ReadOnly | SingleParUpdate, Edit },
156 { LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice", ReadOnly, Layout },
157 { LFUN_ENVIRONMENT_INSERT, "environment-insert", Noop, Edit },
158 { LFUN_ERROR_NEXT, "error-next", ReadOnly, Edit },
159 { LFUN_ERT_INSERT, "ert-insert", Noop, Edit },
160 { LFUN_FILE_INSERT, "file-insert", Noop, Buffer },
161 { LFUN_FILE_INSERT_PLAINTEXT, "file-insert-plaintext", Noop, Edit },
162 { LFUN_FILE_INSERT_PLAINTEXT_PARA, "file-insert-plaintext-para", Noop, Edit },
163 { LFUN_FILE_NEW, "file-new", NoBuffer, Buffer },
164 { LFUN_FILE_OPEN, "file-open", NoBuffer, Buffer },
165 { LFUN_FLOAT_INSERT, "float-insert", Noop, Edit },
166 { LFUN_FLOAT_WIDE_INSERT, "float-wide-insert", Noop, Edit },
167 { LFUN_WRAP_INSERT, "wrap-insert", Noop, Edit },
168 { LFUN_FONT_BOLD, "font-bold", Noop, Layout },
169 { LFUN_FONT_TYPEWRITER, "font-typewriter", Noop, Layout },
170 { LFUN_FONT_DEFAULT, "font-default", Noop, Layout },
171 { LFUN_FONT_EMPH, "font-emph", Noop, Layout },
172 { LFUN_FONT_FREE_APPLY, "font-free-apply", Noop, Layout },
173 { LFUN_FONT_FREE_UPDATE, "font-free-update", Noop, Layout },
174 { LFUN_FONT_NOUN, "font-noun", Noop, Layout },
175 { LFUN_FONT_ROMAN, "font-roman", Noop, Layout },
176 { LFUN_FONT_SANS, "font-sans", Noop, Layout },
177 { LFUN_FONT_FRAK, "font-frak", Noop, Layout },
178 { LFUN_FONT_ITAL, "font-ital", Noop, Layout },
179 { LFUN_FONT_SIZE, "font-size", Noop, Layout },
180 { LFUN_FONT_STATE, "font-state", ReadOnly, Layout },
181 { LFUN_FONT_UNDERLINE, "font-underline", Noop, Layout },
182 { LFUN_FOOTNOTE_INSERT, "footnote-insert", Noop, Edit },
183 { LFUN_HFILL_INSERT, "hfill-insert", Noop, Edit },
184 { LFUN_HELP_OPEN, "help-open", NoBuffer | Argument, Buffer },
185 { LFUN_INDEX_INSERT, "index-insert", Noop, Edit },
186 { LFUN_INDEX_PRINT, "index-print", Noop, Edit },
187 { LFUN_KEYMAP_OFF, "keymap-off", ReadOnly, Edit },
188 { LFUN_KEYMAP_PRIMARY, "keymap-primary", ReadOnly, Edit },
189 { LFUN_KEYMAP_SECONDARY, "keymap-secondary", ReadOnly, Edit },
190 { LFUN_KEYMAP_TOGGLE, "keymap-toggle", ReadOnly, Edit },
191 { LFUN_LABEL_INSERT, "label-insert", Noop, Edit },
192 { LFUN_OPTIONAL_INSERT, "optional-insert", Noop, Edit },
193 { LFUN_BIBITEM_INSERT, "bibitem-insert", Noop, Edit },
194 { LFUN_CITATION_INSERT, "citation-insert", Noop, Edit },
195 { LFUN_BIBTEX_DATABASE_ADD, "bibtex-database-add", Noop, Edit },
196 { LFUN_BIBTEX_DATABASE_DEL, "bibtex-database-del", Noop, Edit },
197 { LFUN_LINE_INSERT, "line-insert", Noop, Edit },
198 { LFUN_NEWPAGE_INSERT, "newpage-insert", Noop, Edit },
199 { LFUN_PAGEBREAK_INSERT, "pagebreak-insert", Noop, Edit },
200 { LFUN_LANGUAGE, "language", Noop, Edit },
201 { LFUN_LAYOUT, "layout", Noop, Layout },
202 { LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", ReadOnly, Layout },
203 { LFUN_LAYOUT_TABULAR, "layout-tabular", Noop, Layout },
204 { LFUN_LINE_BEGIN, "line-begin", ReadOnly | NoUpdate, Edit },
205 { LFUN_LINE_BEGIN_SELECT, "line-begin-select", ReadOnly | SingleParUpdate, Edit },
206 { LFUN_LINE_BREAK, "line-break", Noop, Edit },
207 { LFUN_LINE_DELETE, "line-delete-forward", Noop, Edit }, // there is no line-delete-backward
208 { LFUN_LINE_END, "line-end", ReadOnly | NoUpdate, Edit },
209 { LFUN_LINE_END_SELECT, "line-end-select", ReadOnly | SingleParUpdate, Edit },
211 { LFUN_LIST_INSERT, "list-insert", Noop, Edit },
213 { LFUN_LYX_QUIT, "lyx-quit", NoBuffer, Buffer },
214 { LFUN_MARGINALNOTE_INSERT, "marginalnote-insert", Noop, Edit },
215 { LFUN_MARK_OFF, "mark-off", ReadOnly, Edit },
216 { LFUN_MARK_ON, "mark-on", ReadOnly, Edit },
217 { LFUN_MARK_TOGGLE, "mark-toggle", ReadOnly, Edit },
218 { LFUN_MATH_DELIM, "math-delim", Noop, Math },
219 { LFUN_MATH_BIGDELIM, "math-bigdelim", Noop, Math },
220 { LFUN_MATH_DISPLAY, "math-display", Noop, Math },
221 { LFUN_MATH_INSERT, "math-insert", Noop, Math },
222 { LFUN_MATH_SUBSCRIPT, "math-subscript", Noop, Math },
223 { LFUN_MATH_SUPERSCRIPT, "math-superscript", Noop, Math },
224 { LFUN_MATH_LIMITS, "math-limits", Noop, Math },
225 { LFUN_MATH_MACRO, "math-macro", Noop, Math },
226 { LFUN_MATH_MUTATE, "math-mutate", Noop, Math },
227 { LFUN_MATH_SPACE, "math-space", Noop, Math },
228 { LFUN_MATH_IMPORT_SELECTION, "math-import-selection", Noop, Math },
229 { LFUN_MATH_MATRIX, "math-matrix", Noop, Math },
230 { LFUN_MATH_MODE, "math-mode", Noop, Math },
231 { LFUN_MATH_NONUMBER, "math-nonumber", Noop, Math },
232 { LFUN_MATH_NUMBER, "math-number", Noop, Math },
233 { LFUN_MATH_EXTERN, "math-extern", Noop, Math },
234 { LFUN_MATH_SIZE, "math-size", Noop, Math },
235 { LFUN_MATH_MACRO_UNFOLD, "math-macro-unfold", ReadOnly | SingleParUpdate, Math },
236 { LFUN_MATH_MACRO_FOLD, "math-macro-fold", ReadOnly | SingleParUpdate, Math },
237 { LFUN_MATH_MACRO_ADD_PARAM, "math-macro-add-param", Noop, Math },
238 { LFUN_MATH_MACRO_REMOVE_PARAM, "math-macro-remove-param", Noop, Math },
239 { LFUN_MATH_MACRO_APPEND_GREEDY_PARAM, "math-macro-append-greedy-param", Noop, Math },
240 { LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM, "math-macro-remove-greedy-param", Noop, Math },
241 { LFUN_MATH_MACRO_MAKE_OPTIONAL, "math-macro-make-optional", Noop, Math },
242 { LFUN_MATH_MACRO_MAKE_NONOPTIONAL, "math-macro-make-nonoptional", Noop, Math },
243 { LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM, "math-macro-add-optional-param", Noop, Math },
244 { LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM, "math-macro-remove-optional-param", Noop, Math },
245 { LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM, "math-macro-add-greedy-optional-param", Noop, Math },
246 { LFUN_IN_MATHMACROTEMPLATE, "in-mathmacrotemplate", Noop, Math },
247 { LFUN_MENU_OPEN, "menu-open", NoBuffer, Buffer },
248 { LFUN_META_PREFIX, "meta-prefix", NoBuffer, System },
249 { LFUN_NEW_LINE, "new-line", Noop, Edit },
250 { LFUN_NEXT_INSET_TOGGLE, "next-inset-toggle", ReadOnly, Edit },
251 { LFUN_NOTE_INSERT, "note-insert", Noop, Edit },
252 { LFUN_NOTE_NEXT, "note-next", ReadOnly, Edit },
253 { LFUN_BRANCH_INSERT, "branch-insert", Noop, Edit },
254 { LFUN_BOX_INSERT, "box-insert", Noop, Edit },
255 { LFUN_FLEX_INSERT, "flex-insert", Noop, Edit },
256 { LFUN_INSET_TOGGLE, "", ReadOnly, Hidden },
257 { LFUN_ALL_INSETS_TOGGLE, "all-insets-toggle", ReadOnly, Edit },
258 { LFUN_PARAGRAPH_DOWN, "paragraph-down", ReadOnly | NoUpdate, Edit },
259 { LFUN_PARAGRAPH_DOWN_SELECT, "paragraph-down-select", ReadOnly, Edit },
260 { LFUN_PARAGRAPH_GOTO, "paragraph-goto", ReadOnly, Edit },
261 { LFUN_OUTLINE_UP, "outline-up", Noop, Edit },
262 { LFUN_OUTLINE_DOWN, "outline-down", Noop, Edit },
263 { LFUN_OUTLINE_IN, "outline-in", Noop, Edit },
264 { LFUN_OUTLINE_OUT, "outline-out", Noop, Edit },
265 { LFUN_PARAGRAPH_SPACING, "paragraph-spacing", Noop, Edit },
266 { LFUN_PARAGRAPH_UP, "paragraph-up", ReadOnly | NoUpdate, Edit },
267 { LFUN_PARAGRAPH_UP_SELECT, "paragraph-up-select", ReadOnly, Edit },
268 { LFUN_PASTE, "paste", Noop, Edit },
269 { LFUN_PREFERENCES_SAVE, "preferences-save", NoBuffer, Edit },
270 { LFUN_PRIMARY_SELECTION_PASTE, "primary-selection-paste", Noop, Edit },
271 { LFUN_QUOTE_INSERT, "quote-insert", Noop, Edit },
272 { LFUN_RECONFIGURE, "reconfigure", NoBuffer, System },
273 { LFUN_REDO, "redo", Noop, Edit },
274 { LFUN_LABEL_GOTO, "label-goto", ReadOnly, Edit },
275 { LFUN_REFERENCE_NEXT, "reference-next", ReadOnly, Edit },
276 { LFUN_SCREEN_DOWN, "screen-down", ReadOnly, Edit },
277 { LFUN_SCREEN_DOWN_SELECT, "screen-down-select", ReadOnly, Edit },
278 { LFUN_SCREEN_FONT_UPDATE, "screen-font-update", NoBuffer, Layout },
279 { LFUN_SCREEN_RECENTER, "screen-recenter", ReadOnly, Edit },
280 { LFUN_SCREEN_UP, "screen-up", ReadOnly, Edit },
281 { LFUN_SCREEN_UP_SELECT, "screen-up-select", ReadOnly, Edit },
282 { LFUN_SELF_INSERT, "self-insert", SingleParUpdate, Hidden },
283 { LFUN_SPACE_INSERT, "space-insert", Noop, Edit },
284 { LFUN_SPECIALCHAR_INSERT, "specialchar-insert", Noop, Edit },
285 { LFUN_SERVER_CHAR_AFTER, "server-char-after", ReadOnly, System },
286 { LFUN_SERVER_GET_FONT, "server-get-font", ReadOnly, System },
287 { LFUN_SERVER_GET_LAYOUT, "server-get-layout", ReadOnly, System },
288 { LFUN_SERVER_GET_NAME, "server-get-name", ReadOnly, System },
289 { LFUN_SERVER_GET_XY, "server-get-xy", ReadOnly, System },
290 { LFUN_SERVER_GOTO_FILE_ROW, "server-goto-file-row", ReadOnly, System },
291 { LFUN_SERVER_NOTIFY, "server-notify", ReadOnly, System },
292 { LFUN_SERVER_SET_XY, "server-set-xy", ReadOnly, System },
293 { LFUN_SET_COLOR, "set-color", ReadOnly | NoBuffer, Edit },
294 { LFUN_CELL_BACKWARD, "cell-backward", Noop, Edit },
295 { LFUN_CELL_FORWARD, "cell-forward", Noop, Edit },
296 { LFUN_CELL_SPLIT, "cell-split", Noop, Edit },
297 { LFUN_TABULAR_INSERT, "tabular-insert", Noop, Edit },
298 { LFUN_TABULAR_FEATURE, "tabular-feature", Noop, Edit },
300 { LFUN_THEOREM_INSERT, "theorem-insert", Noop, Edit },
302 { LFUN_THESAURUS_ENTRY, "thesaurus-entry", ReadOnly, Edit },
303 { LFUN_TOC_INSERT, "toc-insert", Noop, Edit },
304 { LFUN_TOGGLE_CURSOR_FOLLOWS_SCROLLBAR, "toggle-cursor-follows-scrollbar", ReadOnly, Edit },
305 { LFUN_UNDO, "undo", Noop, Edit },
306 { LFUN_UP, "up", ReadOnly | NoUpdate, Edit },
307 { LFUN_UP_SELECT, "up-select", ReadOnly | SingleParUpdate, Edit },
308 { LFUN_VC_CHECK_IN, "vc-check-in", ReadOnly, System },
309 { LFUN_VC_CHECK_OUT, "vc-check-out", ReadOnly, System },
310 { LFUN_VC_REGISTER, "vc-register", ReadOnly, System },
311 { LFUN_VC_REVERT, "vc-revert", ReadOnly, System },
312 { LFUN_VC_UNDO_LAST, "vc-undo-last", ReadOnly, System },
313 { LFUN_WORD_BACKWARD, "word-backward", ReadOnly | NoUpdate, Edit },
314 { LFUN_WORD_BACKWARD_SELECT, "word-backward-select", ReadOnly | SingleParUpdate, Edit },
315 { LFUN_WORD_CAPITALIZE, "word-capitalize", Noop, Edit },
316 { LFUN_WORD_DELETE_BACKWARD, "word-delete-backward", Noop, Edit },
317 { LFUN_WORD_DELETE_FORWARD, "word-delete-forward", Noop, Edit },
318 { LFUN_WORD_FIND_BACKWARD, "word-find-backward", ReadOnly, Edit },
319 { LFUN_WORD_FIND_FORWARD, "word-find-forward", ReadOnly, Edit },
320 { LFUN_WORD_FORWARD, "word-forward", ReadOnly | NoUpdate, Edit },
321 { LFUN_WORD_FORWARD_SELECT, "word-forward-select", ReadOnly | SingleParUpdate, Edit },
322 { LFUN_WORD_LEFT, "word-left", ReadOnly | NoUpdate, Edit },
323 { LFUN_WORD_LEFT_SELECT, "word-left-select", ReadOnly | SingleParUpdate, Edit },
324 { LFUN_WORD_LOWCASE, "word-lowcase", Noop, Edit },
325 { LFUN_WORD_RIGHT, "word-right", ReadOnly | NoUpdate, Edit },
326 { LFUN_WORD_RIGHT_SELECT, "word-right-select", ReadOnly | SingleParUpdate, Edit },
327 { LFUN_WORD_SELECT, "word-select", ReadOnly, Edit },
328 { LFUN_WORD_UPCASE, "word-upcase", Noop, Edit },
329 { LFUN_MESSAGE, "message", NoBuffer, System },
330 { LFUN_CHARS_TRANSPOSE, "chars-transpose", Noop, Edit },
331 { LFUN_FLOAT_LIST, "float-list", Noop, Edit },
332 { LFUN_ESCAPE, "escape", ReadOnly, Edit },
333 { LFUN_CHANGES_TRACK, "changes-track", Noop, Edit },
334 { LFUN_CHANGES_OUTPUT, "changes-output", Noop, Edit },
335 { LFUN_CHANGE_NEXT, "change-next", ReadOnly, Edit },
336 { LFUN_CHANGES_MERGE, "changes-merge", Noop, Edit },
337 { LFUN_CHANGE_ACCEPT, "change-accept", Noop, Edit },
338 { LFUN_CHANGE_REJECT, "change-reject", Noop, Edit },
339 { LFUN_ALL_CHANGES_ACCEPT, "all-changes-accept", Noop, Edit },
340 { LFUN_ALL_CHANGES_REJECT, "all-changes-reject", Noop, Edit },
341 { LFUN_DIALOG_SHOW, "dialog-show", NoBuffer, Edit },
342 { LFUN_DIALOG_SHOW_NEW_INSET, "dialog-show-new-inset", Noop, Edit },
343 { LFUN_DIALOG_UPDATE, "dialog-update", NoBuffer, Edit },
344 { LFUN_DIALOG_HIDE, "dialog-hide", NoBuffer, Edit },
345 { LFUN_DIALOG_TOGGLE, "dialog-toggle", NoBuffer, Edit },
346 { LFUN_DIALOG_DISCONNECT_INSET, "dialog-disconnect-inset", Noop, Edit },
347 { LFUN_HYPERLINK_INSERT, "href-insert", Noop, Edit },
348 { LFUN_INSET_APPLY, "inset-apply", Noop, Edit },
349 { LFUN_INSET_DISSOLVE, "inset-dissolve", Noop, Edit },
350 { LFUN_INSET_INSERT, "inset-insert", Noop, Edit },
351 { LFUN_INSET_MODIFY, "", Noop, Hidden },
352 { LFUN_INSET_DIALOG_UPDATE, "", Noop, Hidden },
353 { LFUN_INSET_SETTINGS, "inset-settings", ReadOnly, Edit },
354 { LFUN_PARAGRAPH_PARAMS, "paragraph-params", Noop, Edit },
355 { LFUN_PARAGRAPH_PARAMS_APPLY, "paragraph-params-apply", Noop, Edit },
356 { LFUN_PARAGRAPH_UPDATE, "", Noop, Hidden },
357 { LFUN_EXTERNAL_EDIT, "external-edit", Noop, Edit },
358 { LFUN_GRAPHICS_EDIT, "graphics-edit", Noop, Edit },
359 { LFUN_REPEAT, "repeat", NoBuffer, Edit },
360 { LFUN_WORD_FIND, "word-find", ReadOnly, Edit },
361 { LFUN_WORD_REPLACE, "word-replace", Noop, Edit },
362 { LFUN_BUFFER_LANGUAGE, "buffer-language", Noop, Buffer },
363 { LFUN_TEXTCLASS_APPLY, "textclass-apply", Noop, Layout },
364 { LFUN_TEXTCLASS_LOAD, "textclass-load", Noop, Layout },
365 { LFUN_BUFFER_SAVE_AS_DEFAULT, "buffer-save-as-default", Noop, Buffer },
366 { LFUN_BUFFER_PARAMS_APPLY, "buffer-params-apply", Noop, Buffer },
367 { LFUN_LYXRC_APPLY, "lyxrc-apply", NoBuffer, System },
368 { LFUN_INSET_REFRESH, "", Noop, Hidden },
369 { LFUN_BUFFER_NEXT, "buffer-next", ReadOnly, Buffer },
370 { LFUN_BUFFER_PREVIOUS, "buffer-previous", ReadOnly, Buffer },
371 { LFUN_WORDS_COUNT, "words-count", ReadOnly, System },
372 { LFUN_FINISHED_FORWARD, "", ReadOnly, Hidden },
373 { LFUN_FINISHED_BACKWARD, "", ReadOnly, Hidden },
374 { LFUN_FINISHED_RIGHT, "", ReadOnly, Hidden },
375 { LFUN_FINISHED_LEFT, "", ReadOnly, Hidden },
376 { LFUN_MOUSE_PRESS, "", ReadOnly, Hidden },
377 { LFUN_MOUSE_MOTION, "", ReadOnly | SingleParUpdate, Hidden },
378 { LFUN_MOUSE_RELEASE, "", ReadOnly, Hidden },
379 { LFUN_MOUSE_DOUBLE, "", ReadOnly, Hidden },
380 { LFUN_MOUSE_TRIPLE, "", ReadOnly, Hidden },
381 { LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop, Edit },
382 { LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop, Edit },
383 { LFUN_WINDOW_NEW, "window-new", NoBuffer, Buffer },
384 { LFUN_WINDOW_CLOSE, "window-close", NoBuffer, Buffer },
385 { LFUN_UNICODE_INSERT, "unicode-insert", Noop, Edit },
386 { LFUN_TOOLBAR_TOGGLE, "toolbar-toggle", NoBuffer, Edit },
387 { LFUN_NOMENCL_INSERT, "nomencl-insert", Noop, Edit },
388 { LFUN_NOMENCL_PRINT, "nomencl-print", Noop, Edit },
389 { LFUN_CLEARPAGE_INSERT, "clearpage-insert", Noop, Edit },
390 { LFUN_CLEARDOUBLEPAGE_INSERT, "cleardoublepage-insert", Noop, Edit },
391 { LFUN_LISTING_INSERT, "listing-insert", Noop, Edit },
392 { LFUN_LAYOUT_MODULES_CLEAR, "layout-modules-clear", Noop, Layout },
393 { LFUN_LAYOUT_MODULE_ADD, "layout-module-add", Noop, Layout },
394 { LFUN_LAYOUT_RELOAD, "layout-reload", Noop, Layout },
395 { LFUN_INFO_INSERT, "info-insert", Noop, Edit },
396 { LFUN_BUFFER_TOGGLE_EMBEDDING, "buffer-toggle-embedding", Noop, Buffer },
398 { LFUN_NOACTION, "", Noop, Hidden }
401 for (int i = 0; items[i].action != LFUN_NOACTION; ++i) {
402 newFunc(items[i].action, items[i].name, items[i].attrib, items[i].type);
409 LyXAction::LyXAction()
415 // Returns an action tag from a string.
416 FuncRequest LyXAction::lookupFunc(string const & func) const
418 string const func2 = trim(func);
421 return FuncRequest(LFUN_NOACTION);
425 string const arg = split(func2, cmd, ' ');
427 func_map::const_iterator fit = lyx_func_map.find(cmd);
429 return fit != lyx_func_map.end() ? FuncRequest(fit->second, arg) : FuncRequest(LFUN_UNKNOWN_ACTION);
433 string const LyXAction::getActionName(kb_action action) const
435 info_map::const_iterator const it = lyx_info_map.find(action);
436 return it != lyx_info_map.end() ? it->second.name : string();
440 LyXAction::func_type const LyXAction::getActionType(kb_action action) const
442 info_map::const_iterator const it = lyx_info_map.find(action);
443 return it != lyx_info_map.end() ? it->second.type : Hidden;
447 bool LyXAction::funcHasFlag(kb_action action,
448 LyXAction::func_attrib flag) const
450 info_map::const_iterator ici = lyx_info_map.find(action);
452 if (ici == lyx_info_map.end()) {
453 LYXERR0("action: " << action << " is not known.");
457 return ici->second.attrib & flag;
461 LyXAction::const_func_iterator LyXAction::func_begin() const
463 return lyx_func_map.begin();
467 LyXAction::const_func_iterator LyXAction::func_end() const
469 return lyx_func_map.end();