From 2368acd8c0ff44df0b48ea9828be0a909f73b9cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 24 Jun 2005 10:14:33 +0000 Subject: [PATCH] fix {super|sub}script via menu (bug 1667) 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 | 5 +++++ lib/ui/classic.ui | 4 ++-- lib/ui/stdmenus.ui | 4 ++-- src/mathed/ChangeLog | 5 +++++ src/mathed/math_nestinset.C | 42 +++++++++++++++++++++++++++++-------- 5 files changed, 47 insertions(+), 13 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index a678f80c19..2a79d3cc19 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2005-06-24 Jürgen Spitzmüller + + * ui/stdmenus.ui: + * ui/classic.ui: use \text for {sub|super}script (fixes bug 1667) + 2005-06-20 Günter Milde * layouts/obsolete.inc: remove, since lyx2lyx does the job. diff --git a/lib/ui/classic.ui b/lib/ui/classic.ui index 4b7a0464ec..abc13964d4 100644 --- a/lib/ui/classic.ui +++ b/lib/ui/classic.ui @@ -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" diff --git a/lib/ui/stdmenus.ui b/lib/ui/stdmenus.ui index e9d5cf1d21..ad611fb855 100644 --- a/lib/ui/stdmenus.ui +++ b/lib/ui/stdmenus.ui @@ -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" diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 3b828c83ec..f071da44f2 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,8 @@ +2005-06-24 Jürgen Spitzmüller + + * 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 * math_fontinset.C (validate): require amsmath for \text diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index a22bed8089..ff6f89fdbd 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -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; -- 2.39.2