]> git.lyx.org Git - features.git/blob - src/LyXAction.cpp
A little more lfun doxy.
[features.git] / src / LyXAction.cpp
1 /**
2  * \file LyXAction.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Jean-Marc Lasgouttes
8  * \author John Levon
9  * \author André Pönitz
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "LyXAction.h"
17
18 #include "support/debug.h"
19 #include "FuncRequest.h"
20
21 #include "support/lstrings.h"
22
23 #include <boost/assert.hpp>
24
25 using namespace std;
26 using namespace lyx::support;
27
28 namespace lyx {
29
30 /*
31      NAMING RULES FOR USER-COMMANDS
32      Here's the set of rules to apply when a new command name is introduced:
33
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'.
43
44      (May 19 1996, 12:04, RvdK)
45 */
46
47 /* LFUN documentation (a start at least, Chr 2007-08-12)
48  *
49  * The documentation below is primarily notes about restrictions and
50  * oddities relating to the different LFUNs.
51  *
52  * Try to find an appropriate (thematical) place when adding the new LFUN.
53  *
54  * Doxygen template below. Some notes: Parameters should be set in uppercase
55  * and put in <BRACKETS>, as so.
56  */
57
58 /**
59  * 
60  * \li Action: 
61  * \li Notion: 
62  * \li Syntax: 
63  * \li Params: 
64  * \li Origin: 
65  */
66
67 LyXAction lyxaction;
68
69
70 void LyXAction::newFunc(kb_action action, string const & name,
71                         unsigned int attrib, LyXAction::func_type type)
72 {
73         lyx_func_map[name] = action;
74         func_info tmpinfo;
75         tmpinfo.name = name;
76         tmpinfo.attrib = attrib;
77         tmpinfo.type = type;
78         lyx_info_map[action] = tmpinfo;
79 }
80
81
82 // Needed for LFUNs documentation to be accepted, since doxygen won't take
83 // \var inside functions.
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85 void LyXAction::init()
86 {
87         // This function was changed to use the array below in initalization
88         // instead of calling newFunc numerous times because of compilation
89         // times. Since the array is not static we get back the memory it
90         // occupies after the init is completed. It compiles several
91         // magnitudes faster.
92
93         static bool init;
94         if (init) return;
95
96         struct ev_item {
97                 kb_action action;
98                 char const * name;
99                 unsigned int attrib;
100                 func_type type;
101         };
102
103         ev_item const items[] = {
104 #endif
105 /**
106  * \li Action: adds an acute accent (á) to the next character typed
107  * \li Syntax: accent-acute
108  */
109                 { LFUN_ACCENT_ACUTE, "accent-acute", Noop, Edit },
110 /**
111  * \li Action: adds a breve accent to the next character typed
112  * \li Syntax: accent-breve
113  */
114                 { LFUN_ACCENT_BREVE, "accent-breve", Noop, Edit },
115 /**
116  * \li Action: adds a caron to the next character typed
117  * \li Syntax: accent-caron
118  */
119                 { LFUN_ACCENT_CARON, "accent-caron", Noop, Edit },
120 /**
121  * \li Action: adds a cedilla (ç) to the next character typed
122  * \li Syntax: accent-cedilla
123  */
124                 { LFUN_ACCENT_CEDILLA, "accent-cedilla", Noop, Edit },
125 /**
126  * \li Action: adds a circle accent (Å) to the next character typed
127  * \li Syntax: accent-circle
128  */
129                 { LFUN_ACCENT_CIRCLE, "accent-circle", Noop, Edit },
130 /**
131  * \li Action: adds a circumflex (â) to the next character typed
132  * \li Syntax: accent-circumflex
133  */
134                 { LFUN_ACCENT_CIRCUMFLEX, "accent-circumflex", Noop, Edit },
135 /**
136  * \li Action: adds a dot accent to the next character typed
137  * \li Syntax: accent-dot
138  */
139                 { LFUN_ACCENT_DOT, "accent-dot", Noop, Edit },
140 /**
141  * \li Action: adds a grave accent (à) to the next character typed
142  * \li Syntax: accent-grave
143  */
144                 { LFUN_ACCENT_GRAVE, "accent-grave", Noop, Edit },
145 /**
146  * \li Action: adds a Hungarian umlaut to the next character typed
147  * \li Syntax: accent-grave
148  */
149                 { LFUN_ACCENT_HUNGARIAN_UMLAUT, "accent-hungarian-umlaut", Noop, Edit },
150 /**
151  * \li Action: adds a macron to the next character typed
152  * \li Syntax: accent-macron
153  */
154                 { LFUN_ACCENT_MACRON, "accent-macron", Noop, Edit },
155 /**
156  * \li Action: adds an ogonek accent to the next character typed
157  * \li Syntax: accent-ogonek
158  */
159                 { LFUN_ACCENT_OGONEK, "accent-ogonek", Noop, Edit },
160                 { LFUN_ACCENT_SPECIAL_CARON, "accent-special-caron", Noop, Edit },
161 /**
162  * \li Action: adds a tie over the next two character typed
163  * \li Syntax: accent-tie
164  */
165                 { LFUN_ACCENT_TIE, "accent-tie", Noop, Edit },
166 /**
167  * \li Action: adds a tilde (ñ) over the next character typed
168  * \li Syntax: accent-tilde
169  */
170                 { LFUN_ACCENT_TILDE, "accent-tilde", Noop, Edit },
171 /**
172  * \li Action: adds an umlaut (ö) over the next character typed
173  * \li Syntax: accent-umlaut
174  */
175                 { LFUN_ACCENT_UMLAUT, "accent-umlaut", Noop, Edit },
176 /**
177  * \li Action: adds a bar under the next character typed
178  * \li Syntax: accent-underbar
179  */
180                 { LFUN_ACCENT_UNDERBAR, "accent-underbar", Noop, Edit },
181 /**
182  * \li Action: adds a dot under the next character typed
183  * \li Syntax: accent-underdot
184  */
185                 { LFUN_ACCENT_UNDERDOT, "accent-underdot", Noop, Edit },
186
187 /**
188  * \li Action: Breaks the current paragraph at the current location
189  * \li Syntax: break-paragraph
190  */
191                 { LFUN_BREAK_PARAGRAPH, "break-paragraph", Noop, Edit },
192 /**
193  * \li Action: Breaks the current paragraph at the current location,
194                unless used at the beginning of a line, where it sets
195                the label width string to empty.
196  * \li Syntax: break-paragraph-skip
197  */
198                 { LFUN_BREAK_PARAGRAPH_SKIP, "break-paragraph-skip", Noop, Edit },
199 /**
200  * \li Action: Inserts a caption inset.
201  * \li Syntax: caption-insert
202  */
203                 { LFUN_CAPTION_INSERT, "caption-insert", Noop, Edit },
204 /**
205  * \li Action: Inserts the current date
206  * \li Syntax: date-insert <ARG>
207  * \li Param: <ARG>: Strangely, this is inserted verbatim, no matter
208                      what it is.
209  */
210                 { LFUN_DATE_INSERT, "date-insert", Noop, Edit },
211 /**
212  * \li Action: Inserts a footnote inset.
213  * \li Syntax: footnote-insert
214  */
215                 { LFUN_FOOTNOTE_INSERT, "footnote-insert", Noop, Edit },
216 /**
217  * \li Action: Inserts an ERT inset.
218  * \li Syntax: ert-insert
219  */
220                 { LFUN_ERT_INSERT, "ert-insert", Noop, Edit },
221                 { LFUN_FLOAT_INSERT, "float-insert", Noop, Edit },
222                 { LFUN_FLOAT_WIDE_INSERT, "float-wide-insert", Noop, Edit },
223                 { LFUN_WRAP_INSERT, "wrap-insert", Noop, Edit },
224 /**
225  * \li Action: Inserts an hfill inset.
226  * \li Syntax: hfill-insert
227  */
228                 { LFUN_HFILL_INSERT, "hfill-insert", Noop, Edit },
229 /**
230  * \li Action: Inserts an optional-argument (short title) inset.
231  * \li Syntax: optional-insert
232  */
233                 { LFUN_OPTIONAL_INSERT, "optional-insert", Noop, Edit },
234 /**
235  * \li Action: Inserts a horizontal line.
236  * \li Syntax: line-insert
237  */
238                 { LFUN_LINE_INSERT, "line-insert", Noop, Edit },
239 /**
240  * \li Action: Inserts a new page.
241  * \li Syntax: newpage-insert
242  */
243                 { LFUN_NEWPAGE_INSERT, "newpage-insert", Noop, Edit },
244 /**
245  * \li Action: Inserts a pagebreak.
246  * \li Syntax: pagebreak-insert
247  */
248                 { LFUN_PAGEBREAK_INSERT, "pagebreak-insert", Noop, Edit },
249 /**
250  * \li Action: Inserts a marginal note.
251  * \li Syntax: marginalnote-insert
252  */
253                 { LFUN_MARGINALNOTE_INSERT, "marginalnote-insert", Noop, Edit },
254 /**
255  * \li Action: Inserts a single unicode character.
256  * \li Syntax: unicode-insert <CHAR>
257  * \li Params: <CHAR>: The character to insert, given as its code
258                        point, in hexadecimal, e.g.: unicode-insert 0x0100.
259  */
260                 { LFUN_UNICODE_INSERT, "unicode-insert", Noop, Edit },
261 /**
262  * \li Action: Inserts a new listings inset.
263  * \li Syntax: listing-insert
264  */
265                 { LFUN_LISTING_INSERT, "listing-insert", Noop, Edit },
266                 { LFUN_QUOTE_INSERT, "quote-insert", Noop, Edit },
267                 { LFUN_INFO_INSERT, "info-insert", Noop, Edit },
268                 { LFUN_BRANCH_INSERT, "branch-insert", Noop, Edit },
269                 { LFUN_BOX_INSERT, "box-insert", Noop, Edit },
270                 { LFUN_FLEX_INSERT, "flex-insert", Noop, Edit },
271                 { LFUN_SELF_INSERT, "self-insert", SingleParUpdate, Hidden },
272                 { LFUN_SPACE_INSERT, "space-insert", Noop, Edit },
273                 { LFUN_HYPERLINK_INSERT, "href-insert", Noop, Edit },
274                 { LFUN_SPECIALCHAR_INSERT, "specialchar-insert", Noop, Edit },
275                 { LFUN_CLEARPAGE_INSERT, "clearpage-insert", Noop, Edit },
276                 { LFUN_CLEARDOUBLEPAGE_INSERT, "cleardoublepage-insert", Noop, Edit },
277                 { LFUN_TOC_INSERT, "toc-insert", Noop, Edit },
278                 { LFUN_APPENDIX, "appendix", Noop, Edit },
279
280 #if 0
281                 { LFUN_LIST_INSERT, "list-insert", Noop, Edit },
282                 { LFUN_THEOREM_INSERT, "theorem-insert", Noop, Edit },
283 #endif
284
285                 { LFUN_DELETE_BACKWARD_SKIP, "delete-backward-skip", Noop, Edit },
286                 { LFUN_DELETE_FORWARD_SKIP, "delete-forward-skip", Noop, Edit },
287                 { LFUN_DOWN, "down", ReadOnly | NoUpdate, Edit },
288                 { LFUN_DOWN_SELECT, "down-select", ReadOnly | SingleParUpdate, Edit },
289                 { LFUN_UP, "up", ReadOnly | NoUpdate, Edit },
290                 { LFUN_UP_SELECT, "up-select", ReadOnly | SingleParUpdate, Edit },
291                 { LFUN_SCREEN_DOWN, "screen-down", ReadOnly, Edit },
292                 { LFUN_SCREEN_DOWN_SELECT, "screen-down-select", ReadOnly, Edit },
293 /**
294  * \var lyx::kb_action lyx::LFUN_SCROLL
295  * \li Action: scroll the buffer view
296  * \li Notion: Only scrolls the screen up or down; does not move the cursor.
297  * \li Syntax: scroll <TYPE> <QUANTITY>
298  * \li Params: <TYPE>:  line|page\n
299                <QUANTITY>: up|down|<number>\n
300  * \li Origin: Abdelrazak Younes, Dec 27 2007
301  */
302                 { LFUN_SCROLL, "scroll", ReadOnly, Edit },
303 /**
304  * \var lyx::kb_action lyx::LFUN_SCREEN_RECENTER
305  * \li Action: Recenters the screen on the current cursor position
306  * \li Syntax: screen-recenter
307  */
308                 { LFUN_SCREEN_RECENTER, "screen-recenter", ReadOnly, Edit },
309                 { LFUN_SCREEN_UP, "screen-up", ReadOnly, Edit },
310                 { LFUN_SCREEN_UP_SELECT, "screen-up-select", ReadOnly, Edit },
311
312                 { LFUN_ERROR_NEXT, "error-next", ReadOnly, Edit },
313                 { LFUN_CHAR_BACKWARD, "char-backward", ReadOnly | NoUpdate, Edit },
314                 { LFUN_CHAR_BACKWARD_SELECT, "char-backward-select", ReadOnly | SingleParUpdate, Edit },
315                 { LFUN_CHAR_DELETE_BACKWARD, "delete-backward", SingleParUpdate, Edit },
316                 { LFUN_CHAR_DELETE_FORWARD, "delete-forward", SingleParUpdate, Edit },
317                 { LFUN_CHAR_FORWARD, "char-forward", ReadOnly | NoUpdate, Edit },
318                 { LFUN_CHAR_FORWARD_SELECT, "char-forward-select", ReadOnly | SingleParUpdate, Edit },
319                 { LFUN_CHAR_LEFT, "char-left", ReadOnly | NoUpdate, Edit },
320                 { LFUN_CHAR_LEFT_SELECT, "char-left-select", ReadOnly | SingleParUpdate, Edit },
321                 { LFUN_CHAR_RIGHT, "char-right", ReadOnly | NoUpdate, Edit },
322                 { LFUN_CHAR_RIGHT_SELECT, "char-right-select", ReadOnly | SingleParUpdate, Edit },
323
324                 { LFUN_WORD_BACKWARD, "word-backward", ReadOnly | NoUpdate, Edit },
325                 { LFUN_WORD_BACKWARD_SELECT, "word-backward-select", ReadOnly | SingleParUpdate, Edit },
326                 { LFUN_WORD_CAPITALIZE, "word-capitalize", Noop, Edit },
327                 { LFUN_WORD_DELETE_BACKWARD, "word-delete-backward", Noop, Edit },
328                 { LFUN_WORD_DELETE_FORWARD, "word-delete-forward", Noop, Edit },
329                 { LFUN_WORD_FIND_BACKWARD, "word-find-backward", ReadOnly, Edit },
330                 { LFUN_WORD_FIND_FORWARD, "word-find-forward", ReadOnly, Edit },
331                 { LFUN_WORD_FORWARD, "word-forward", ReadOnly | NoUpdate, Edit },
332                 { LFUN_WORD_FORWARD_SELECT, "word-forward-select", ReadOnly | SingleParUpdate, Edit },
333                 { LFUN_WORD_LEFT, "word-left", ReadOnly | NoUpdate, Edit },
334                 { LFUN_WORD_LEFT_SELECT, "word-left-select", ReadOnly | SingleParUpdate, Edit },
335                 { LFUN_WORD_LOWCASE, "word-lowcase", Noop, Edit },
336                 { LFUN_WORD_RIGHT, "word-right", ReadOnly | NoUpdate, Edit },
337                 { LFUN_WORD_RIGHT_SELECT, "word-right-select", ReadOnly | SingleParUpdate, Edit },
338                 { LFUN_WORD_SELECT, "word-select", ReadOnly, Edit },
339                 { LFUN_WORD_UPCASE, "word-upcase", Noop, Edit },
340                 { LFUN_WORD_FIND, "word-find", ReadOnly, Edit },
341                 { LFUN_WORD_REPLACE, "word-replace", Noop, Edit },
342 /**
343  * \var lyx::kb_action lyx::LFUN_THESAURUS_ENTRY
344  * \li Action: Look up thesaurus entries with respect to the word under the cursor.
345  * \li Syntax: thesaurus-entry
346  * \li Origin: Levon, 20 Jul 2001
347  */
348                 { LFUN_THESAURUS_ENTRY, "thesaurus-entry", ReadOnly, Edit },
349                 { LFUN_BUFFER_BEGIN, "buffer-begin", ReadOnly, Edit },
350                 { LFUN_BUFFER_BEGIN_SELECT, "buffer-begin-select", ReadOnly, Edit },
351                 { LFUN_BUFFER_END, "buffer-end", ReadOnly, Edit },
352                 { LFUN_BUFFER_END_SELECT, "buffer-end-select", ReadOnly, Edit },
353
354                 { LFUN_LINE_BEGIN, "line-begin", ReadOnly | NoUpdate, Edit },
355                 { LFUN_LINE_BEGIN_SELECT, "line-begin-select", ReadOnly | SingleParUpdate, Edit },
356                 { LFUN_LINE_BREAK, "line-break", Noop, Edit },
357                 { LFUN_LINE_DELETE, "line-delete-forward", Noop, Edit }, // there is no line-delete-backward
358                 { LFUN_LINE_END, "line-end", ReadOnly | NoUpdate, Edit },
359                 { LFUN_LINE_END_SELECT, "line-end-select", ReadOnly | SingleParUpdate, Edit },
360                 { LFUN_NEW_LINE, "new-line", Noop, Edit },
361
362 /**
363  * \var lyx::kb_action lyx::LFUN_PARAGRAPH_MOVE_DOWN
364  * \li Action: Moves the current paragraph downwards in the document.
365  * \li Syntax: paragraph-move-down
366  * \li Origin: Edwin, 8 Apr 2006
367  */
368                 { LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop, Edit },
369 /**
370  * \var lyx::kb_action lyx::LFUN_PARAGRAPH_MOVE_UP
371  * \li Action: Moves the current paragraph upwards in the document.
372  * \li Syntax: paragraph-move-up
373  * \li Origin: Edwin, 8 Apr 2006
374  */
375                 { LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop, Edit },
376 /**
377  * \var lyx::kb_action lyx::LFUN_COPY
378  * \li Action: Copies to the clipboard the last edit
379  * \li Syntax: copy
380  */
381                 { LFUN_COPY, "copy", ReadOnly, Edit },
382 /**
383  * \var lyx::kb_action lyx::LFUN_CUT
384  * \li Action: Cuts to the clipboard
385  * \li Syntax: cut
386  */
387                 { LFUN_CUT, "cut", Noop, Edit },
388 /**
389  * \var lyx::kb_action lyx::LFUN_PASTE
390  * \li Action: Pastes from the active clipboard
391  * \li Syntax: paste
392  */
393                 { LFUN_PASTE, "paste", Noop, Edit },
394                 { LFUN_CLIPBOARD_PASTE, "clipboard-paste", Noop, Edit },
395 /**
396  * \var lyx::kb_action lyx::LFUN_PRIMARY_SELECTION_PASTE
397  * \li Action: Pastes the material currently selected
398  * \li Syntax: primary-selection-paste
399  */
400                 { LFUN_PRIMARY_SELECTION_PASTE, "primary-selection-paste", Noop, Edit },
401 /**
402  * \var lyx::kb_action lyx::LFUN_UNDO
403  * \li Action: Undoes the last edit
404  * \li Syntax: undo
405  */
406                 { LFUN_UNDO, "undo", Noop, Edit },
407 /**
408  * \var lyx::kb_action lyx::LFUN_REDO
409  * \li Action: Redoes the last thing undone
410  * \li Syntax: redo
411  */
412                 { LFUN_REDO, "redo", Noop, Edit },
413                 { LFUN_REPEAT, "repeat", NoBuffer, Edit },
414                 { LFUN_CHARS_TRANSPOSE, "chars-transpose", Noop, Edit },
415
416                 { LFUN_DEPTH_DECREMENT, "depth-decrement", Noop, Edit },
417                 { LFUN_DEPTH_INCREMENT, "depth-increment", Noop, Edit },
418                 { LFUN_ENVIRONMENT_INSERT, "environment-insert", Noop, Edit },
419
420                 { LFUN_FONT_BOLD, "font-bold", Noop, Layout },
421                 { LFUN_FONT_TYPEWRITER, "font-typewriter", Noop, Layout },
422                 { LFUN_FONT_DEFAULT, "font-default", Noop, Layout },
423                 { LFUN_FONT_EMPH, "font-emph", Noop, Layout },
424                 { LFUN_FONT_FREE_APPLY, "font-free-apply", Noop, Layout },
425                 { LFUN_FONT_FREE_UPDATE, "font-free-update", Noop, Layout },
426                 { LFUN_FONT_NOUN, "font-noun", Noop, Layout },
427                 { LFUN_FONT_ROMAN, "font-roman", Noop, Layout },
428                 { LFUN_FONT_SANS, "font-sans", Noop, Layout },
429                 { LFUN_FONT_FRAK, "font-frak", Noop, Layout },
430                 { LFUN_FONT_ITAL, "font-ital", Noop, Layout },
431                 { LFUN_FONT_SIZE, "font-size", Noop, Layout },
432                 { LFUN_FONT_STATE, "font-state", ReadOnly, Layout },
433                 { LFUN_FONT_UNDERLINE, "font-underline", Noop, Layout },
434                 { LFUN_SCREEN_FONT_UPDATE, "screen-font-update", NoBuffer, Layout },
435
436                 { LFUN_INDEX_INSERT, "index-insert", Noop, Edit },
437                 { LFUN_INDEX_PRINT, "index-print", Noop, Edit },
438
439                 { LFUN_NOMENCL_INSERT, "nomencl-insert", Noop, Edit },
440                 { LFUN_NOMENCL_PRINT, "nomencl-print", Noop, Edit },
441
442                 { LFUN_NOTE_INSERT, "note-insert", Noop, Edit },
443                 { LFUN_NOTE_NEXT, "note-next", ReadOnly, Edit },
444
445                 { LFUN_BIBITEM_INSERT, "bibitem-insert", Noop, Edit },
446                 { LFUN_CITATION_INSERT, "citation-insert", Noop, Edit },
447                 { LFUN_BIBTEX_DATABASE_ADD, "bibtex-database-add", Noop, Edit },
448                 { LFUN_BIBTEX_DATABASE_DEL, "bibtex-database-del", Noop, Edit },
449
450  /**
451  * \var lyx::kb_action lyx::LFUN_LAYOUT
452  * \li Action: Sets the layout (that is, environment) for the current paragraph
453  * \li Syntax: layout <LAYOUT>
454  * \li Params: <LAYOUT>: the layout to use
455  */
456                 { LFUN_LAYOUT, "layout", Noop, Layout },
457 /**
458  * \var lyx::kb_action lyx::LFUN_LAYOUT_PARAGRAPH
459  * \li Action: Launches the paragraph settings dialog
460  * \li Syntax: layout-paragraph
461  */
462                 { LFUN_LAYOUT_PARAGRAPH, "layout-paragraph", ReadOnly, Layout },
463                 { LFUN_LAYOUT_TABULAR, "layout-tabular", Noop, Layout },
464 /**
465  * \var lyx::kb_action lyx::LFUN_DROP_LAYOUTS_CHOICE
466  * \li Action: Displays list of layout choices
467  * \li Notion: In the current (as of 2007) Qt4 frontend, this LFUN opens the
468                dropbox allowing for choice of layout
469  * \li Syntax: drop-layouts-choice
470  */
471                 { LFUN_DROP_LAYOUTS_CHOICE, "drop-layouts-choice", ReadOnly, Layout },
472 /**
473  * \var lyx::kb_action lyx::LFUN_LAYOUT_MODULES_CLEAR
474  * \li Action: Clears the module list
475  * \li Notion: Clears the list of included modules for the current buffer.
476  * \li Syntax: layout-modules-clear
477  * \li Origin: rgh, 25 August 2007
478  */
479                 { LFUN_LAYOUT_MODULES_CLEAR, "layout-modules-clear", Noop, Layout },
480 /**
481  * \var lyx::kb_action lyx::LFUN_LAYOUT_MODULE_ADD
482  * \li Action: Adds a module
483  * \li Notion: Adds a module to the list of included modules for the current buffer.
484  * \li Syntax: layout-module-add <MODULE>
485  * \li Params: <MODULE>: the module to be added
486  * \li Origin: rgh, 25 August 2007
487  */
488                 { LFUN_LAYOUT_MODULE_ADD, "layout-module-add", Noop, Layout },
489 /**
490  * \var lyx::kb_action lyx::LFUN_LAYOUT_RELOAD
491  * \li Action: Reloads layout information
492  * \li Notion: Reloads all layout information for the current buffer from disk, thus
493                recognizing any changes that have been made to layout files on the fly.
494                This is intended to be used only by layout developers and should not be
495                used when one is trying to do actual work.
496  * \li Syntax: layout-reload
497  * \li Origin: rgh, 3 September 2007
498  */
499                 { LFUN_LAYOUT_RELOAD, "layout-reload", Noop, Layout },
500 /**
501  * \var lyx::kb_action lyx::LFUN_TEXTCLASS_APPLY
502  * \li Action: Sets the text class for the current buffer
503  * \li Syntax: textclass-apply <TEXTCLASS>
504  * \li Params: <TEXTCLASS>: the textclass to set. Note that this must be
505                    the filename, minus the ".layout" extension.
506  */
507                 { LFUN_TEXTCLASS_APPLY, "textclass-apply", Noop, Layout },
508 /**
509  * \var lyx::kb_action lyx::LFUN_TEXTCLASS_LOAD
510  * \li Action: Loads information for a textclass from disk
511  * \li Syntax: textclass-load <TEXTCLASS>
512  * \li Params: <TEXTCLASS>: the textclass to load. Note that this must be
513                    the filename, minus the ".layout" extension.
514  */
515                 { LFUN_TEXTCLASS_LOAD, "textclass-load", Noop, Layout },
516
517 /**
518  * \var lyx::kb_action lyx::LFUN_MARK_OFF
519  * \li Action: Disable selecting of text-region.
520  * \li Syntax: mark-off
521  */
522                 { LFUN_MARK_OFF, "mark-off", ReadOnly, Edit },
523 /**
524  * \var lyx::kb_action lyx::LFUN_MARK_ON
525  * \li Action: Enable selecting of text-region.
526  * \li Notion: After enabling you can simply move arrow keys to get selected region.
527  * \li Syntax: mark-on
528  */
529                 { LFUN_MARK_ON, "mark-on", ReadOnly, Edit },
530 /**
531  * \var lyx::kb_action lyx::LFUN_MARK_TOGGLE
532  * \li Action: Toggle between MARK_ON and MARK_OFF
533  * \li Syntax: mark-toggle
534  * \li Origin: poenitz, May 5 2006
535  */
536                 { LFUN_MARK_TOGGLE, "mark-toggle", ReadOnly, Edit },
537                 
538                 { LFUN_MATH_DELIM, "math-delim", Noop, Math },
539                 { LFUN_MATH_BIGDELIM, "math-bigdelim", Noop, Math },
540                 { LFUN_MATH_DISPLAY, "math-display", Noop, Math },
541                 { LFUN_MATH_INSERT, "math-insert", Noop, Math },
542                 { LFUN_MATH_SUBSCRIPT, "math-subscript", Noop, Math },
543                 { LFUN_MATH_SUPERSCRIPT, "math-superscript", Noop, Math },
544                 { LFUN_MATH_LIMITS, "math-limits", Noop, Math },
545                 { LFUN_MATH_MACRO, "math-macro", Noop, Math },
546                 { LFUN_MATH_MUTATE, "math-mutate", Noop, Math },
547                 { LFUN_MATH_SPACE, "math-space", Noop, Math },
548                 { LFUN_MATH_IMPORT_SELECTION, "math-import-selection", Noop, Math },
549                 { LFUN_MATH_MATRIX, "math-matrix", Noop, Math },
550                 { LFUN_MATH_MODE, "math-mode", Noop, Math },
551 /**
552  * \var lyx::kb_action lyx::LFUN_MATH_NUMBER_LINE_TOGGLE
553  * \li Action: Toggles numbering of the current formula line.
554  * \li Notion: Must be in display formula mode.
555  * \li Syntax: math-number-line-toggle
556  * \li Origin: Alejandro 18 Jun 1996
557  */
558                 { LFUN_MATH_NUMBER_LINE_TOGGLE, "math-number-line-toggle", Noop, Math },
559 /**
560  * \var lyx::kb_action lyx::LFUN_MATH_NUMBER_TOGGLE
561  * \li Action: Toggles numbering of the current formula.
562  * \li Notion: Must be in display formula mode.
563  * \li Syntax: math-number-toggle
564  * \li Origin: Alejandro 4 Jun 1996
565  */
566                 { LFUN_MATH_NUMBER_TOGGLE, "math-number-toggle", Noop, Math },
567                 { LFUN_MATH_EXTERN, "math-extern", Noop, Math },
568                 { LFUN_MATH_SIZE, "math-size", Noop, Math },
569 /**
570  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_UNFOLD
571  * \li Action: Unfold a Math Macro
572  * \li Notion: Unfold the Math Macro the cursor is in, i.e.
573                display it as \foo.
574  * \li Syntax: math-macro-unfold
575  * \li Origin: sts, 06 January 2008
576  */
577                 { LFUN_MATH_MACRO_UNFOLD, "math-macro-unfold", ReadOnly | SingleParUpdate, Math },
578 /**
579  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_FOLD
580  * \li Action: Fold a Math Macro
581  * \li Notion: Fold the Math Macro the cursor is in if it was
582                unfolded, i.e. displayed as \foo before.
583  * \li Syntax: math-macro-fold
584  * \li Origin: sts, 06 January 2008
585  */
586                 { LFUN_MATH_MACRO_FOLD, "math-macro-fold", ReadOnly | SingleParUpdate, Math },
587 /**
588  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_ADD_PARAM
589  * \li Action: Add a parameter
590  * \li Notion: Add a parameter to a Math Macro
591  * \li Params: <NUM>: The number of the parameter behind which the new one
592                will be added (1 for the first, i.e. use 0 for add a
593                parameter at the left), defaults to the last one.
594  * \li Syntax: math-macro-add-param <NUM>
595  * \li Origin: sts, 06 January 2008
596  */
597                 { LFUN_MATH_MACRO_ADD_PARAM, "math-macro-add-param", Noop, Math },
598 /**
599  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_REMOVE_PARAM
600  * \li Action: Remove the last parameter
601  * \li Notion: Remove the last parameter of a Math Macro and
602                remove its value in all instances of the macro
603                in the buffer.
604  * \li Params: <NUM>: The number of the parameter to be deleted (1 for
605                the first), defaults to the last one.
606  * \li Syntax: math-macro-remove-param <NUM>
607  * \li Origin: sts, 06 January 2008
608  */
609                 { LFUN_MATH_MACRO_REMOVE_PARAM, "math-macro-remove-param", Noop, Math },
610 /**
611  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_APPEND_GREEDY_PARAM
612  * \li Action: Append a greedy parameter
613  * \li Notion: Append a greedy parameter to a Math Macro which
614                eats the following mathed cell in every instance of
615                the macro in the buffer.
616  * \li Syntax: math-macro-append-greedy-param
617  * \li Origin: sts, 06 January 2008
618  */
619                 { LFUN_MATH_MACRO_APPEND_GREEDY_PARAM, "math-macro-append-greedy-param", Noop, Math },
620 /**
621  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM
622  * \li Action: Remove a greedy parameter
623  * \li Notion: Remove a greedy parameter of a Math Macro and spit
624                out the values of it in every instance of the macro
625                in the buffer. If it is an optional parameter the [valud]
626                format is used.
627  * \li Syntax: math-macro-remove-greedy-param
628  * \li Origin: sts, 06 January 2008
629  */
630                 { LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM, "math-macro-remove-greedy-param", Noop, Math },
631 /**
632  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_MAKE_OPTIONAL
633  * \li Action: Make a parameter optional
634  * \li Notion: Turn the first non-optional parameter of a Math Macro
635                into an optional parameter with a default value.
636  * \li Syntax: math-macro-make-optional
637  * \li Origin: sts, 06 January 2008
638  */
639                 { LFUN_MATH_MACRO_MAKE_OPTIONAL, "math-macro-make-optional", Noop, Math },
640 /**
641  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_MAKE_NONOPTIONAL
642  * \li Action: Make a parameter non-optional
643  * \li Notion: Turn the last optional parameter of a Math Macro
644                into a non-optional parameter. The default value is
645                remembered to be reused later if the user changes his mind.
646  * \li Syntax: math-macro-make-nonoptional
647  * \li Origin: sts, 06 January 2008
648  */
649                 { LFUN_MATH_MACRO_MAKE_NONOPTIONAL, "math-macro-make-nonoptional", Noop, Math },
650 /**
651  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM
652  * \li Action: Add an optional parameter
653  * \li Notion: Insert an optional parameter just behind the
654                already existing optional parameters.
655  * \li Syntax: math-macro-add-optional-param
656  * \li Origin: sts, 06 January 2008
657  */
658                 { LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM, "math-macro-add-optional-param", Noop, Math },
659 /**
660  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM
661  * \li Action: Remove the last optional parameter
662  * \li Notion: Remove the last optional parameter of a Math Macro and
663                remove it in all the instances of the macro in the buffer.
664  * \li Syntax: math-macro-remove-optional-param
665  * \li Origin: sts, 06 January 2008
666  */
667                 { LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM, "math-macro-remove-optional-param", Noop, Math },
668 /**
669  * \var lyx::kb_action lyx::LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM
670  * \li Action: Add a greedy optional parameter
671  * \li Notion: Add a greedy optional parameter which eats the value
672                from the following cells in mathed which are in the [value]
673                format.
674  * \li Syntax: math-macro-add-greedy-optional-param
675  * \li Origin: sts, 06 January 2008
676  */
677                 { LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM, "math-macro-add-greedy-optional-param", Noop, Math },
678 /**
679  * \var lyx::kb_action lyx::LFUN_IN_MATHMACROTEMPLATE
680  * \li Action: Only active in Math Macro definition
681  * \li Notion: Dummy function which is only active in a Math Macro definition.
682                It's used to toggle the Math Macro toolbar if the cursor moves
683                into a Math Macro definition.
684  * \li Syntax: in-mathmacrotemplate
685  * \li Origin: sts, 06 January 2008
686  */
687                 { LFUN_IN_MATHMACROTEMPLATE, "in-mathmacrotemplate", Noop, Math },
688
689                 { LFUN_PARAGRAPH_DOWN, "paragraph-down", ReadOnly | NoUpdate, Edit },
690                 { LFUN_PARAGRAPH_DOWN_SELECT, "paragraph-down-select", ReadOnly, Edit },
691                 { LFUN_PARAGRAPH_GOTO, "paragraph-goto", ReadOnly, Edit },
692 /**
693  * \var lyx::kb_action lyx::LFUN_OUTLINE_UP
694  * \li Action: Move the current group in the upward direction in the
695                structure of the document.
696  * \li Notion: The "group" can be Part/Chapter/Section/etc. It moves
697                the whole substructure of the group.
698  * \li Syntax: outline-up
699  * \li Origin: Vermeer, 23 Mar 2006
700  */
701                 { LFUN_OUTLINE_UP, "outline-up", Noop, Edit },
702 /**
703  * \var lyx::kb_action lyx::LFUN_OUTLINE_DOWN
704  * \li Action: Move the current group in the downward direction in the
705                structure of the document.
706  * \li Notion: The "group" can be Part/Chapter/Section/etc. It moves
707                the whole substructure of the group.
708  * \li Syntax: outline-down
709  * \li Origin: Vermeer, 23 Mar 2006
710  */
711                 { LFUN_OUTLINE_DOWN, "outline-down", Noop, Edit },
712 /**
713  * \var lyx::kb_action lyx::LFUN_OUTLINE_IN
714  * \li Action: Moves the current group in the downward direction in the
715                hierarchy of the document structure.
716  * \li Notion: Part -> Chapter -> Section -> etc.
717  * \li Syntax: outline-in
718  * \li Origin: Vermeer, 23 Mar 2006
719  */
720                 { LFUN_OUTLINE_IN, "outline-in", Noop, Edit },
721 /**
722  * \var lyx::kb_action lyx::LFUN_OUTLINE_OUT
723  * \li Action: Moves the current group in the upward direction in the
724                hierarchy of the document structure.
725  * \li Notion: Part <- Chapter <- Section <- etc.
726  * \li Syntax: outline-out
727  * \li Origin: Vermeer, 23 Mar 2006
728  */
729                 { LFUN_OUTLINE_OUT, "outline-out", Noop, Edit },
730
731                 { LFUN_PARAGRAPH_SPACING, "paragraph-spacing", Noop, Edit },
732                 { LFUN_PARAGRAPH_UP, "paragraph-up", ReadOnly | NoUpdate, Edit },
733                 { LFUN_PARAGRAPH_UP_SELECT, "paragraph-up-select", ReadOnly, Edit },
734
735                 { LFUN_EXTERNAL_EDIT, "external-edit", Noop, Edit },
736                 { LFUN_GRAPHICS_EDIT, "graphics-edit", Noop, Edit },
737
738                 { LFUN_CELL_BACKWARD, "cell-backward", Noop, Edit },
739                 { LFUN_CELL_FORWARD, "cell-forward", Noop, Edit },
740                 { LFUN_CELL_SPLIT, "cell-split", Noop, Edit },
741                 { LFUN_TABULAR_INSERT, "tabular-insert", Noop, Edit },
742                 { LFUN_TABULAR_FEATURE, "tabular-feature", Noop, Edit },
743
744                 { LFUN_VC_CHECK_IN, "vc-check-in", ReadOnly, System },
745                 { LFUN_VC_CHECK_OUT, "vc-check-out", ReadOnly, System },
746                 { LFUN_VC_REGISTER, "vc-register", ReadOnly, System },
747                 { LFUN_VC_REVERT, "vc-revert", ReadOnly, System },
748                 { LFUN_VC_UNDO_LAST, "vc-undo-last", ReadOnly, System },
749
750                 { LFUN_CHANGES_TRACK, "changes-track", Noop, Edit },
751                 { LFUN_CHANGES_OUTPUT, "changes-output", Noop, Edit },
752                 { LFUN_CHANGE_NEXT, "change-next", ReadOnly, Edit },
753                 { LFUN_CHANGES_MERGE, "changes-merge", Noop, Edit },
754                 { LFUN_CHANGE_ACCEPT, "change-accept", Noop, Edit },
755                 { LFUN_CHANGE_REJECT, "change-reject", Noop, Edit },
756                 { LFUN_ALL_CHANGES_ACCEPT, "all-changes-accept", Noop, Edit },
757                 { LFUN_ALL_CHANGES_REJECT, "all-changes-reject", Noop, Edit },
758
759                 { LFUN_INSET_APPLY, "inset-apply", Noop, Edit },
760                 { LFUN_INSET_DISSOLVE, "inset-dissolve", Noop, Edit },
761                 { LFUN_INSET_INSERT, "inset-insert", Noop, Edit },
762                 { LFUN_INSET_MODIFY, "", Noop, Hidden },
763                 { LFUN_INSET_DIALOG_UPDATE, "", Noop, Hidden },
764                 { LFUN_INSET_SETTINGS, "inset-settings", ReadOnly, Edit },
765                 { LFUN_INSET_REFRESH, "", Noop, Hidden },
766                 { LFUN_NEXT_INSET_TOGGLE, "next-inset-toggle", ReadOnly, Edit },
767                 { LFUN_INSET_TOGGLE, "", ReadOnly, Hidden },
768                 { LFUN_ALL_INSETS_TOGGLE, "all-insets-toggle", ReadOnly, Edit },
769
770 /**
771  * \var lyx::kb_action lyx::LFUN_PARAGRAPH_PARAMS
772  * \li Action: Change paragraph settings
773  * \li Notion: Modifies the current paragraph, or currently selected paragraphs.
774                This function only modifies, and does not override, existing settings.
775                Note that the "leftindent" indent setting is deprecated.
776  * \li Syntax: paragraph-params [<INDENT>] [<SPACING>] [<ALIGN>] [<OTHERS>]
777  * \li Params: <INDENT>:  \\noindent|\\indent|\\indent-toggle|\\leftindent LENGTH\n
778                <SPACING>: \\paragraph_spacing default|single|onehalf|double|other\n
779                <ALIGN>:   \\align block|left|right|center|default\n
780                <OTHERS>:  \\labelwidthstring WIDTH|\\start_of_appendix\n
781  * \li Origin: rgh, Aug 15 2007
782  */
783                 { LFUN_PARAGRAPH_PARAMS, "paragraph-params", Noop, Edit },
784 /**
785  * \var lyx::kb_action lyx::LFUN_PARAGRAPH_PARAMS_APPLY
786  * \li Action: Change paragraph settings.
787  * \li Notion: Overwrite all nonspecified settings to the default ones.
788                Use paragraph-params lfun if you don't want to overwrite others settings.
789  * \li Syntax: paragraph-params-apply <INDENT> <SPACING> <ALIGN> <OTHERS>
790  * \li Params: For parameters see LFUN_PARAGRAPH_PARAMS
791  * \li Origin: leeming, 30 Mar 2004
792  */
793                 { LFUN_PARAGRAPH_PARAMS_APPLY, "paragraph-params-apply", Noop, Edit },
794                 { LFUN_PARAGRAPH_UPDATE, "", Noop, Hidden },
795
796                 { LFUN_FINISHED_FORWARD, "", ReadOnly, Hidden },
797                 { LFUN_FINISHED_BACKWARD, "", ReadOnly, Hidden },
798                 { LFUN_FINISHED_RIGHT, "", ReadOnly, Hidden },
799                 { LFUN_FINISHED_LEFT, "", ReadOnly, Hidden },
800
801                 { LFUN_LANGUAGE, "language", Noop, Edit },
802
803                 { LFUN_LABEL_GOTO, "label-goto", ReadOnly, Edit },
804                 { LFUN_LABEL_INSERT, "label-insert", Noop, Edit },
805                 { LFUN_REFERENCE_NEXT, "reference-next", ReadOnly, Edit },
806
807 /**
808  * \var lyx::kb_action lyx::LFUN_BOOKMARK_GOTO
809  * \li Action: Goto a bookmark
810  * \li Notion: Moves the cursor to the numbered bookmark, opening the file
811                if necessary. Note that bookmarsk are saved per-session, not
812                per file.
813  * \li Syntax: bookmark-goto <NUMBER>
814  * \li Params: <NUMBER>: the number of the bookmark to restore.
815  * \li Origin: Dekel, 27 January 2001
816  */
817                 { LFUN_BOOKMARK_GOTO, "bookmark-goto", NoBuffer, Edit },
818 /**
819  * \var lyx::kb_action lyx::LFUN_BOOKMARK_SAVE
820  * \li Action: Save a bookmark
821  * \li Notion: Saves a numbered bookmark to the sessions file. The number
822                must be between 1 and 9, inclusive. Note that bookmarks are
823                saved per-session, not per file.
824  * \li Syntax: bookmark-save <NUMBER>
825  * \li Params: <NUMBER>: the number of the bookmark to save.
826  * \li Origin: Dekel, 27 January 2001
827  */
828                 { LFUN_BOOKMARK_SAVE, "bookmark-save", ReadOnly, Edit },
829 /**
830  * \var lyx::kb_action lyx::LFUN_BOOKMARK_CLEAR
831  * \li Action: Clears the list of saved bookmarks
832  * \li Syntax: bookmark-clear
833  * \li Origin: bpeng, 31 October 2006
834  */
835                 { LFUN_BOOKMARK_CLEAR, "bookmark-clear", NoBuffer, Edit },
836
837                 { LFUN_HELP_OPEN, "help-open", NoBuffer | Argument, Buffer },
838 /**
839  * \var lyx::kb_action lyx::LFUN_LYX_QUIT
840  * \li Action: Terminates the current LyX instance
841  * \li Notion: Terminates the current LyX instance, asking whether to save
842                modified documents, etc.
843  * \li Syntax: lyx-quit
844  */
845                 { LFUN_LYX_QUIT, "lyx-quit", NoBuffer, Buffer },
846                 { LFUN_TOOLBAR_TOGGLE, "toolbar-toggle", NoBuffer, Buffer },
847                 { LFUN_MENU_OPEN, "menu-open", NoBuffer, Buffer },
848
849                 { LFUN_WINDOW_NEW, "window-new", NoBuffer, Buffer },
850                 { LFUN_WINDOW_CLOSE, "window-close", NoBuffer, Buffer },
851
852                 { LFUN_DIALOG_SHOW, "dialog-show", NoBuffer, Edit },
853                 { LFUN_DIALOG_SHOW_NEW_INSET, "dialog-show-new-inset", Noop, Edit },
854                 { LFUN_DIALOG_UPDATE, "dialog-update", NoBuffer, Edit },
855                 { LFUN_DIALOG_HIDE, "dialog-hide", NoBuffer, Edit },
856                 { LFUN_DIALOG_TOGGLE, "dialog-toggle", NoBuffer, Edit },
857                 { LFUN_DIALOG_DISCONNECT_INSET, "dialog-disconnect-inset", Noop, Edit },
858
859                 { LFUN_MOUSE_PRESS, "", ReadOnly, Hidden },
860                 { LFUN_MOUSE_MOTION, "", ReadOnly | SingleParUpdate, Hidden },
861                 { LFUN_MOUSE_RELEASE, "", ReadOnly, Hidden },
862                 { LFUN_MOUSE_DOUBLE, "", ReadOnly, Hidden },
863                 { LFUN_MOUSE_TRIPLE, "", ReadOnly, Hidden },
864
865                 { LFUN_KEYMAP_OFF, "keymap-off", ReadOnly, Edit },
866                 { LFUN_KEYMAP_PRIMARY, "keymap-primary", ReadOnly, Edit },
867                 { LFUN_KEYMAP_SECONDARY, "keymap-secondary", ReadOnly, Edit },
868                 { LFUN_KEYMAP_TOGGLE, "keymap-toggle", ReadOnly, Edit },
869
870                 { LFUN_MESSAGE, "message", NoBuffer, System },
871                 { LFUN_FLOAT_LIST, "float-list", Noop, Edit },
872                 { LFUN_ESCAPE, "escape", ReadOnly, Edit },
873
874                 { LFUN_SERVER_CHAR_AFTER, "server-char-after", ReadOnly, System },
875                 { LFUN_SERVER_GET_FONT, "server-get-font", ReadOnly, System },
876                 { LFUN_SERVER_GET_LAYOUT, "server-get-layout", ReadOnly, System },
877                 { LFUN_SERVER_GET_NAME, "server-get-name", ReadOnly, System },
878                 { LFUN_SERVER_GET_XY, "server-get-xy", ReadOnly, System },
879                 { LFUN_SERVER_GOTO_FILE_ROW, "server-goto-file-row", ReadOnly, System },
880                 { LFUN_SERVER_NOTIFY, "server-notify", ReadOnly, System },
881                 { LFUN_SERVER_SET_XY, "server-set-xy", ReadOnly, System },
882
883                 { LFUN_BUILD_PROGRAM, "build-program", ReadOnly, Buffer },
884
885 /**
886  * \var lyx::kb_action lyx::LFUN_BUFFER_AUTO_SAVE
887  * \li Action: Saves the current buffer to a temporary file
888  * \li Notion: Saves the current buffer to a file named "#filename#". This LFUN
889                is called automatically by LyX, to "autosave" the current buffer.
890         * \li Syntax: buffer-auto-save
891  */
892                 { LFUN_BUFFER_AUTO_SAVE, "buffer-auto-save", Noop, Buffer },
893                 { LFUN_BUFFER_CHILD_OPEN, "buffer-child-open", ReadOnly, Buffer },
894                 { LFUN_BUFFER_CHKTEX, "buffer-chktex", ReadOnly, Buffer },
895                 { LFUN_BUFFER_TOGGLE_COMPRESSION, "buffer-toggle-compression", Noop, Buffer },
896                 { LFUN_BUFFER_TOGGLE_EMBEDDING, "buffer-toggle-embedding", Noop, Buffer },
897 /**
898  * \var lyx::kb_action lyx::LFUN_BUFFER_CLOSE
899  * \li Action: Closes the current buffer
900  * \li Notion: Closes the current buffer, asking whether to save it, etc,
901                if the buffer has been modified.
902  * \li Syntax: buffer-close
903  */
904                 { LFUN_BUFFER_CLOSE, "buffer-close", ReadOnly, Buffer },
905                 { LFUN_BUFFER_EXPORT, "buffer-export", ReadOnly, Buffer },
906                 { LFUN_BUFFER_EXPORT_CUSTOM, "buffer-export-custom", ReadOnly, Buffer },
907                 { LFUN_BUFFER_PRINT, "buffer-print", ReadOnly, Buffer },
908                 { LFUN_BUFFER_IMPORT, "buffer-import", NoBuffer, Buffer },
909 /**
910  * \var lyx::kb_action lyx::LFUN_BUFFER_NEW
911  * \li Action: Creates a new buffer (that is, document)
912  * \li Syntax: buffer-new
913  */
914                 { LFUN_BUFFER_NEW, "buffer-new", NoBuffer, Buffer },
915                 { LFUN_BUFFER_NEW_TEMPLATE,"buffer-new-template", NoBuffer, Buffer },
916                 { LFUN_BUFFER_RELOAD, "buffer-reload", ReadOnly, Buffer },
917                 { LFUN_BUFFER_SWITCH, "buffer-switch", NoBuffer | ReadOnly, Buffer },
918                 { LFUN_BUFFER_TOGGLE_READ_ONLY, "buffer-toggle-read-only", ReadOnly, Buffer },
919                 { LFUN_BUFFER_UPDATE, "buffer-update", ReadOnly, Buffer },
920 /**
921  * \var lyx::kb_action lyx::LFUN_BUFFER_VIEW
922  * \li Action: Displays current buffer in chosen format
923  * \li Notion: Displays the contents of the current buffer in the chosen
924                format, for example, PDF or DVI. This runs the necessary
925                converter, calls the defined viewer, and so forth.
926  * \li Syntax: buffer-view <FORMAT>
927  * \li Params: <FORMAT>: The format to display, where this is one of the
928                          formats defined (in the current GUI) in the
929                          Tools>Preferences>File Formats dialog.
930  */
931                 { LFUN_BUFFER_VIEW, "buffer-view", ReadOnly, Buffer },
932 /**
933  * \var lyx::kb_action lyx::LFUN_BUFFER_WRITE
934  * \li Action: Saves the current buffer
935  * \li Notion: Saves the current buffer to disk, using the filename that
936                is already associated with the buffer, asking for one if
937                none is yet assigned.
938  * \li Syntax: buffer-write
939  */
940                 { LFUN_BUFFER_WRITE, "buffer-write", ReadOnly, Buffer },
941 /**
942  * \var lyx::kb_action lyx::LFUN_BUFFER_WRITE_AS
943  * \li Action: Rename and save current buffer.
944  * \li Syntax: buffer-write-as <FILENAME>
945  * \li Params: <FILENAME>: New name of the buffer/file. A relative path
946  *             is with respect to the original location of the buffer/file.
947  */
948                 { LFUN_BUFFER_WRITE_AS, "buffer-write-as", ReadOnly, Buffer },
949                 { LFUN_BUFFER_WRITE_ALL, "buffer-write-all", ReadOnly, Buffer },
950                 { LFUN_BUFFER_NEXT, "buffer-next", ReadOnly, Buffer },
951                 { LFUN_BUFFER_PREVIOUS, "buffer-previous", ReadOnly, Buffer },
952                 { LFUN_MASTER_BUFFER_UPDATE, "master-buffer-update", ReadOnly, Buffer },
953                 { LFUN_MASTER_BUFFER_VIEW, "master-buffer-view", ReadOnly, Buffer },
954                 { LFUN_BUFFER_LANGUAGE, "buffer-language", Noop, Buffer },
955                 { LFUN_BUFFER_SAVE_AS_DEFAULT, "buffer-save-as-default", Noop, Buffer },
956                 { LFUN_BUFFER_PARAMS_APPLY, "buffer-params-apply", Noop, Buffer },
957
958                 { LFUN_FILE_INSERT, "file-insert", Noop, Edit },
959                 { LFUN_FILE_INSERT_PLAINTEXT, "file-insert-plaintext", Noop, Edit },
960                 { LFUN_FILE_INSERT_PLAINTEXT_PARA, "file-insert-plaintext-para", Noop, Edit },
961                 { LFUN_FILE_NEW, "file-new", NoBuffer, Buffer },
962                 { LFUN_FILE_OPEN, "file-open", NoBuffer, Buffer },
963
964                 { LFUN_META_PREFIX, "meta-prefix", NoBuffer, System },
965
966 /**
967  * \var lyx::kb_action lyx::LFUN_CALL
968  * \li Action: Executes a command defined in a .def file.
969  * \li Notion: The definitions are by default read from lib/commands/default.def .
970                A .def file allows to define a command with \\define "<NAME>" "<LFUN>"
971                where <NAME> is the name of the new command and <LFUN> is the lfun code
972                to be executed (see e.g. command-sequence LFUN).
973                \\def_file "FileName" allows to include another .def file.
974                This is particularly useful in connection with toolbar buttons:
975                Since the name of the button image for this lfun is 
976                lib/images/commands/<NAME>.png this is the way to assign an image
977                to a complex command-sequence.
978  * \li Syntax: call <NAME>
979  * \li Params: <NAME>: Name of the command that must be called.
980  * \li Origin: broider, 2 Oct 2007
981  */
982                 { LFUN_CALL, "call", NoBuffer, System },
983                 { LFUN_CANCEL, "cancel", NoBuffer, System },
984
985                 { LFUN_COMMAND_EXECUTE, "command-execute", NoBuffer, Edit },
986                 { LFUN_COMMAND_PREFIX, "command-prefix", NoBuffer, Hidden },
987                 { LFUN_COMMAND_SEQUENCE, "command-sequence", NoBuffer, System },
988
989 /**
990  * \var lyx::kb_action lyx::LFUN_PREFERENCES_SAVE
991  * \li Action: Save user preferences.
992  * \li Syntax: preferences-save
993  * \li Origin: Lgb, 27 Nov 1999
994  */
995                 { LFUN_PREFERENCES_SAVE, "preferences-save", NoBuffer, System },
996 /**
997  * \var lyx::kb_action lyx::LFUN_RECONFIGURE
998  * \li Action: Reconfigure the automatic settings.
999  * \li Syntax: reconfigure
1000  * \li Origin: Asger, 14 Feb 1997
1001  */
1002                 { LFUN_RECONFIGURE, "reconfigure", NoBuffer, System },
1003                 { LFUN_LYXRC_APPLY, "lyxrc-apply", NoBuffer, System },
1004 /**
1005  * \var lyx::kb_action lyx::LFUN_TOGGLE_CURSOR_FOLLOWS_SCROLLBAR
1006  * \li Action: Determine whether keep cursor inside the editing window regardless
1007                the scrollbar movement.
1008  * \li Syntax: toggle-cursor-follows-scrollbar
1009  * \li Origin: ARRae, 2 Dec 1997
1010  */
1011                 { LFUN_TOGGLE_CURSOR_FOLLOWS_SCROLLBAR, "toggle-cursor-follows-scrollbar", ReadOnly, System },
1012 /**
1013  * \var lyx::kb_action lyx::LFUN_SET_COLOR
1014  * \li Action: Set the given LyX color to the color defined by the X11 name given.
1015  * \li Notion: A new color entry is created if the color is unknown.
1016                Color names can be stored as a part of user settings.
1017  * \li Syntax: set-color <LYX_NAME> <X11_NAME>
1018  * \li Origin: SLior, 11 Jun 2000
1019  */
1020                 { LFUN_SET_COLOR, "set-color", ReadOnly | NoBuffer, System },
1021 /**
1022  * \var lyx::kb_action lyx::LFUN_STATISTICS
1023  * \li Action: Count the statistics (number of words and characters)
1024                in the document or in the given selection.
1025  * \li Notion: Note that this function gives the number of words/chars written,
1026                not the number of characters which will be typeset.
1027  * \li Syntax: statistics
1028  * \li Origin: lasgouttes, Jan 27 2004; ps, Jan 8 2008
1029  */
1030                 { LFUN_STATISTICS, "statistics", ReadOnly, System },
1031
1032                 { LFUN_NOACTION, "", Noop, Hidden }
1033 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1034         };
1035
1036         for (int i = 0; items[i].action != LFUN_NOACTION; ++i) {
1037                 newFunc(items[i].action, items[i].name, items[i].attrib, items[i].type);
1038         }
1039
1040         init = true;
1041 }
1042 #endif
1043
1044 LyXAction::LyXAction()
1045 {
1046         init();
1047 }
1048
1049
1050 // Returns an action tag from a string.
1051 FuncRequest LyXAction::lookupFunc(string const & func) const
1052 {
1053         string const func2 = trim(func);
1054
1055         if (func2.empty()) {
1056                 return FuncRequest(LFUN_NOACTION);
1057         }
1058
1059         string cmd;
1060         string const arg = split(func2, cmd, ' ');
1061
1062         func_map::const_iterator fit = lyx_func_map.find(cmd);
1063
1064         return fit != lyx_func_map.end() ? FuncRequest(fit->second, arg) : FuncRequest(LFUN_UNKNOWN_ACTION);
1065 }
1066
1067
1068 string const LyXAction::getActionName(kb_action action) const
1069 {
1070         info_map::const_iterator const it = lyx_info_map.find(action);
1071         return it != lyx_info_map.end() ? it->second.name : string();
1072 }
1073
1074
1075 LyXAction::func_type const LyXAction::getActionType(kb_action action) const
1076 {
1077         info_map::const_iterator const it = lyx_info_map.find(action);
1078         return it != lyx_info_map.end() ? it->second.type : Hidden;
1079 }
1080
1081
1082 bool LyXAction::funcHasFlag(kb_action action,
1083                             LyXAction::func_attrib flag) const
1084 {
1085         info_map::const_iterator ici = lyx_info_map.find(action);
1086
1087         if (ici == lyx_info_map.end()) {
1088                 LYXERR0("action: " << action << " is not known.");
1089                 BOOST_ASSERT(false);
1090         }
1091
1092         return ici->second.attrib & flag;
1093 }
1094
1095
1096 LyXAction::const_func_iterator LyXAction::func_begin() const
1097 {
1098         return lyx_func_map.begin();
1099 }
1100
1101
1102 LyXAction::const_func_iterator LyXAction::func_end() const
1103 {
1104         return lyx_func_map.end();
1105 }
1106
1107
1108 } // namespace lyx