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