From df3128954afc1981d742dd0a0442bed7f00d29f5 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 10 Jan 2002 16:47:03 +0000 Subject: [PATCH] Martin's latest math dialog patch using LFUNs. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3331 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/LyXAction.C | 2 ++ src/commandtags.h | 2 ++ src/frontends/xforms/ChangeLog | 7 +++++++ src/frontends/xforms/FormMathsPanel.C | 4 ++++ src/frontends/xforms/FormMathsPanel.h | 3 ++- src/frontends/xforms/FormMathsStyle.C | 5 ++++- src/mathed/ChangeLog | 7 +++++++ src/mathed/formulabase.C | 3 ++- src/mathed/math_support.C | 9 ++++++--- 10 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b9aaf44572..54c59f98f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-01-10 Martin Vermeer + + * commandtags.h: + * LyXAction.C: two new LFUNS, LFUN_FRAK and LFUN_ITAL. + 2002-01-10 Angus Leeming * lyxrc.[Ch]: change names and descriptions of popup font variables to diff --git a/src/LyXAction.C b/src/LyXAction.C index dd15b2ee5e..26b5459413 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -210,6 +210,8 @@ void LyXAction::init() { LFUN_ROMAN, "font-roman", N_("Toggle roman font style"), Noop }, { LFUN_SANS, "font-sans", N_("Toggle sans font style"), Noop }, + { LFUN_FRAK, "font-frak", N_("Toggle fraktur font style"), Noop }, + { LFUN_ITAL, "font-ital", N_("Toggle italic font style"), Noop }, { LFUN_FONT_SIZE, "font-size", N_("Set font size"), Noop }, { LFUN_FONT_STATE, "font-state", N_("Show font state"), ReadOnly }, diff --git a/src/commandtags.h b/src/commandtags.h index 9a68f354bb..62ffb4b834 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -59,6 +59,8 @@ enum kb_action { LFUN_BOLD, LFUN_ROMAN, LFUN_NOUN, + LFUN_ITAL, + LFUN_FRAK, LFUN_RIGHT, LFUN_LEFT, // 40 LFUN_UP, diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 45d41f1315..81c8626a81 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,10 @@ +2002-01-10 Martin Vermeer + + * FormMathsPanel.[Ch] (dispatchFunc): new method. Invokes + LyXFunc::dispatch. + + * FormMathsStyle.C (apply): use LFUNs to apply, not insertSymbol. + 2002-01-10 Angus Leeming * FormPreferences.C: diff --git a/src/frontends/xforms/FormMathsPanel.C b/src/frontends/xforms/FormMathsPanel.C index 149b235529..cc44f170b6 100644 --- a/src/frontends/xforms/FormMathsPanel.C +++ b/src/frontends/xforms/FormMathsPanel.C @@ -301,6 +301,10 @@ void FormMathsPanel::insertSymbol(string const & sym) const lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATH, '\\' + sym); } +void FormMathsPanel::dispatchFunc(string const & funcode) const +{ + lv_->getLyXFunc()->dispatch(funcode); +} void FormMathsPanel::mathDisplay() const { diff --git a/src/frontends/xforms/FormMathsPanel.h b/src/frontends/xforms/FormMathsPanel.h index 77245cdbc4..a6c0d96de0 100644 --- a/src/frontends/xforms/FormMathsPanel.h +++ b/src/frontends/xforms/FormMathsPanel.h @@ -63,7 +63,8 @@ public: void setActive(FormMathsSub *) const; /// dispatch a symbol insert void insertSymbol(string const & sym) const; - + /// dispatch an LFUN: + void dispatchFunc(string const & funcode) const; private: /// Pointer to the actual instantiation of the ButtonController. virtual xformsBC & bc(); diff --git a/src/frontends/xforms/FormMathsStyle.C b/src/frontends/xforms/FormMathsStyle.C index 37c73ece85..50ed4959ea 100644 --- a/src/frontends/xforms/FormMathsStyle.C +++ b/src/frontends/xforms/FormMathsStyle.C @@ -20,6 +20,7 @@ #include "form_maths_style.h" extern char * latex_mathstyle[]; +extern char * latex_mathfontcmds[]; FormMathsStyle::FormMathsStyle(LyXView * lv, Dialogs * d, FormMathsPanel const & p) @@ -66,8 +67,10 @@ void FormMathsStyle::build() void FormMathsStyle::apply() { - if (style_ >= 0) + if ( (style_ >= 0) && (style_ < 4) ) parent_.insertSymbol(latex_mathstyle[style_]); + else + parent_.dispatchFunc(latex_mathfontcmds[style_ - 4]); } bool FormMathsStyle::input(FL_OBJECT *, long data) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 495f1af737..bd7ca57973 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,10 @@ +2002-01-10 Martin Vermeer + + * formulabase.C (localDispatch): handle LFUN_FRAK and LFUN_ITAL. + + * math_support.C: separate string arrays for math style and for + font commands. + 2002-01-10 Dekel Tsur * math_parser.C (parse_normal): Support for \begin{math} diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 3eb3d1ecea..94b3a8569a 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -368,7 +368,6 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, hideInsetCursor(bv); mathcursor->normalize(); - switch (action) { // --- Cursor Movements --------------------------------------------- @@ -517,6 +516,8 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, case LFUN_EMPH: handleFont(bv, LM_TC_CAL); break; case LFUN_ROMAN: handleFont(bv, LM_TC_RM); break; case LFUN_CODE: handleFont(bv, LM_TC_TT); break; + case LFUN_FRAK: handleFont(bv, LM_TC_EUFRAK); break; + case LFUN_ITAL: handleFont(bv, LM_TC_IT); break; case LFUN_NOUN: handleFont(bv, LM_TC_BB); break; case LFUN_DEFAULT: handleFont(bv, LM_TC_VAR); break; case LFUN_FREE: handleFont(bv, LM_TC_TEXTRM); break; diff --git a/src/mathed/math_support.C b/src/mathed/math_support.C index 14c37c95c5..5ef9bc8bde 100644 --- a/src/mathed/math_support.C +++ b/src/mathed/math_support.C @@ -777,9 +777,12 @@ char const * latex_mathspace[] = { char const * latex_mathstyle[] = { - "textstyle", "displaystyle", "scriptstyle", "scriptscriptstyle", - "mathbf", "mathcal","mathrm","mathtt", "mathsf", "mathit", - "mathbb","mathfrak", "textrm", "mathnormal" + "textstyle", "displaystyle", "scriptstyle", "scriptscriptstyle" +}; + +char const * latex_mathfontcmds[] = { + "font-bold", "font-emph", "font-roman", "font-code", "font-sans", + "font-ital", "font-noun", "font-frak", "font-free", "font-default" }; -- 2.39.2