]> git.lyx.org Git - features.git/commitdiff
Add MenuString to InsetLayout
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 18 Apr 2019 08:27:19 +0000 (10:27 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 18 Apr 2019 08:27:19 +0000 (10:27 +0200)
Fixes: #8818
lib/doc/Customization.lyx
lib/doc/de/Customization.lyx
lib/scripts/layout2layout.py
src/TextClass.cpp
src/frontends/qt4/Menus.cpp
src/insets/InsetLayout.cpp
src/insets/InsetLayout.h

index c953b4266226b72f6c9254593829eaefaf157b8d..568c31bf1681126056964ad12976cdbd12d307ab 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 571
+\lyxformat 573
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -44,7 +44,7 @@ logicalmkup
 \maintain_unincluded_children false
 \language english
 \language_package default
-\inputencoding auto
+\inputencoding auto-legacy
 \fontencoding auto
 \font_roman "lmodern" "default"
 \font_sans "lmss" "default"
@@ -20256,6 +20256,80 @@ LyxType
 \end_inset
 
 .
+\change_inserted -712698321 1555575738
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -712698321 1555575844
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1555575740
+MenuString
+\end_layout
+
+\end_inset
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1555575740
+[string]
+\end_layout
+
+\end_inset
+
+ A dedicated 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 space \space{}
+\end_inset
+
+
+\begin_inset Quotes eld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1555575781
+My Inset|M
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes erd
+\end_inset
+
+).
+ This specification is optional.
+ If it is not given the inset name as specified in the type declaration
+ will be used instead for the menu.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Description
index f32aabb9ad573342a96f1dbe0db9d3807e6f7e58..372acb55af22ae952817b2bcc6dd093ce8a8f9e6 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 571
+\lyxformat 573
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -52,7 +52,7 @@ logicalmkup
 \maintain_unincluded_children false
 \language ngerman
 \language_package default
-\inputencoding auto
+\inputencoding auto-legacy
 \fontencoding auto
 \font_roman "lmodern" "FreeSerif"
 \font_sans "lmss" "FreeSans"
@@ -18471,6 +18471,66 @@ LyxType
 \begin_inset Flex Code
 status collapsed
 
+\begin_layout Plain Layout
+MenuString
+\end_layout
+
+\end_inset
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+[string]
+\end_layout
+
+\end_inset
+
+ Eine spezifische Zeichenkette für das Menü.
+ Sie können ein Tastenkürzel definieren, indem Sie das entsprechende Zeichen
+ an die Zeichenkette mit 
+\begin_inset Quotes gld
+\end_inset
+
+|
+\begin_inset Quotes grd
+\end_inset
+
+ abgetrennt anhängen (z.
+\begin_inset space \thinspace{}
+\end_inset
+
+B.
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Meine Einfügung|M
+\end_layout
+
+\end_inset
+
+).
+ Diese Spezifikation ist optional.
+ Wenn Sie fehlt, wird der Name der Einfügung (aus der 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Typ
+\end_layout
+
+\end_inset
+
+-Spezifikation) für das Menü verwendet.
+\end_layout
+
+\begin_layout Description
+\begin_inset Flex Code
+status collapsed
+
 \begin_layout Plain Layout
 MultiPar
 \end_layout
index 331a51f1be3a0f973545c9c3dd663d63f997c793..b89969537ca633de307226f5b691855864f0c59f 100644 (file)
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 72
+currentFormat = 73
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -242,6 +242,9 @@ currentFormat = 72
 # Incremented to format 72, 26 March 2019 by spitz
 # New TextClass tag TableStyle
 
+# Incremented to format 73, 18 April 2019 by spitz
+# New InsetLayout tag MenuString
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -491,7 +494,7 @@ def convert(lines, end_format):
                 i += 1
             continue
 
-        if format >= 65 and format <= 71:
+        if format >= 65 and format <= 72:
             # nothing to do.
             i += 1
             continue
index 566ac7a8e36ebee667a38836567d355fa2a9d701..e381060e0cdc3f0e4022bd222958399981c3ea89 100644 (file)
@@ -62,7 +62,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 72; // spitz: TableStyle
+int const LAYOUT_FORMAT = 73; // spitz: MenuString
 
 
 // Layout format for the current lyx file format. Controls which format is
index 6690588ba4250946fc24acce39e14d991330d340..91ab3f271e5a7b2a3c17daae75672fc82587d893 100644 (file)
@@ -1230,13 +1230,16 @@ void MenuDefinition::expandFlexInsert(
                if (cit->second.lyxtype() == type) {
                        if (!cit->second.obsoleted_by().empty())
                                continue;
-                       docstring label = cit->first;
+                       docstring name = cit->first;
                        // we remove the "Flex:" prefix, if it is present
-                       if (prefixIs(label, from_ascii("Flex:")))
-                               label = label.substr(5);
+                       if (prefixIs(name, from_ascii("Flex:")))
+                               name = name.substr(5);
+                       docstring const label = (cit->second.menustring().empty()) ?
+                                               name
+                                             : cit->second.menustring();
                        addWithStatusCheck(MenuItem(MenuItem::Command,
                                toqstr(translateIfPossible(label)),
-                               FuncRequest(LFUN_FLEX_INSERT, Lexer::quoteString(label))));
+                               FuncRequest(LFUN_FLEX_INSERT, Lexer::quoteString(name))));
                }
        }
        // FIXME This is a little clunky.
index b62affd3d911c27aa0c190e26b4b09c612aa712a..6094135024ca011cd46045c0b1e168bad810482e 100644 (file)
@@ -120,6 +120,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                IL_LYXTYPE,
                IL_OBSOLETEDBY,
                IL_KEEPEMPTY,
+               IL_MENUSTRING,
                IL_MULTIPAR,
                IL_NEEDCPROTECT,
                IL_NEEDMBOXPROTECT,
@@ -178,6 +179,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                { "latextype", IL_LATEXTYPE },
                { "leftdelim", IL_LEFTDELIM },
                { "lyxtype", IL_LYXTYPE },
+               { "menustring", IL_MENUSTRING },
                { "multipar", IL_MULTIPAR },
                { "needcprotect", IL_NEEDCPROTECT },
                { "needmboxprotect", IL_NEEDMBOXPROTECT },
@@ -251,6 +253,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
                case IL_LABELSTRING:
                        lex >> labelstring_;
                        break;
+               case IL_MENUSTRING:
+                       lex >> menustring_;
+                       break;
                case IL_DECORATION:
                        lex >> tmp;
                        decoration_ = translateDecoration(tmp);
index 0eb27085fbdbd1e3b3a0835645ff706bccbcd97d..dc46946897e4f9f9c9981816f9b50f9e914d59bc 100644 (file)
@@ -66,6 +66,8 @@ public:
        ///
        docstring labelstring() const { return labelstring_; }
        ///
+       docstring menustring() const { return menustring_; }
+       ///
        bool contentaslabel() const { return contentaslabel_; }
        ///
        InsetDecoration decoration() const { return decoration_; }
@@ -212,6 +214,8 @@ private:
        ///
        docstring labelstring_;
        ///
+       docstring menustring_;
+       ///
        bool contentaslabel_;
        ///
        InsetDecoration decoration_;