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
This commit is contained in:
Angus Leeming 2002-01-10 16:47:03 +00:00
parent 5e1253ee88
commit df3128954a
10 changed files with 41 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2002-01-10 Martin Vermeer <martin.vermeer@hut.fi>
* commandtags.h:
* LyXAction.C: two new LFUNS, LFUN_FRAK and LFUN_ITAL.
2002-01-10 Angus Leeming <a.leeming@ic.ac.uk> 2002-01-10 Angus Leeming <a.leeming@ic.ac.uk>
* lyxrc.[Ch]: change names and descriptions of popup font variables to * lyxrc.[Ch]: change names and descriptions of popup font variables to

View File

@ -210,6 +210,8 @@ void LyXAction::init()
{ LFUN_ROMAN, "font-roman", N_("Toggle roman font style"), { LFUN_ROMAN, "font-roman", N_("Toggle roman font style"),
Noop }, Noop },
{ LFUN_SANS, "font-sans", N_("Toggle sans 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_SIZE, "font-size", N_("Set font size"), Noop },
{ LFUN_FONT_STATE, "font-state", N_("Show font state"), { LFUN_FONT_STATE, "font-state", N_("Show font state"),
ReadOnly }, ReadOnly },

View File

@ -59,6 +59,8 @@ enum kb_action {
LFUN_BOLD, LFUN_BOLD,
LFUN_ROMAN, LFUN_ROMAN,
LFUN_NOUN, LFUN_NOUN,
LFUN_ITAL,
LFUN_FRAK,
LFUN_RIGHT, LFUN_RIGHT,
LFUN_LEFT, // 40 LFUN_LEFT, // 40
LFUN_UP, LFUN_UP,

View File

@ -1,3 +1,10 @@
2002-01-10 Martin Vermeer <martin.vermeer@hut.fi>
* FormMathsPanel.[Ch] (dispatchFunc): new method. Invokes
LyXFunc::dispatch.
* FormMathsStyle.C (apply): use LFUNs to apply, not insertSymbol.
2002-01-10 Angus Leeming <a.leeming@ic.ac.uk> 2002-01-10 Angus Leeming <a.leeming@ic.ac.uk>
* FormPreferences.C: * FormPreferences.C:

View File

@ -301,6 +301,10 @@ void FormMathsPanel::insertSymbol(string const & sym) const
lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATH, '\\' + sym); lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATH, '\\' + sym);
} }
void FormMathsPanel::dispatchFunc(string const & funcode) const
{
lv_->getLyXFunc()->dispatch(funcode);
}
void FormMathsPanel::mathDisplay() const void FormMathsPanel::mathDisplay() const
{ {

View File

@ -63,7 +63,8 @@ public:
void setActive(FormMathsSub *) const; void setActive(FormMathsSub *) const;
/// dispatch a symbol insert /// dispatch a symbol insert
void insertSymbol(string const & sym) const; void insertSymbol(string const & sym) const;
/// dispatch an LFUN:
void dispatchFunc(string const & funcode) const;
private: private:
/// Pointer to the actual instantiation of the ButtonController. /// Pointer to the actual instantiation of the ButtonController.
virtual xformsBC & bc(); virtual xformsBC & bc();

View File

@ -20,6 +20,7 @@
#include "form_maths_style.h" #include "form_maths_style.h"
extern char * latex_mathstyle[]; extern char * latex_mathstyle[];
extern char * latex_mathfontcmds[];
FormMathsStyle::FormMathsStyle(LyXView * lv, Dialogs * d, FormMathsStyle::FormMathsStyle(LyXView * lv, Dialogs * d,
FormMathsPanel const & p) FormMathsPanel const & p)
@ -66,8 +67,10 @@ void FormMathsStyle::build()
void FormMathsStyle::apply() void FormMathsStyle::apply()
{ {
if (style_ >= 0) if ( (style_ >= 0) && (style_ < 4) )
parent_.insertSymbol(latex_mathstyle[style_]); parent_.insertSymbol(latex_mathstyle[style_]);
else
parent_.dispatchFunc(latex_mathfontcmds[style_ - 4]);
} }
bool FormMathsStyle::input(FL_OBJECT *, long data) bool FormMathsStyle::input(FL_OBJECT *, long data)

View File

@ -1,3 +1,10 @@
2002-01-10 Martin Vermeer <martin.vermeer@hut.fi>
* 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 <dekelts@tau.ac.il> 2002-01-10 Dekel Tsur <dekelts@tau.ac.il>
* math_parser.C (parse_normal): Support for \begin{math} * math_parser.C (parse_normal): Support for \begin{math}

View File

@ -368,7 +368,6 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
hideInsetCursor(bv); hideInsetCursor(bv);
mathcursor->normalize(); mathcursor->normalize();
switch (action) { switch (action) {
// --- Cursor Movements --------------------------------------------- // --- Cursor Movements ---------------------------------------------
@ -517,6 +516,8 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
case LFUN_EMPH: handleFont(bv, LM_TC_CAL); break; case LFUN_EMPH: handleFont(bv, LM_TC_CAL); break;
case LFUN_ROMAN: handleFont(bv, LM_TC_RM); break; case LFUN_ROMAN: handleFont(bv, LM_TC_RM); break;
case LFUN_CODE: handleFont(bv, LM_TC_TT); 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_NOUN: handleFont(bv, LM_TC_BB); break;
case LFUN_DEFAULT: handleFont(bv, LM_TC_VAR); break; case LFUN_DEFAULT: handleFont(bv, LM_TC_VAR); break;
case LFUN_FREE: handleFont(bv, LM_TC_TEXTRM); break; case LFUN_FREE: handleFont(bv, LM_TC_TEXTRM); break;

View File

@ -777,9 +777,12 @@ char const * latex_mathspace[] = {
char const * latex_mathstyle[] = { char const * latex_mathstyle[] = {
"textstyle", "displaystyle", "scriptstyle", "scriptscriptstyle", "textstyle", "displaystyle", "scriptstyle", "scriptscriptstyle"
"mathbf", "mathcal","mathrm","mathtt", "mathsf", "mathit", };
"mathbb","mathfrak", "textrm", "mathnormal"
char const * latex_mathfontcmds[] = {
"font-bold", "font-emph", "font-roman", "font-code", "font-sans",
"font-ital", "font-noun", "font-frak", "font-free", "font-default"
}; };