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