]> git.lyx.org Git - features.git/commitdiff
fix {super|sub}script via menu (bug 1667)
authorJürgen Spitzmüller <spitz@lyx.org>
Fri, 24 Jun 2005 10:14:33 +0000 (10:14 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Fri, 24 Jun 2005 10:14:33 +0000 (10:14 +0000)
fix font attribute handling in mathed text mode

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10100 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/ui/classic.ui
lib/ui/stdmenus.ui
src/mathed/ChangeLog
src/mathed/math_nestinset.C

index a678f80c1933fad549b3c980a0312185c827153e..2a79d3cc1976ae6a495030d77dbe1d76d8528f95 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-24  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * ui/stdmenus.ui:
+       * ui/classic.ui: use \text for {sub|super}script (fixes bug 1667)
+
 2005-06-20  Günter Milde  <g.milde@web.de>
 
        * layouts/obsolete.inc: remove, since lyx2lyx does the job.
index 4b7a0464ec5dd87c6ed6f42dda3e1b5f0ef81816..abc13964d42774b9fd01482823d6574f7f110df7 100644 (file)
@@ -237,8 +237,8 @@ Menuset
        End
 
        Menu "insert_special"
-               Item "Superscript|S" "command-sequence math-mode on; math-superscript ; font-free-apply; "
-               Item "Subscript|u" "command-sequence math-mode on; math-subscript ; font-free-apply; "
+               Item "Superscript|S" "command-sequence math-mode on; math-superscript; math-insert \text;"
+               Item "Subscript|u" "command-sequence math-mode on; math-subscript; math-insert \text;"
                Item "Horizontal Fill|H" "hfill-insert"
                Item "Hyphenation Point|P" "hyphenation-point-insert"
                Item "Ligature Break|k" "ligature-break-insert"
index e9d5cf1d21950cf57048abd164af19865a1dd395..ad611fb855b34616e2076592b2b88ffe3d8f7eaa 100644 (file)
@@ -270,8 +270,8 @@ Menuset
        End
 
        Menu "insert_formatting"
-               Item "Superscript|S" "command-sequence math-mode on; math-superscript ; font-free-apply; "
-               Item "Subscript|u" "command-sequence math-mode on; math-subscript ; font-free-apply; "
+               Item "Superscript|S" "command-sequence math-mode on; math-superscript; math-insert \text;"
+               Item "Subscript|u" "command-sequence math-mode on; math-subscript; math-insert \text;"
                Separator
                Item "Protected Space|r" "space-insert protected"
                Item "Inter-word Space|w" "space-insert normal"
index 3b828c83ec39b23ad15f9cddf9c8cdf8ae886428..f071da44f20618fefadcbe359c1c40ef9278f1ed 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-24  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * math_nestinset.C (doDispatch): use text font attributes in text mode.
+       * math_nestinset.C (getStatus): allow text font attributes in math mode.
+
 2005-06-24  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * math_fontinset.C (validate): require amsmath for \text
index a22bed8089d9aa012c74133db2d6c9eff73c89fc..ff6f89fdbdb1ee764ed9914eed3db36a7e868310 100644 (file)
@@ -689,28 +689,47 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_BOLD:
-               handleFont(cur, cmd.argument, "mathbf");
+               if (currentMode() == TEXT_MODE)
+                       handleFont(cur, cmd.argument, "textbf");
+               else
+                       handleFont(cur, cmd.argument, "mathbf");
                break;
        case LFUN_SANS:
-               handleFont(cur, cmd.argument, "mathsf");
+               if (currentMode() == TEXT_MODE)
+                       handleFont(cur, cmd.argument, "textsf");
+               else
+                       handleFont(cur, cmd.argument, "mathsf");
                break;
        case LFUN_EMPH:
-               handleFont(cur, cmd.argument, "mathcal");
+               if (currentMode() == TEXT_MODE)
+                       handleFont(cur, cmd.argument, "emph");
+               else
+                       handleFont(cur, cmd.argument, "mathcal");
                break;
        case LFUN_ROMAN:
-               handleFont(cur, cmd.argument, "mathrm");
+               if (currentMode() == TEXT_MODE)
+                       handleFont(cur, cmd.argument, "textrm");
+               else
+                       handleFont(cur, cmd.argument, "mathrm");
                break;
        case LFUN_CODE:
-               handleFont(cur, cmd.argument, "texttt");
+                       handleFont(cur, cmd.argument, "texttt");
                break;
        case LFUN_FRAK:
                handleFont(cur, cmd.argument, "mathfrak");
                break;
        case LFUN_ITAL:
-               handleFont(cur, cmd.argument, "mathit");
+               if (currentMode() == TEXT_MODE)
+                       handleFont(cur, cmd.argument, "textit");
+               else
+                       handleFont(cur, cmd.argument, "mathit");
                break;
        case LFUN_NOUN:
-               handleFont(cur, cmd.argument, "mathbb");
+               if (currentMode() == TEXT_MODE)
+                       // FIXME: should be "noun"
+                       handleFont(cur, cmd.argument, "textsc");
+               else
+                       handleFont(cur, cmd.argument, "mathbb");
                break;
        //case LFUN_FREEFONT_APPLY:
                handleFont(cur, cmd.argument, "textrm");
@@ -925,6 +944,11 @@ bool MathNestInset::getStatus(LCursor & /*cur*/, FuncRequest const & cmd,
        case LFUN_MATH_EXTERN:
                flag.enabled(true);
                break;
+
+       case LFUN_FRAK:
+               flag.enabled(currentMode() != TEXT_MODE);
+               break;
+
        case LFUN_INSERT_MATH: {
                bool const textarg =
                        arg == "\\textbf"   || arg == "\\textsf" ||
@@ -933,10 +957,10 @@ bool MathNestInset::getStatus(LCursor & /*cur*/, FuncRequest const & cmd,
                        arg == "\\textsl"   || arg == "\\textup" ||
                        arg == "\\texttt"   || arg == "\\textbb" ||
                        arg == "\\textnormal";
-               flag.enabled((currentMode() == MATH_MODE && !textarg)
-                       ||   (currentMode() == TEXT_MODE && textarg));
+               flag.enabled(currentMode() != TEXT_MODE || textarg);
                break;
        }
+
        case LFUN_INSERT_MATRIX:
                flag.enabled(currentMode() == MATH_MODE);
                break;