X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXAction.cpp;h=6b6a982aa66c06f2282e107d980669139c14970e;hb=2098f1d8c20d51e63e670bcdc9da8996068975bf;hp=59ab3ab147cf5a7e28c30446c27077029eccee45;hpb=c676061c2e6768125b01f5b1d398b73cf51b7033;p=lyx.git diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index 59ab3ab147..6b6a982aa6 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -35,7 +35,7 @@ namespace lyx { Here's the set of rules to apply when a new command name is introduced: 1) Use the object.event order. That is, use `word-forward' - instead of `forward-word'. + instead of `forward-word'. 2) Don't introduce an alias for an already named object. Same for events. 3) Forward movement or focus is called `forward' (not `right'). 4) Backward movement or focus is called `backward' (not `left'). @@ -74,7 +74,7 @@ LyXAction lyxaction; void LyXAction::newFunc(FuncCode action, string const & name, - unsigned int attrib, LyXAction::func_type type) + unsigned int attrib, LyXAction::FuncType type) { lyx_func_map[name] = action; FuncInfo tmpinfo; @@ -97,13 +97,14 @@ void LyXAction::init() // magnitudes faster. static bool init; - if (init) return; + if (init) + return; struct ev_item { FuncCode action; char const * name; unsigned int attrib; - func_type type; + FuncType type; }; ev_item const items[] = { @@ -370,7 +371,7 @@ void LyXAction::init() * \li Action: Insert a tab into a listings inset. * \li Notion: It also works on a selection. * \li Syntax: tab-insert - * \li Origin: vfvanravesteijn, Sep 30 2008 + * \li Origin: vfr, Sep 30 2008 * \endvar */ { LFUN_TAB_INSERT, "tab-insert", SingleParUpdate, Edit }, @@ -380,16 +381,16 @@ void LyXAction::init() a listings inset. * \li Notion: It also works on a selection - it removes a tab or spaces from the beginning of each line spanned by the selection. This is useful if - you want to indent/unindent multiple lines in one action. + you want to indent/unindent multiple lines in one action. * \li Syntax: tab-delete - * \li Origin: vfvanravesteijn, Sep 30 2008 + * \li Origin: vfr, Sep 30 2008 * \endvar */ { LFUN_TAB_DELETE, "tab-delete", SingleParUpdate, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_QUOTE_INSERT * \li Action: Inserts quotes according to the type and quote-language preference. - * \li Action: Currently English, Swedish, German, Polish, French, Danish quotes + * \li Notion: Currently English, Swedish, German, Polish, French, Danish quotes are distinguished. * \li Syntax: quote-insert [] * \li Params: : 'single' for single quotes, otherwise double quotes will be used. @@ -403,11 +404,18 @@ void LyXAction::init() * \li Notion: Apart from lfun arguments you can use the following method: \n 1. input the type and argument of this inset, e.g. "menu paste", in the work area.\n - 2. select the text and run info-insert lfun. + 2. select the text and run info-insert lfun. * \li Syntax: info-insert - * \li Params: : shortcut|lyxrc|package|textclass|menu|buffer \n + * \li Params: : shortcut[s]|lyxrc|package|textclass|menu|buffer \n : argument for a given type. Look into InsetInfo.h for detailed - description. + description. \n + shortcut[s]: name of lfun (e.g math-insert \alpha) \n + lyxrc: name of rc_entry (e.g. bind_file) \n + package: name of latex package (e.g. listings) \n + textclass: name of textclass (e.g. article) \n + menu: name of lfun used in menu \n + icon: name of lfun used in toolbar \n + buffer: "name"|"path"|"class" * \li Sample: command-sequence info-insert buffer path; info-insert buffer name * \li Origin: bpeng, 7 Oct 2007 * \endvar @@ -440,16 +448,16 @@ void LyXAction::init() class you're using has to load the character styles. There are a few contained in the Logical Markup module. You can also of course create some yourself. \n - For dissolving the element see #LFUN_INSET_DISSOLVE. + For dissolving the element see #LFUN_INSET_DISSOLVE. * \li Syntax: flex-insert * \li Params: TYPE: CharStyle|Custom|Element|Standard \n - Identifies whether this is a Character Style, a - Custom Inset or an XML Element, and which dynamical - sub-menu this flex inset is in on the LyX menu tree. - If Standard (currently unused): none of these. - Name: This name must be defined either in your layout file - or imported by some module. The definition is \n - InsetLayout + Identifies whether this is a Character Style, a + Custom Inset or an XML Element, and which dynamical + sub-menu this flex inset is in on the LyX menu tree. + If Standard (currently unused): none of these.\n + Name: This name must be defined either in your layout file + or imported by some module. The definition is + InsetLayout * \li Sample: flex-insert CharStyle:Code * \endvar */ @@ -515,7 +523,9 @@ void LyXAction::init() * \var lyx::FuncCode lyx::LFUN_INDEX_INSERT * \li Action: Inserts Index entry. * \li Notion: It automatically takes the word on the cursor position. - * \li Syntax: index-insert + * \li Syntax: index-insert [] + * \li Params: : name of the index, if multiple indices are defined. + with an empty argument, the default index is selected. * \li Origin: leeming, 3 Aug 2000 * \endvar */ @@ -523,7 +533,9 @@ void LyXAction::init() /*! * \var lyx::FuncCode lyx::LFUN_INDEX_PRINT * \li Action: Inserts list of Index entries on a new page. - * \li Syntax: index-print + * \li Syntax: index-print [] + * \li Params: : name of the index, if multiple indices are defined. + with an empty argument, the default index is selected. * \li Origin: Lgb, 27 Feb 1997 * \endvar */ @@ -631,7 +643,7 @@ void LyXAction::init() */ { LFUN_UP_SELECT, "up-select", ReadOnly | SingleParUpdate, Edit }, /*! - * \var lyx::FuncCode lyx::SCREEN_DOWN + * \var lyx::FuncCode lyx::LFUN_SCREEN_DOWN * \li Action: Moves the cursor one page in downward direction. * \li Syntax: screen-down * \endvar @@ -679,6 +691,15 @@ void LyXAction::init() */ { LFUN_SCREEN_RECENTER, "screen-recenter", ReadOnly, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_SCREEN_SHOW_CURSOR + * \li Action: Repositions the screen such that the cursor is visible. + * \li Syntax: screen-show-cursor + * \li Origin: vfr, 25 Mar 2009 + * \endvar + */ + { LFUN_SCREEN_SHOW_CURSOR, "screen-show-cursor", ReadOnly, Edit }, + /*! * \var lyx::FuncCode lyx::LFUN_CHAR_BACKWARD * \li Action: Moves the cursor one position logically backwards. @@ -794,7 +815,7 @@ void LyXAction::init() /*! * \var lyx::FuncCode lyx::LFUN_WORD_BACKWARD_SELECT * \li Action: Moves the cursor to the logically previous beginning of a word, - adding the logically traversed text to the selection. + adding the logically traversed text to the selection. * \li Notion: See also #LFUN_WORD_BACKWARD. * \li Syntax: word-backward-select * \endvar @@ -838,7 +859,7 @@ void LyXAction::init() * \li Syntax: word-find [] * \li Params: : data encoded from Find dialog (see #lyx::find2string()). If no parameter is given, search with last find-dialog - data is used for search (i.e. find-next). + data is used for search (i.e. find-next). * \li Origin: Andre, Jan 7 2004 * \endvar */ @@ -848,8 +869,8 @@ void LyXAction::init() * \li Action: Replace a string in the document. * \li Syntax: word-replace [] * \li Params: : data is of the form - " \n - \n + " \n + \n " * \li Origin: Andre, Jan 7 2004 * \endvar @@ -865,8 +886,9 @@ void LyXAction::init() * \li Origin: Tommaso, Nov 15 2007 * \endvar */ - { LFUN_WORD_FINDADV, "word-findadv", ReadOnly, Edit }, -/*! \var lyx::FuncCode lyx::LFUN_WORD_FORWARD + { LFUN_WORD_FINDADV, "word-findadv", ReadOnly | NoBuffer, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_WORD_FORWARD * \li Action: Moves the cursor to the logically next beginning of a word. * \li Notion: This is not the action which should be bound to the arrow keys, because forward may be left or right, depending on the language. @@ -879,7 +901,7 @@ void LyXAction::init() /*! * \var lyx::FuncCode lyx::LFUN_WORD_FORWARD_SELECT * \li Action: Moves the cursor to the logically next beginning of a word, - adding the logically traversed text to the selection. + adding the logically traversed text to the selection. * \li Notion: See also #LFUN_WORD_FORWARD. * \li Syntax: word-forward-select * \endvar @@ -889,12 +911,12 @@ void LyXAction::init() * \var lyx::FuncCode lyx::LFUN_WORD_LEFT * \li Action: Moves the cursor to the next beginning of a word "on the left". * \li Notion: This is the action which should be taken when the (e.g., ctrl-) - "left" key is pressed. Generally, it moves the cursor to the - next beginning of a word on the left. However, in Bidi text this - become slightly more complicated, and there are different modes - of cursor movement. In "visual mode", this moves left, plain and - simple. In "logical mode", movement is logically forward in RTL - paragraphs, and logically backwards in LTR paragraphs. + "left" key is pressed. Generally, it moves the cursor to the + next beginning of a word on the left. However, in Bidi text this + become slightly more complicated, and there are different modes + of cursor movement. In "visual mode", this moves left, plain and + simple. In "logical mode", movement is logically forward in RTL + paragraphs, and logically backwards in LTR paragraphs. * \li Syntax: word-left * \li Origin: dov, 28 Oct 2007 * \endvar @@ -903,7 +925,7 @@ void LyXAction::init() /*! * \var lyx::FuncCode lyx::LFUN_WORD_LEFT_SELECT * \li Action: Moves the cursor to the next beginning of a word "on the left", - adding *logically* traversed text to the selection. + adding *logically* traversed text to the selection. * \li Notion: See also #LFUN_WORD_LEFT for exact details of the movement. * \li Syntax: word-left-select * \li Origin: dov, 28 Oct 2007 @@ -914,13 +936,13 @@ void LyXAction::init() * \var lyx::FuncCode lyx::LFUN_WORD_RIGHT * \li Action: Moves the cursor to the next beginning of a word "on the right". * \li Notion: This is the action which should be taken when the (e.g., ctrl-) - "right" key is pressed. Generally, it moves the cursor to the - next beginning of a word on the right. However, in Bidi text - this become slightly more complicated, and there are different - modes of cursor movement. In "visual mode", this moves right, - plain and simple. In "logical mode", movement is logically - forward in LTR paragraphs, and logically backwards in RTL - paragraphs. + "right" key is pressed. Generally, it moves the cursor to the + next beginning of a word on the right. However, in Bidi text + this become slightly more complicated, and there are different + modes of cursor movement. In "visual mode", this moves right, + plain and simple. In "logical mode", movement is logically + forward in LTR paragraphs, and logically backwards in RTL + paragraphs. * \li Syntax: word-right * \li Origin: dov, 28 Oct 2007 * \endvar @@ -929,7 +951,7 @@ void LyXAction::init() /*! * \var lyx::FuncCode lyx::LFUN_WORD_RIGHT_SELECT * \li Action: Moves the cursor to the next beginning of a word "on the right", - adding *logically* traversed text to the selection. + adding *logically* traversed text to the selection. * \li Notion: See also #LFUN_WORD_RIGHT for exact details of the movement. * \li Syntax: word-right-select * \li Origin: dov, 28 Oct 2007 @@ -1009,6 +1031,58 @@ void LyXAction::init() */ { LFUN_BUFFER_END_SELECT, "buffer-end-select", ReadOnly, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_INSET_BEGIN + * \li Action: Move the cursor to the beginning of the current inset + if it is not already there, or at the beginning of the + enclosing inset otherwise + * \li Syntax: inset-begin + * \li Origin: lasgouttes, 16 Mar 2009 + * \endvar + */ + { LFUN_INSET_BEGIN, "inset-begin", ReadOnly, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_INSET_BEGIN_SELECT + * \li Action: Move the cursor to the beginning of the current inset + if it is not already there, or at the beginning of the + enclosing inset otherwise (adding the + traversed text to the selection). + * \li Syntax: inset-begin-select + * \li Origin: lasgouttes, 16 Mar 2009 + * \endvar + */ + { LFUN_INSET_BEGIN_SELECT, "inset-begin-select", ReadOnly, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_INSET_END + * \li Action: Move the cursor to the end of the current inset + if it is not already there, or at the end of the + enclosing inset otherwise + * \li Syntax: inset-end + * \li Origin: lasgouttes, 16 Mar 2009 + * \endvar + */ + { LFUN_INSET_END, "inset-end", ReadOnly, Edit }, +/*! + * \var lyx::FuncCode lyx::LFUN_INSET_END_SELECT + * \li Action: Move the cursor to the end of the current inset + if it is not already there, or at the end of the + enclosing inset otherwise (adding the + traversed text to the selection). + * \li Syntax: inset-end-select + * \li Origin: lasgouttes, 16 Mar 2009 + * \endvar + */ + { LFUN_INSET_END_SELECT, "inset-end-select", ReadOnly, Edit }, + +/*! + * \var lyx::FuncCode lyx::LFUN_INSET_SELECT_ALL + * \li Action: Selects all contents of an inset. + * \li Syntax: inset-select-all + * \li Origin: vfr, 22 Aug 2009 + * \endvar + */ + { LFUN_INSET_SELECT_ALL, "inset-select-all", ReadOnly, Edit }, + /*! * \var lyx::FuncCode lyx::LFUN_LINE_BEGIN * \li Action: Move the cursor to the begining of the (screen) line. @@ -1063,9 +1137,10 @@ void LyXAction::init() { LFUN_CUT, "cut", Noop, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_PASTE - * \li Action: Pastes material from the active clipboard. - * \li Syntax: paste [] - * \li Params: : pdf|png|jpeg|linkback + * \li Action: Pastes material (text or picture) from the active clipboard. + * \li Syntax: paste [|] + * \li Params: : emf|pdf|png|jpeg|linkback|wmf \n + : number of the selection in the internal clipboard stack to be pasted. * \endvar */ { LFUN_PASTE, "paste", Noop, Edit }, @@ -1112,7 +1187,7 @@ void LyXAction::init() * \var lyx::FuncCode lyx::LFUN_REPEAT * \li Action: Repeat the given command. * \li Syntax: repeat - * \li Origin: Andre, , 27 Oct 2003 + * \li Origin: Andre, 27 Oct 2003 * \endvar */ { LFUN_REPEAT, "repeat", NoBuffer, Edit }, @@ -1171,6 +1246,30 @@ void LyXAction::init() * \endvar */ { LFUN_FONT_UNDERLINE, "font-underline", Noop, Layout }, +/*! + * \var lyx::FuncCode lyx::LFUN_FONT_UULINE + * \li Action: Toggles double underline in the font (selection-wise). + * \li Syntax: font-underunderline + * \li Origin: sanda, 5 May 2009 + * \endvar + */ + { LFUN_FONT_UULINE, "font-underunderline", Noop, Layout }, +/*! + * \var lyx::FuncCode lyx::LFUN_FONT_UWAVE + * \li Action: Toggles wavy underline in the font (selection-wise). + * \li Syntax: font-underwave + * \li Origin: sanda, 5 May 2009 + * \endvar + */ + { LFUN_FONT_UWAVE, "font-underwave", Noop, Layout }, +/*! + * \var lyx::FuncCode lyx::LFUN_FONT_STRIKEOUT + * \li Action: Toggles strikeout (strike-through) in the font (selection-wise). + * \li Syntax: font-strikeout + * \li Origin: sanda, 3 May 2009 + * \endvar + */ + { LFUN_FONT_STRIKEOUT, "font-strikeout", Noop, Layout }, /*! * \var lyx::FuncCode lyx::LFUN_FONT_EMPH * \li Action: Toggles the emphasis font style (selection-wise). @@ -1247,9 +1346,9 @@ void LyXAction::init() * \li Syntax: textstyle-update * \li Params: : specifies font atributes, e.g. family, series, shape, size, emph, noun, underbar, number, color, language, - toggleall.\n - Use lyx -dbg action for exact syntax of text-style - dialog parameters. + toggleall.\n + Use lyx -dbg action for exact syntax of text-style + dialog parameters. * \li Origin: leeming, 12 Mar 2003 * \endvar */ @@ -1342,7 +1441,7 @@ void LyXAction::init() * \li Origin: rgh, 25 August 2007 * \endvar */ - { LFUN_LAYOUT_MODULES_CLEAR, "layout-modules-clear", Noop, Layout }, + { LFUN_LAYOUT_MODULES_CLEAR, "layout-modules-clear", NoInternal, Layout }, /*! * \var lyx::FuncCode lyx::LFUN_LAYOUT_MODULE_ADD * \li Action: Adds a module. @@ -1352,7 +1451,7 @@ void LyXAction::init() * \li Origin: rgh, 25 August 2007 * \endvar */ - { LFUN_LAYOUT_MODULE_ADD, "layout-module-add", Noop, Layout }, + { LFUN_LAYOUT_MODULE_ADD, "layout-module-add", NoInternal, Layout }, /*! * \var lyx::FuncCode lyx::LFUN_LAYOUT_RELOAD * \li Action: Reloads layout information. @@ -1364,7 +1463,7 @@ void LyXAction::init() * \li Origin: rgh, 3 September 2007 * \endvar */ - { LFUN_LAYOUT_RELOAD, "layout-reload", Noop, Layout }, + { LFUN_LAYOUT_RELOAD, "layout-reload", NoInternal, Layout }, /*! * \var lyx::FuncCode lyx::LFUN_TEXTCLASS_APPLY * \li Action: Sets the text class for the current buffer. @@ -1373,7 +1472,7 @@ void LyXAction::init() the filename, minus the ".layout" extension. * \endvar */ - { LFUN_TEXTCLASS_APPLY, "textclass-apply", Noop, Layout }, + { LFUN_TEXTCLASS_APPLY, "textclass-apply", NoInternal, Layout }, /*! * \var lyx::FuncCode lyx::LFUN_TEXTCLASS_LOAD * \li Action: Loads information for a textclass from disk. @@ -1382,7 +1481,7 @@ void LyXAction::init() the filename, minus the ".layout" extension. * \endvar */ - { LFUN_TEXTCLASS_LOAD, "textclass-load", Noop, Layout }, + { LFUN_TEXTCLASS_LOAD, "textclass-load", NoInternal, Layout }, /*! * \var lyx::FuncCode lyx::LFUN_MARK_OFF @@ -1407,7 +1506,7 @@ void LyXAction::init() * \endvar */ { LFUN_MARK_TOGGLE, "mark-toggle", ReadOnly, Edit }, - + /*! * \var lyx::FuncCode lyx::LFUN_MATH_DELIM * \li Action: Inserts math delimiters (e.g. parentheses, brackets) enclosing expression. @@ -1447,6 +1546,14 @@ void LyXAction::init() * \li Action: Inserts math objects and symbols. * \li Syntax: math-insert * \li Params: : Symbol or LaTeX code to be inserted. + * \li Notion: When is a _single_ math inset with more than one cell + (such as "x_y^z" or "\frac{x}{y}"), the content of cell(0) is + replaced by the current selection (only works if the selection + is in mathed). As an example, if "abc" is selected in mathed, + "math-insert \frac{x}{y}" replaces "abc" with "\frac{abc}{y}", + and "math-insert x_y^z" replaces "abc" with "abc_y^z". + If nothing is selected (or the selection is not in mathed), + math-insert works as expected. * \endvar */ { LFUN_MATH_INSERT, "math-insert", Noop, Math }, @@ -1481,7 +1588,7 @@ void LyXAction::init() * \var lyx::FuncCode lyx::LFUN_MATH_MACRO * \li Action: Inserts a math macro definition at the cursor position in the text. * \li Syntax: math-macro [] [def] - * \li Params: : The name of the macro, e.g. "mymacro". + * \li Params: : The name of the macro, e.g. "mymacro".\n : The number of parameters of the macro. Default is 0. "def": Has no effect anymore, just for compatibility with former LyX versions. * \li Origin: ale, 10 May 1997; sts, 21 Dec 2007 @@ -1506,9 +1613,9 @@ void LyXAction::init() * \li Params: : negative spaces: !|negthinspace|negmedspace|negthickspace \n positive spaces: ,|thinspace|:|medspace|;|thickspace|enskip|quad|qquad \n custom space: hspace \n - "," used by default. + "," used by default.\n Note that ! is equivalent to negthinspace, , = thinspace, - : = medspace, and ; = thickspace. + : = medspace, and ; = thickspace.\n : length for custom spaces (hspace) * \li Origin: Andre, 25 Jul 2001; sanda, 16 Jun 2008 * \endvar @@ -1520,18 +1627,29 @@ void LyXAction::init() * \li Syntax: math-matrix [] * \li Params: : Alignment is a word composed of the vertical alignment (b, c or t) (i.e. 1 char) and the horizontal alignments - (l, c or r) (i.e. chars). + (l, c or r) (i.e. chars). * \li Sample: math-matrix 3 3 bccc * \endvar */ { LFUN_MATH_MATRIX, "math-matrix", Noop, Math }, +/*! + * \var lyx::FuncCode lyx::LFUN_MATH_AMS_MATRIX + * \li Action: Inserts a matrix. + * \li Syntax: math-matrix [] + * \li Params: : Decoration determines the LaTeX name of the matrix + that should be created. + * \li Sample: math-ams-matrix 3 3 bmatrix + * \endvar + */ + { LFUN_MATH_AMS_MATRIX, "math-ams-matrix", Noop, Math }, /*! * \var lyx::FuncCode lyx::LFUN_MATH_MODE * \li Action: In text mode enters math mode (i.e. puts math insets on the current cursor position), in math mode enters text mode inside math expression. * \li Notion: If there is some selected text, it puts the text inside created math box. - * \li Syntax: math-mode [] - * \li Params: : eventual argument (LaTeX code) is passed to #LFUN_MATH_INSERT . + * \li Syntax: math-mode [on|] + * \li Params: : eventual argument (LaTeX code) is passed to #LFUN_MATH_INSERT .\n + "on": allow only entering of math mode from text mode. * \li Origin: Alejandro, 4 Jun 1996 * \endvar */ @@ -1587,7 +1705,7 @@ void LyXAction::init() * \li Notion: Provides an interface to the LaTeX math mode font size commands. * \li Syntax: math-size