]> git.lyx.org Git - lyx.git/commitdiff
Allow to separate menu string from label string for arguments
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 9 Dec 2012 18:15:41 +0000 (19:15 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 9 Dec 2012 18:15:41 +0000 (19:15 +0100)
lib/doc/Customization.lyx
lib/layouts/beamer.layout
po/lyx_pot.py
src/Layout.cpp
src/Layout.h
src/frontends/qt4/Menus.cpp
src/insets/InsetLayout.cpp

index bf62213c46b70c1d9d76e9709c6f7201db978ac3..e034ea0aa10d4375c9602762744f521f5481bb8b 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.1 created this file. For more info see http://www.lyx.org/
-\lyxformat 449
+\lyxformat 452
 \begin_document
 \begin_header
 \textclass scrbook
@@ -10338,7 +10338,7 @@ Argument
 
 \begin_layout Itemize
 
-\change_inserted -712698321 1353691469
+\change_inserted -712698321 1355076779
 \begin_inset Flex Code
 status collapsed
 
@@ -10365,7 +10365,19 @@ status collapsed
 \end_inset
 
  The string that will appear both in the menu (to insert this argument)
- and on the argument inset button.
+ and on the argument inset button (unless you also specify a separate 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1355076779
+MenuString
+\end_layout
+
+\end_inset
+
+).
  For the menu, you can define an accelerator by appending the respective
  character to the string, divided by 
 \begin_inset Quotes eld
@@ -10406,6 +10418,85 @@ Short Title|S
 
 \begin_layout Itemize
 
+\change_inserted -712698321 1355076754
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1355076658
+MenuString
+\end_layout
+
+\end_inset
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1355076654
+[string]
+\end_layout
+
+\end_inset
+
+ A separate string for the menu.
+ You can define an accelerator by appending the respective character to
+ the string, divided by 
+\begin_inset Quotes eld
+\end_inset
+
+|
+\begin_inset Quotes erd
+\end_inset
+
+ (e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1355076654
+\begin_inset Quotes eld
+\end_inset
+
+Short Title|S
+\begin_inset Quotes erd
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+).
+ This specification is optional.
+ If it is not given the 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1355076736
+LabelString
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+ will be used instead for the menu.
+\end_layout
+
+\begin_layout Itemize
+
 \change_inserted -712698321 1353680665
 \begin_inset Flex Code
 status collapsed
index b1ffdaa8324702b7cd0dfff4d6b3eeb7e667ba01..d4ad53be75abf3587c35c5bd7a7bd168c6d54abb 100644 (file)
@@ -93,7 +93,8 @@ Style Itemize
     Tooltip       "A customized item string"
   EndArgument
   Argument item:2
-    LabelString   "Item Overlay Specifications"
+    MenuString    "Item Overlay Specifications"
+    LabelString   "On Slide"
     Tooltip       "Overlay specifications for this item"
     LeftDelim      <
     RightDelim     >
@@ -129,7 +130,8 @@ Style Enumerate
     Tooltip       "A customized item string"
   EndArgument
   Argument item:2
-    LabelString   "Item Overlay Specifications"
+    MenuString    "Item Overlay Specifications"
+    LabelString   "On Slide"
     Tooltip       "Overlay specifications for this item"
     LeftDelim      <
     RightDelim     >
@@ -163,7 +165,8 @@ Style Description
     Tooltip        "The longest label in this list (to determine the indendation width)"
   EndArgument
   Argument item:1
-    LabelString   "Item Overlay Specifications"
+    MenuString    "Item Overlay Specifications"
+    LabelString   "On Slide"
     Tooltip       "Overlay specifications for this item"
     LeftDelim      <
     RightDelim     >
@@ -194,7 +197,8 @@ Style Part
   LatexType        Command
   LatexName        part
   Argument 1
-    LabelString    "Mode Specification|S"
+    LabelString    "Mode"
+    MenuString     "Mode Specification|S"
     Tooltip        "Specify in which mode (article, presentation etc.) this header appears"
     LeftDelim      <
     RightDelim     >
@@ -243,7 +247,8 @@ Style Section
   LabelString      "Section \arabic{section}"
   RefPrefix        sec
   Argument 1
-    LabelString    "Mode Specification|S"
+    LabelString    "Mode"
+    MenuString     "Mode Specification|S"
     Tooltip        "Specify in which mode (article, presentation etc.) this header appears"
     LeftDelim      <
     RightDelim     >
@@ -272,7 +277,8 @@ Style Section*
   LabelType        No_Label
   ResetArgs        1
   Argument 1
-    LabelString    "Mode Specification|S"
+    LabelString    "Mode"
+    MenuString     "Mode Specification|S"
     Tooltip        "Specify in which mode (article, presentation etc.) this header appears"
     LeftDelim      <
     RightDelim     >
@@ -298,7 +304,8 @@ Style Subsection
   LabelString      "Subsection \arabic{section}.\arabic{subsection}"
   RefPrefix        sub
   Argument 1
-    LabelString    "Mode Specification|S"
+    LabelString    "Mode"
+    MenuString     "Mode Specification|S"
     Tooltip        "Specify in which mode (article, presentation etc.) this header appears"
     LeftDelim      <
     RightDelim     >
@@ -327,7 +334,8 @@ Style Subsection*
   LabelType        No_Label
   ResetArgs        1
   Argument 1
-    LabelString    "Mode Specification|S"
+    LabelString    "Mode"
+    MenuString     "Mode Specification|S"
     Tooltip        "Specify in which mode (article, presentation etc.) this header appears"
     LeftDelim      <
     RightDelim     >
@@ -353,7 +361,8 @@ Style Subsubsection
   LabelString      "Subsubsection \arabic{section}.\arabic{subsection}.\arabic{subsubsection}"
   RefPrefix        sub
   Argument 1
-    LabelString    "Mode Specification|S"
+    LabelString    "Mode"
+    MenuString     "Mode Specification|S"
     Tooltip        "Specify in which mode (article, presentation etc.) this header appears"
     LeftDelim      <
     RightDelim     >
@@ -382,7 +391,8 @@ Style Subsubsection*
   LabelType        No_Label
   ResetArgs        1
   Argument 1
-    LabelString    "Mode Specification|S"
+    LabelString    "Mode"
+    MenuString     "Mode Specification|S"
     Tooltip        "Specify in which mode (article, presentation etc.) this header appears"
     LeftDelim      <
     RightDelim     >
@@ -478,7 +488,8 @@ Style AgainFrame
   LatexType         Command
   LatexName         lyxframeend{}\againframe
   Argument 1
-    LabelString     "Overlay Specifications|S"
+    LabelString     "On Slide"
+    MenuString      "Overlay Specifications|S"
     Tooltip         "Overlay specifications for this frame"
     LeftDelim       <
     RightDelim      >
@@ -490,7 +501,8 @@ Style AgainFrame
     RightDelim      >]
   EndArgument
   Argument 3
-    LabelString     "Frame Options"
+    MenuString      "Frame Options"
+    LabelString     "Options"
     Tooltip         "Frame options (see beamer manual)"
   EndArgument
   Margin            First_Dynamic
@@ -559,7 +571,8 @@ Style FrameSubtitle
     Color          Blue
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -586,7 +599,8 @@ Style Column
   LabelSep         xx
   LabelString      "Start column (increase depth!), width:"
   Argument 1
-    LabelString    "Column Options"
+    MenuString     "Column Options"
+    LabelString    "Options"
     Tooltip        "Column options (see beamer manual)"
   EndArgument
   LeftMargin       "Start column (increase depth!), width:xx"
@@ -693,7 +707,8 @@ Style Overprint
     Color          latex
   EndFont
   Argument 1
-    LabelString    "Overprint Area Width"
+    MenuString     "Overprint Area Width"
+    LabelString    "Width"
     Tooltip        "The width of the overprint area (default: text width)"
   EndArgument
 End
@@ -723,7 +738,8 @@ Style OverlayArea
     Mandatory      1
   EndArgument
   Argument 2
-    LabelString    "Overlay Area Height"
+    MenuString     "Overlay Area Height"
+    LabelString    "Height"
     Tooltip        "The height of the overlay area"
     Mandatory      1
   EndArgument
@@ -749,7 +765,8 @@ Style Uncover
     Color          Latex
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -776,7 +793,8 @@ Style Only
     Color          Latex
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -807,7 +825,8 @@ Style Block
     Color          latex
   EndFont
   Argument 1
-    LabelString    "Action Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specification|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1059,7 +1078,8 @@ Style Quotation
   Align            Block
   AlignPossible    Block, Left, Right, Center
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1081,7 +1101,8 @@ Style Quote
   AlignPossible    Block, Left, Right, Center
   LabelType        No_Label
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1106,7 +1127,8 @@ Style Verse
   AlignPossible    Block, Left
   LabelType        No_Label
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1140,7 +1162,8 @@ Style Corollary
      Size          Large
    EndFont
   Argument 1
-    LabelString    "Action Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1279,7 +1302,8 @@ Style NoteItem
     Color          latex
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1300,7 +1324,8 @@ InsetLayout Flex:Emphasize
     Shape          italic
   EndFont
   Argument 1
-    LabelString    "Action Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1316,7 +1341,8 @@ InsetLayout Flex:Alert
     Color          red
   EndFont
   Argument 1
-    LabelString    "Action Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1332,7 +1358,8 @@ InsetLayout Flex:Structure
     Color          blue
   EndFont
   Argument 1
-    LabelString    "Action Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1348,7 +1375,8 @@ InsetLayout Flex:Only
     Color          red
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1364,7 +1392,8 @@ InsetLayout Flex:Uncover
     Color          red
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1380,7 +1409,8 @@ InsetLayout Flex:Visible
     Color          red
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1396,7 +1426,8 @@ InsetLayout Flex:Invisible
     Color          red
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1412,7 +1443,8 @@ InsetLayout Flex:Alternative
     Color          red
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
@@ -1434,7 +1466,8 @@ InsetLayout Flex:Beamer_Note
     Color          blue
   EndFont
   Argument 1
-    LabelString    "Overlay Specification|S"
+    LabelString    "Action"
+    MenuString     "Action Specifications|S"
     Tooltip        "Specify the overlay settings (see beamer manual)"
     LeftDelim      <
     RightDelim     >
index 8b397c89504f88fddbf4f8e63a97034d8010f52b..39241a358de1da4fb0b5457f982c58144ed624e1 100755 (executable)
@@ -83,6 +83,7 @@ def layouts_l10n(input_files, output, base, layouttranslations):
     Style = re.compile(r'^\s*Style\s+(.*)\s*$', re.IGNORECASE)
     # match LabelString, EndLabelString, LabelStringAppendix and maybe others but no comments
     LabelString = re.compile(r'^[^#]*LabelString\S*\s+(.*)\s*$', re.IGNORECASE)
+    MenuString = re.compile(r'^[^#]*MenuString\S*\s+(.*)\s*$', re.IGNORECASE)
     Tooltip = re.compile(r'^[^#]*Tooltip\S*\s+(.*)\s*$', re.IGNORECASE)
     GuiName = re.compile(r'^\s*GuiName\s+(.*)\s*$', re.IGNORECASE)
     ListName = re.compile(r'^\s*ListName\s+(.*)\s*$', re.IGNORECASE)
@@ -237,6 +238,12 @@ def layouts_l10n(input_files, output, base, layouttranslations):
                         writeString(out, src, base, lineno, string)
                 continue
             res = LabelString.search(line)
+            if res != None:
+                string = res.group(1)
+                if not layouttranslations:
+                    writeString(out, src, base, lineno, string)
+                continue
+            res = MenuString.search(line)
             if res != None:
                 string = res.group(1)
                 if not layouttranslations:
index 2ff77edafcb82ef36e2dea01e762f576441cc779..1c8aac8ad4a04be7358fcc691f0450b7d18b21bd 100644 (file)
@@ -900,6 +900,9 @@ void Layout::readArgument(Lexer & lex)
                } else if (tok == "labelstring") {
                        lex.next();
                        arg.labelstring = lex.getDocString();
+               } else if (tok == "menustring") {
+                       lex.next();
+                       arg.menustring = lex.getDocString();
                } else if (tok == "mandatory") {
                        lex.next();
                        arg.mandatory = lex.getBool();
index f8c1ed46f9f13e65ce1a868a6f28a01d728ab8a3..9b3ff388a64694c8cf1711f8096d6a5b0ab20740 100644 (file)
@@ -90,6 +90,7 @@ public:
        /// The arguments of this layout
        struct latexarg {
                docstring labelstring;
+               docstring menustring;
                bool mandatory;
                docstring ldelim;
                docstring rdelim;
index a0da7243c1a5d127f5dda783b29cbc1e6896e1b2..333e3b51c818cdf97103b11db61f066599a2b06e 100644 (file)
@@ -1570,7 +1570,8 @@ void MenuDefinition::expandArguments(BufferView const * bv, bool switcharg)
        Layout::LaTeXArgMap::const_iterator const laend = args.end();
        for (; lait != laend; ++lait) {
                Layout::latexarg arg = (*lait).second;
-               QString item = toqstr(translateIfPossible(arg.labelstring));
+               docstring str = arg.menustring.empty()? arg.labelstring : arg.menustring;
+               QString item = toqstr(translateIfPossible(str));
                if (switcharg)
                        add(MenuItem(MenuItem::Command, item,
                                     FuncRequest(LFUN_INSET_MODIFY,
index 15b3dee7db0da66553bcfd7f5abafcdac043988a..afbc4db50b44fb7aa7465128e9d00fe9e800d738 100644 (file)
@@ -528,6 +528,9 @@ void InsetLayout::readArgument(Lexer & lex)
                } else if (tok == "labelstring") {
                        lex.next();
                        arg.labelstring = lex.getDocString();
+               } else if (tok == "menustring") {
+                       lex.next();
+                       arg.menustring = lex.getDocString();
                } else if (tok == "mandatory") {
                        lex.next();
                        arg.mandatory = lex.getBool();