commit d199b930efc66e07d8b3307d9560223ecbabcdaa
Author: Koji Yokota <[email protected]>
Date:   Sat Jul 19 14:52:18 2025 +0900

    Fix math text toolbar menu (thanks to Jurgen)
---
 lib/Makefile.am                                    |   2 +-
 lib/doc/Math.lyx                                   |   2 +-
 lib/doc/UserGuide.lyx                              |   2 +-
 lib/doc/de/Math.lyx                                |   2 +-
 lib/doc/de/UserGuide.lyx                           |   2 +-
 .../{dynamic-math-texts.svgz => math-texts.svgz}   | Bin
 lib/ui/stdtoolbars.inc                             |  13 ++++++++++-
 src/frontends/qt/GuiToolbar.cpp                    |  24 ---------------------
 src/frontends/qt/GuiToolbar.h                      |  20 -----------------
 9 files changed, 17 insertions(+), 50 deletions(-)

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5adbf3428c..6e9450b943 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -977,7 +977,7 @@ dist_imagesmath_DATA = \
        images/math/downdownarrows.svgz \
        images/math/downharpoonleft.svgz \
        images/math/downharpoonright.svgz \
-       images/math/dynamic-math-texts.svgz \
+       images/math/math-texts.svgz \
        images/math/earth.svgz \
        images/math/eighthnote.svgz \
        images/math/ell.svgz \
diff --git a/lib/doc/Math.lyx b/lib/doc/Math.lyx
index 0494474e95..1e19c30191 100644
--- a/lib/doc/Math.lyx
+++ b/lib/doc/Math.lyx
@@ -33284,7 +33284,7 @@ be
 
 \begin_inset Info
 type  "icon"
-arg   "math-insert \\dynamic-math-texts"
+arg   "math-insert \\math-texts"
 \end_inset
 
 
diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx
index fd4ffe3820..494147eb14 100644
--- a/lib/doc/UserGuide.lyx
+++ b/lib/doc/UserGuide.lyx
@@ -30991,7 +30991,7 @@ Panel
  button 
 \begin_inset Info
 type  "icon"
-arg   "math-insert \\dynamic-math-texts"
+arg   "math-insert \\math-texts"
 \end_inset
 
 .
diff --git a/lib/doc/de/Math.lyx b/lib/doc/de/Math.lyx
index be4ee417d8..f96835c2df 100644
--- a/lib/doc/de/Math.lyx
+++ b/lib/doc/de/Math.lyx
@@ -33071,7 +33071,7 @@ intertext
  Sie können aber auch auf den Mathe-Werkzeugleistenknopf 
 \begin_inset Info
 type  "icon"
-arg   "math-insert \\dynamic-math-texts"
+arg   "math-insert \\math-texts"
 \end_inset
 
  drücken und dann 
diff --git a/lib/doc/de/UserGuide.lyx b/lib/doc/de/UserGuide.lyx
index ace854994c..c97f477e6a 100644
--- a/lib/doc/de/UserGuide.lyx
+++ b/lib/doc/de/UserGuide.lyx
@@ -30027,7 +30027,7 @@ Die verschiedenen Schriftstile sind hilfreich,
  den Sie über die Einträge des Knopfs 
 \begin_inset Info
 type  "icon"
-arg   "math-insert \\dynamic-math-texts"
+arg   "math-insert \\math-texts"
 \end_inset
 
  der 
diff --git a/lib/images/math/dynamic-math-texts.svgz 
b/lib/images/math/math-texts.svgz
similarity index 100%
rename from lib/images/math/dynamic-math-texts.svgz
rename to lib/images/math/math-texts.svgz
diff --git a/lib/ui/stdtoolbars.inc b/lib/ui/stdtoolbars.inc
index ecee7fcbd5..dfc8b82a17 100644
--- a/lib/ui/stdtoolbars.inc
+++ b/lib/ui/stdtoolbars.inc
@@ -221,7 +221,7 @@ ToolbarSet
                PopupMenu "frac-square" "Fractions"
                PopupMenu "functions" "Functions"
                PopupMenu "font" "Fonts"
-               DynamicMenu "dynamic-math-texts" "Text"
+               PopupMenu "math-texts" "Text"
                IconPalette "latex_deco" "Frame decorations"
                IconPalette "latex_varsz" "Big operators"
                IconPalette "latex_misc" "Miscellaneous"
@@ -457,6 +457,17 @@ ToolbarSet
                Item "Formal Script     \\mathscr" "math-insert \mathscr"
        End
 
+       Toolbar "math-texts" "Text"
+               Item "LR Text   \mbox" "math-insert \mbox"
+               Item "Framed Text       \\fbox" "math-insert \fbox"
+               Item "Framed Text (Adjustable)  \\framebox" "math-insert 
\framebox"
+               Item "AMS Text  \\text" "math-insert \text"
+               Item "Roman Text        \\textrm" "math-insert \textrm"
+               Item "Normal Font Text  \\textnormal" "math-insert \textnormal"
+               Item "Intertext \\intertext" "math-insert \intertext"
+               Item "Short Intertext   \\shortintertext" "math-insert 
\shortintertext"
+       End
+
        Toolbar "latex_dots" "Dots"
                Item "ldots" "math-insert \ldots"
                Item "cdots" "math-insert \cdots"
diff --git a/src/frontends/qt/GuiToolbar.cpp b/src/frontends/qt/GuiToolbar.cpp
index f726dd7a5b..fddd49f48e 100644
--- a/src/frontends/qt/GuiToolbar.cpp
+++ b/src/frontends/qt/GuiToolbar.cpp
@@ -372,7 +372,6 @@ bool DynamicMenuButton::isMenuType(string const & s)
 {
        return s == "dynamic-custom-insets"
                || s == "dynamic-char-styles"
-               || s == "dynamic-math-texts"
                || s == "textstyle-apply"
                || s == "paste";
 }
@@ -423,8 +422,6 @@ void DynamicMenuButton::updateTriggered()
                setEnabled(!bv->buffer().isReadonly()
                           && !m->isEmpty()
                           && inset->insetAllowed(FLEX_CODE));
-       } else if (menutype == "dynamic-math-texts") {
-               setEnabled(loadMathTexts());
        } else if (menutype == "textstyle-apply") {
                m->clear();
                setPopupMode(QToolButton::MenuButtonPopup);
@@ -530,27 +527,6 @@ void DynamicMenuButton::loadFlexInsets()
 }
 
 
-bool DynamicMenuButton::loadMathTexts()
-{
-       QMenu * m = menu();
-       m->clear();
-       bool isEnabled = false;
-
-       for (int i=0; i<mathTextMenuSize_; i++) {
-               FuncRequest func(LFUN_MATH_INSERT, "\\" + mathTextMenu[i][0],
-                                FuncRequest::TOOLBAR);
-               QString menuText = toqstr(from_utf8(mathTextMenu[i][1] + "\t\\" 
+
-                                                   mathTextMenu[i][0]));
-               QString tooltip = toqstr(from_utf8(mathTextMenu[i][2]));
-               Action * act =
-                       new Action(func, getIcon(func, false), menuText, 
tooltip, this);
-               m->addAction(act);
-               isEnabled |= lyx::getStatus(func).enabled();
-       }
-       return isEnabled;
-}
-
-
 void GuiToolbar::add(ToolbarItem const & item)
 {
        switch (item.type) {
diff --git a/src/frontends/qt/GuiToolbar.h b/src/frontends/qt/GuiToolbar.h
index a2b6d9ca07..6ec61acb48 100644
--- a/src/frontends/qt/GuiToolbar.h
+++ b/src/frontends/qt/GuiToolbar.h
@@ -101,8 +101,6 @@ protected:
        void initialize() override;
        ///
        void loadFlexInsets();
-       ///
-       bool loadMathTexts();
        /// pimpl so we don't have to include big files
        class Private;
        Private * d;
@@ -115,24 +113,6 @@ private:
        static QIcon icon_textstyle_apply_;
        static QIcon icon_undo_;
        static QIcon icon_paste_;
-
-       /// Size of the menu items of math texts
-       // Make this number sync with the row number of mathTextMenu
-       int const mathTextMenuSize_ = 8;
-       /// Dynamic menu items of math texts
-       // As of June 2025, only applicable to "Text" toolbar menu
-       std::string mathTextMenu[8][3] =
-       {
-               {"mbox",           "LR Text",          "Text in current font 
with constant sizes"},
-               {"fbox",           "Framed Text",      "Framed text"},
-               {"framebox",       "Framed Text with Sizes", "Framed text with 
variable frame sizes"},
-               {"text",           "AMS Text",         "Text in current font 
with variable sizes"},
-               {"textrm",         "Roman Text",       "Text in roman font"},
-               {"textnormal",     "Normal Font Text", "Text using 
\\normalfont"},
-               {"intertext",      "Intertext",        "Text between 
equations"},
-               {"shortintertext", "Short Intertext",  "Text between equations 
of short height"}
-       };
-
 };
 
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to