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
This commit is contained in:
Jürgen Spitzmüller 2005-06-24 10:14:33 +00:00
parent 99ac9d8dda
commit 2368acd8c0
5 changed files with 47 additions and 13 deletions

View 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.

View 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"

View 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"

View 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

View 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;