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