4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * Full author contact details are available in file CREDITS.
9 * To add a new function:
10 * - add a new enum constant and doc immediately before LFUN_LASTACTION
11 * - add an appropriate line in LyXAction.cpp
12 * - add a branch to a suitable ::doDispatch() method
13 * - add correct test to the corresponding ::getStatus() method
19 #include "support/strfwd.h"
24 /** These are all the lyx functions, the main mechanism
25 * through which the frontends communicate with the core.
27 * They are managed in LyXAction.cpp and handled in various
28 * ::dispatch() functions, starting with LyXFunc.C:dispatch(),
29 * BufferView::dispatch(), Cursor::dispatch() and
30 * Inset*::doDispatch();
33 /* LFUN documentation (a start at least, Chr 2007-08-12)
35 * The documentation below is primarily notes about restrictions and
36 * oddities relating to the different LFUNs.
38 * Doxygen template below. Some notes: Parameters should be set in uppercase
39 * and put in <BRACKETS>, as so.
52 LFUN_UNKNOWN_ACTION = -1,
57 * LFUN_SCREEN_RECENTER
58 * \li Action: Recenters the screen on the current cursor position
59 * \li Syntax: screen-recenter
64 * \li Action: Creates a new buffer (that is, document)
65 * \li Syntax: buffer-new
70 * \li Action: Saves the current buffer
71 * \li Notion: Saves the current buffer to disk, using the filename that
72 is already associated with the buffer, asking for one if
74 * \li Syntax: buffer-write
79 * LFUN_BUFFER_WRITE_AS
80 * \li Action: Rename and save current buffer.
81 * \li Syntax: buffer-write-as <FILENAME>
82 * \li Params: <FILENAME>: New name of the buffer/file. A relative path
83 * is with respect to the original location of the buffer/file.
89 * \li Action: Displays current buffer in chosen format
90 * \li Notion: Displays the contents of the current buffer in the chosen
91 format, for example, PDF or DVI. This runs the necessary
92 converter, calls the defined viewer, and so forth.
93 * \li Syntax: buffer-view <FORMAT>
94 * \li Params: <FORMAT>: The format to display, where this is one of the
95 formats defined (in the current GUI) in the
96 Tools>Preferences>File Formats dialog.
101 * \li Action: Closes the current buffer
102 * \li Notion: Closes the current buffer, asking whether to save it, etc,
103 if the buffer has been modified.
104 * \li Syntax: buffer-close
109 * \li Action: Terminates the current LyX instance
110 * \li Notion: Terminates the current LyX instance, asking whether to save
111 modified documents, etc.
112 * \li Syntax: lyx-quit
117 * LFUN_BUFFER_AUTO_SAVE
118 * \li Action: Saves the current buffer to a temporary file
119 * \li Notion: Saves the current buffer to a file named "#filename#". This LFUN
120 is called automatically by LyX, to "autosave" the current buffer.
121 * \li Syntax: buffer-auto-save
123 LFUN_BUFFER_AUTO_SAVE,
126 * \li Action: Undoes the last edit
132 * \li Action: Redoes the last thing undone
138 * \li Action: Pastes from the active clipboard
143 * LFUN_PRIMARY_SELECTION_PASTE
144 * \li Action: Pastes the material currently selected
145 * \li Syntax: primary-selection-paste
147 LFUN_PRIMARY_SELECTION_PASTE,
151 * \li Action: Cuts to the clipboard
157 * \li Action: Copies to the clipboard the last edit
166 LFUN_FONT_FREE_APPLY,
167 LFUN_FONT_FREE_UPDATE,
192 LFUN_CHAR_FORWARD_SELECT,
193 LFUN_CHAR_BACKWARD_SELECT,
197 LFUN_SCREEN_UP_SELECT,
198 LFUN_SCREEN_DOWN_SELECT,
199 LFUN_LINE_BEGIN_SELECT,
201 LFUN_LINE_END_SELECT,
202 LFUN_WORD_FORWARD_SELECT,
203 LFUN_WORD_BACKWARD_SELECT,
205 LFUN_BUFFER_BEGIN_SELECT,
207 LFUN_BUFFER_END_SELECT,
208 LFUN_SPACE_INSERT, // JSpitzm 20030520
209 LFUN_SPECIALCHAR_INSERT, // JSpitzm, 20071206
212 * \li Action: Toggle between MARK_ON and MARK_OFF
213 * \li Syntax: mark-toggle
214 * \li Origin: poenitz, May 5 2006
217 LFUN_CHAR_DELETE_FORWARD,
219 LFUN_CHAR_DELETE_BACKWARD,
221 LFUN_LINE_BREAK, // uwestoehr 20071125
222 LFUN_BREAK_PARAGRAPH,
225 LFUN_ACCENT_CIRCUMFLEX,
227 LFUN_MATH_SUPERSCRIPT,
234 LFUN_ACCENT_UNDERBAR,
235 LFUN_ACCENT_UNDERDOT,
241 LFUN_ACCENT_SPECIAL_CARON,
243 LFUN_ACCENT_HUNGARIAN_UMLAUT,
252 LFUN_SERVER_CHAR_AFTER,
255 LFUN_SERVER_GET_LAYOUT,
256 LFUN_SERVER_GET_FONT,
257 LFUN_SERVER_GET_NAME,
259 LFUN_SERVER_GOTO_FILE_ROW,
262 LFUN_ENVIRONMENT_INSERT, // unused as of 20060905
265 LFUN_KEYMAP_SECONDARY,
271 LFUN_MATH_DELIM, // Alejandro 180696
273 LFUN_MATH_DISPLAY, // Alejandro 180696
274 LFUN_MATH_MODE, // Alejandro 040696
277 * \li Action: Enable numbering of the current formula.
278 * \li Notion: Must be in display formula mode.
279 * \li Syntax: math-number
280 * \li Origin: Alejandro 4 Jun 1996
285 * \li Action: Disable numbering of the current formula.
286 * \li Notion: Must be in display formula mode.
287 * \li Syntax: math-nonumber
288 * \li Origin: Alejandro 18 Jun 1996
291 LFUN_MATH_SIZE, // Alejandro 150896
293 LFUN_MATH_MACRO, // ale970510
294 LFUN_MATH_EXTERN, // Andre' 20010424
295 LFUN_MATH_MUTATE, // Andre' 20010523
296 LFUN_MATH_IMPORT_SELECTION, // Andre' 20010704
297 LFUN_MATH_SPACE, // Andre' 20010725
299 LFUN_WORD_DELETE_FORWARD,
300 LFUN_WORD_DELETE_BACKWARD,
304 * \li Action: Disable selecting of text-region.
305 * \li Syntax: mark-off
310 * \li Action: Enable selecting of text-region.
311 * \li Notion: After enabling you can simply move arrow keys to get selected region.
312 * \li Syntax: mark-on
318 * \li Action: Sets the layout for the current paragraph
319 * \li Syntax: layout <LAYOUT>
320 * \li Params: <LAYOUT>: the layout to use
324 * LFUN_LAYOUT_PARAGRAPH
325 * \li Action: Launches the paragraph settings dialog
326 * \li Syntax: layout-paragraph
328 LFUN_LAYOUT_PARAGRAPH,
330 * LFUN_DROP_LAYOUTS_CHOICE
331 * \li Action: Displays list of layout choices
332 * \li Notion: In the current (as of 2007) Qt4 frontend, this LFUN opens the
333 dropbox allowing for choice of layout
334 * \li Syntax: drop-layouts-choice
336 LFUN_DROP_LAYOUTS_CHOICE, // used in bindings as of 20071228
337 LFUN_FONT_TYPEWRITER, // changed from FONT_CODE 20070920
347 LFUN_WORD_CAPITALIZE,
349 LFUN_DEPTH_DECREMENT,
350 LFUN_DEPTH_INCREMENT,
352 LFUN_MENU_OPEN, // used in bindings as of 20060905
355 LFUN_COMMAND_EXECUTE,
358 LFUN_FILE_INSERT_PLAINTEXT, // CFO-G 1997-11-19
359 LFUN_FILE_INSERT_PLAINTEXT_PARA,// Levon 2001-02-14
360 LFUN_FILE_NEW, // for scripting purposes
362 LFUN_PARAGRAPH_UP, // Asger 1996-10-01
364 LFUN_PARAGRAPH_UP_SELECT, // Asger 1996-10-01
365 LFUN_PARAGRAPH_DOWN, // Asger 1996-10-01
366 LFUN_PARAGRAPH_DOWN_SELECT, // Asger 1996-10-01
367 LFUN_BREAK_PARAGRAPH_SKIP,
368 LFUN_DELETE_BACKWARD_SKIP,
370 LFUN_DELETE_FORWARD_SKIP,
371 LFUN_BUFFER_NEW_TEMPLATE, // Asger 1997-02-02
372 LFUN_BUFFER_RELOAD, // Asger 1997-02-02
373 LFUN_RECONFIGURE, // Asger 1997-02-14
374 LFUN_INDEX_PRINT, // Lgb 97-02-27
377 LFUN_BUFFER_CHILD_OPEN, // Ale 970528
378 LFUN_TOC_INSERT, // Lgb 97-05-27
379 LFUN_FLOAT_LIST, // Lgb 20010503
380 LFUN_BUFFER_TOGGLE_READ_ONLY, // Lgb 97-05-27
382 LFUN_VC_REGISTER, // Lgb 97-07-01
383 LFUN_VC_CHECK_IN, // Lgb 97-07-01
384 LFUN_VC_CHECK_OUT, // Lgb 97-07-01
385 LFUN_VC_REVERT, // Lgb 97-07-01
386 LFUN_VC_UNDO_LAST, // Lgb 97-07-01
388 LFUN_BUFFER_EXPORT, // Lgb 97-07-29
389 LFUN_LABEL_GOTO, // Ale 970806
390 LFUN_TOGGLE_CURSOR_FOLLOWS_SCROLLBAR, // ARRae 971202
391 LFUN_BUFFER_CHKTEX, // Asger 971030
392 LFUN_HYPERLINK_INSERT, // CFO-G 971121
394 LFUN_WORD_FIND_FORWARD, // Etienne 980216
395 LFUN_WORD_FIND_BACKWARD, // Etienne 980220
396 LFUN_APPENDIX, // ettrich 980505
397 LFUN_BUFFER_IMPORT, // Asger 980724
398 LFUN_COMMAND_SEQUENCE, // Andre' 991111
400 LFUN_PREFERENCES_SAVE, // Lgb 991127
401 LFUN_HELP_OPEN, // Jug 990627
402 LFUN_DATE_INSERT, // jdblair 20000131
403 LFUN_LANGUAGE, // Dekel 20000203
404 LFUN_ERT_INSERT, // Jug 20000218
406 LFUN_FOOTNOTE_INSERT, // Jug 20000307
407 LFUN_PARAGRAPH_SPACING, // Lgb 20000411
408 LFUN_TABULAR_INSERT, // Jug 20000412
409 LFUN_LOFVIEW, // Dekel 20000519
410 LFUN_LOTVIEW, // Dekel 20000519
412 LFUN_LOAVIEW, // Dekel 20000519
413 LFUN_SET_COLOR, // SLior 20000611
414 LFUN_MARGINALNOTE_INSERT, // Lgb 20000626
415 LFUN_FLOAT_INSERT, // Lgb 20000627
416 LFUN_FLOAT_WIDE_INSERT, // Lgb 20010531
418 LFUN_CAPTION_INSERT, // Lgb 20000718; inactive as of 20060905
420 LFUN_TABULAR_FEATURE, // Jug 20000728
421 LFUN_LAYOUT_TABULAR, // Jug 20000731
422 LFUN_BUFFER_UPDATE, // Dekel 20000805
424 LFUN_INDEX_INSERT, // Angus 20000803
425 LFUN_SCREEN_FONT_UPDATE, // ARRae 20000813
426 LFUN_PARAGRAPH_GOTO, // Dekel 20000826
427 LFUN_REFERENCE_NEXT, // Dekel 20010114
430 * \li Action: Save a bookmark
431 * \li Notion: Saves a numbered bookmark to the sessions file. The number
432 must be between 1 and 9, inclusive. Note that bookmarks are
433 saved per-session, not per file.
434 * \li Syntax: bookmark-save <NUMBER>
435 * \li Params: <NUMBER>: the number of the bookmark to save.
436 * \li Origin: Dekel, 27 January 2001
442 * \li Action: Goto a bookmark
443 * \li Notion: Moves the cursor to the numbered bookmark, opening the file
444 if necessary. Note that bookmarsk are saved per-session, not
446 * \li Syntax: bookmark-goto <NUMBER>
447 * \li Params: <NUMBER>: the number of the bookmark to restore.
448 * \li Origin: Dekel, 27 January 2001
451 LFUN_SELECT_FILE_SYNC, // Levon 20010214
452 LFUN_MESSAGE, // Lgb 20010408; for scripting purposes, output in minibuffer
453 LFUN_CHARS_TRANSPOSE, // Lgb 20010425
454 LFUN_ESCAPE, // Lgb 20010517
456 LFUN_THESAURUS_ENTRY, // Levon 20010720
457 LFUN_OPTIONAL_INSERT, // Martin 12 Aug 2002
458 LFUN_MOUSE_PRESS, // André 9 Aug 2002
459 LFUN_MOUSE_MOTION, // André 9 Aug 2002
460 LFUN_MOUSE_RELEASE, // André 9 Aug 2002
462 LFUN_MOUSE_DOUBLE, // André 9 Aug 2002
463 LFUN_MOUSE_TRIPLE, // André 9 Aug 2002
464 LFUN_WRAP_INSERT, // Dekel 7 Apr 2002
465 LFUN_CHANGES_TRACK, // Levon 20021001 (cool date !)
466 LFUN_CHANGES_MERGE, // Levon 20021016
468 LFUN_CHANGE_ACCEPT, // Levon 20021016
469 LFUN_CHANGE_REJECT, // Levon 20021016
470 LFUN_ALL_CHANGES_ACCEPT, // Levon 20021016
471 LFUN_ALL_CHANGES_REJECT, // Levon 20021016
472 LFUN_BIBITEM_INSERT, // André 14 Feb 2003
475 LFUN_DIALOG_SHOW_NEW_INSET,
478 LFUN_DIALOG_TOGGLE, // JSpitzm 20070430
480 LFUN_DIALOG_DISCONNECT_INSET,
484 LFUN_INSET_DIALOG_UPDATE,
488 * LFUN_PARAGRAPH_PARAMS_APPLY
489 * \li Action: Change paragraph settings.
490 * \li Notion: Overwrite all nonspecified settings to the default ones.
491 Use paragraph-params lfun if you don't want to overwrite others settings.
492 * \li Syntax: paragraph-params-apply <INDENT> <SPACING> <ALIGN> <OTHERS>
493 * \li Params: For parameters see LFUN_PARAGRAPH_PARAMS
494 * \li Origin: leeming, 30 Mar 2004
496 LFUN_PARAGRAPH_PARAMS_APPLY,
497 LFUN_PARAGRAPH_UPDATE,
503 LFUN_NEWPAGE_INSERT, // uwestoehr 20071124
504 LFUN_PAGEBREAK_INSERT,
513 LFUN_BUFFER_EXPORT_CUSTOM,
515 LFUN_NEXT_INSET_TOGGLE,
516 LFUN_ALL_INSETS_TOGGLE,
517 LFUN_BUFFER_LANGUAGE,
520 * LFUN_TEXTCLASS_APPLY
521 * \li Action: Sets the text class for the current buffer
522 * \li Syntax: textclass-apply <TEXTCLASS>
523 * \li Params: <TEXTCLASS>: the textclass to set. Note that this must be
524 the filename, minus the ".layout" extension.
526 LFUN_TEXTCLASS_APPLY,
528 * LFUN_TEXTCLASS_LOAD
529 * \li Action: Loads information for a textclass from disk
530 * \li Syntax: textclass-load <TEXTCLASS>
531 * \li Params: <TEXTCLASS>: the textclass to load. Note that this must be
532 the filename, minus the ".layout" extension.
535 LFUN_BUFFER_SAVE_AS_DEFAULT,
536 LFUN_BUFFER_PARAMS_APPLY,
542 LFUN_BUFFER_PREVIOUS,
545 LFUN_CHANGES_OUTPUT, // jspitzm 20050121
546 LFUN_BIBTEX_DATABASE_ADD,
547 LFUN_BIBTEX_DATABASE_DEL,
548 LFUN_CITATION_INSERT,
549 LFUN_OUTLINE_UP, // Vermeer 20060323
554 LFUN_PARAGRAPH_MOVE_DOWN, // Edwin 20060408
555 LFUN_PARAGRAPH_MOVE_UP, // Edwin 20060408
557 LFUN_BUFFER_TOGGLE_COMPRESSION, // bpeng 20060427
559 LFUN_CLIPBOARD_PASTE,
560 LFUN_INSET_DISSOLVE, // jspitzm 20060807
563 LFUN_WINDOW_NEW, // Abdel 20061021
564 LFUN_WINDOW_CLOSE, // Abdel 20061023
565 LFUN_UNICODE_INSERT, // Lgb 20061022
567 * LFUN_BOOKMARK_CLEAR
568 * \li Action: Clears the list of saved bookmarks
569 * \li Syntax: bookmark-clear
570 * \li Origin: bpeng, 31 October 2006
572 LFUN_BOOKMARK_CLEAR, // bpeng 20061031
573 LFUN_NOMENCL_INSERT, // Ugras
575 LFUN_NOMENCL_PRINT, // Ugras
576 LFUN_CLEARPAGE_INSERT, // Ugras 20061125
577 LFUN_CLEARDOUBLEPAGE_INSERT, // Ugras 20061125
578 LFUN_LISTING_INSERT, // Herbert 20011110, bpeng 20070502
579 LFUN_TOOLBAR_TOGGLE, // Edwin 20070521
581 LFUN_BUFFER_WRITE_ALL, // rgh, gpothier 200707XX
583 * LFUN_PARAGRAPH_PARAMS
584 * \li Action: Change paragraph settings
585 * \li Notion: Modifies the current paragraph, or currently selected paragraphs.
586 This function only modifies, and does not override, existing settings.
587 Note that the "leftindent" indent setting is deprecated.
588 * \li Syntax: paragraph-params [<INDENT>] [<SPACING>] [<ALIGN>] [<OTHERS>]
589 * \li Params: <INDENT>: \\noindent|\\indent|\\indent-toggle|\\leftindent LENGTH\n
590 <SPACING>: \\paragraph_spacing default|single|onehalf|double|other\n
591 <ALIGN>: \\align block|left|right|center|default\n
592 <OTHERS>: \\labelwidthstring WIDTH|\\start_of_appendix\n
593 * \li Origin: rgh, Aug 15 2007
595 LFUN_PARAGRAPH_PARAMS,
597 * LFUN_LAYOUT_MODULES_CLEAR
598 * \li Action: Clears the module list
599 * \li Notion: Clears the list of included modules for the current buffer.
600 * \li Syntax: layout-modules-clear
601 * \li Origin: rgh, 25 August 2007
603 LFUN_LAYOUT_MODULES_CLEAR,
605 * LFUN_LAYOUT_MODULE_ADD
606 * \li Action: Adds a module
607 * \li Notion: Adds a module to the list of included modules for the current buffer.
608 * \li Syntax: layout-module-add <MODULE>
609 * \li Params: <MODULE>: the module to be added
610 * \li Origin: rgh, 25 August 2007
612 LFUN_LAYOUT_MODULE_ADD,
615 * \li Action: Reloads layout information
616 * \li Notion: Reloads all layout information for the current buffer from disk, thus
617 recognizing any changes that have been made to layout files on the fly.
618 This is intended to be used only by layout developers and should not be
619 used when one is trying to do actual work.
620 * \li Syntax: layout-reload
621 * \li Origin: rgh, 3 September 2007
625 LFUN_MASTER_BUFFER_VIEW, // Tommaso, 20070920
626 LFUN_MASTER_BUFFER_UPDATE, // Tommaso, 20070920
627 LFUN_INFO_INSERT, // bpeng, 20071007
628 LFUN_CALL, // broider, 20071002
629 LFUN_BUFFER_TOGGLE_EMBEDDING, // bpeng, 20071021
631 LFUN_CHAR_LEFT, // dov, 20071022
632 LFUN_CHAR_LEFT_SELECT, // dov, 20071022
633 LFUN_CHAR_RIGHT, // dov, 20071022
634 LFUN_CHAR_RIGHT_SELECT, // dov, 20071022
635 LFUN_FINISHED_BACKWARD, // dov, 20071022
637 LFUN_FINISHED_FORWARD, // dov, 20071022
638 LFUN_WORD_LEFT, // dov, 20071028
639 LFUN_WORD_LEFT_SELECT, // dov, 20071028
640 LFUN_WORD_RIGHT, // dov, 20071028
641 LFUN_WORD_RIGHT_SELECT, // dov, 20071028
643 LFUN_MATH_MACRO_FOLD,
644 LFUN_MATH_MACRO_UNFOLD,
645 LFUN_MATH_MACRO_ADD_PARAM,
646 LFUN_MATH_MACRO_REMOVE_PARAM,
647 LFUN_MATH_MACRO_APPEND_GREEDY_PARAM,
649 LFUN_MATH_MACRO_REMOVE_GREEDY_PARAM,
650 LFUN_MATH_MACRO_MAKE_OPTIONAL,
651 LFUN_MATH_MACRO_MAKE_NONOPTIONAL,
652 LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM,
653 LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM,
656 LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM,
657 LFUN_IN_MATHMACROTEMPLATE,
659 * \li Action: scroll the buffer view
660 * \li Notion: Only scrolls the screen up or down; does not move the cursor.
661 * \li Syntax: scroll <TYPE> <QUANTITY>
662 * \li Params: <TYPE>: line|page\n
663 <QUANTITY>: up|down|<number>\n
664 * \li Origin: Abdelrazak Younes, Dec 27 2007
667 LFUN_LASTACTION // end of the table