mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
visual support for \displaystyle
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3280 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a3f60ae91e
commit
f4892a2d33
@ -1,3 +1,11 @@
|
|||||||
|
|
||||||
|
2002-01-03 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* formulabase.[Ch]: implement simple search
|
||||||
|
|
||||||
|
* math_sizeinset.[Ch]: support for \displaystyle etc
|
||||||
|
|
||||||
|
|
||||||
2001-12-18 Dekel Tsur <dekelts@tau.ac.il>
|
2001-12-18 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
* math_macrotable.C (builtinMacros): Adjust kern values.
|
* math_macrotable.C (builtinMacros): Adjust kern values.
|
||||||
|
@ -280,8 +280,8 @@ void InsetFormulaBase::insetButtonPress(BufferView * bv,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//lyxerr << "insetButtonPress: " << x + xo_ << " " << y + yo_
|
lyxerr << "insetButtonPress: " << x + xo_ << " " << y + yo_
|
||||||
// << " but: " << button << "\n";
|
<< " but: " << button << "\n";
|
||||||
switch (button) {
|
switch (button) {
|
||||||
default:
|
default:
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -5,13 +5,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "math_boxinset.h"
|
#include "math_boxinset.h"
|
||||||
#include "support/LOstream.h"
|
#include "math_support.h"
|
||||||
#include "debug.h"
|
|
||||||
#include "Painter.h"
|
|
||||||
#include "math_cursor.h"
|
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "math_streamstr.h"
|
#include "math_streamstr.h"
|
||||||
|
|
||||||
|
|
||||||
MathBoxInset::MathBoxInset(string const & name)
|
MathBoxInset::MathBoxInset(string const & name)
|
||||||
: MathGridInset(1, 1), name_(name)
|
: MathGridInset(1, 1), name_(name)
|
||||||
{}
|
{}
|
||||||
@ -46,8 +44,5 @@ void MathBoxInset::rebreak()
|
|||||||
void MathBoxInset::draw(Painter & pain, int x, int y) const
|
void MathBoxInset::draw(Painter & pain, int x, int y) const
|
||||||
{
|
{
|
||||||
MathGridInset::draw(pain, x, y);
|
MathGridInset::draw(pain, x, y);
|
||||||
if (mathcursor && mathcursor->isInside(this)) {
|
mathed_draw_framebox(pain, x, y, this);
|
||||||
pain.rectangle(x - 1, y - ascent() - 1, width(), height(),
|
|
||||||
LColor::mathframe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1275,6 +1275,7 @@ bool MathCursor::interpret(string const & s)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MathCursor::script(bool up)
|
bool MathCursor::script(bool up)
|
||||||
{
|
{
|
||||||
macroModeClose();
|
macroModeClose();
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "math_macroarg.h"
|
#include "math_macroarg.h"
|
||||||
#include "math_notinset.h"
|
#include "math_notinset.h"
|
||||||
#include "math_rootinset.h"
|
#include "math_rootinset.h"
|
||||||
|
#include "math_sizeinset.h"
|
||||||
#include "math_spaceinset.h"
|
#include "math_spaceinset.h"
|
||||||
#include "math_specialcharinset.h"
|
#include "math_specialcharinset.h"
|
||||||
#include "math_sqrtinset.h"
|
#include "math_sqrtinset.h"
|
||||||
@ -68,6 +69,8 @@ MathAtom createMathInset(latexkeys const * l)
|
|||||||
return MathAtom(new MathBoxInset(l->name));
|
return MathAtom(new MathBoxInset(l->name));
|
||||||
case LM_TK_FUNC:
|
case LM_TK_FUNC:
|
||||||
return MathAtom(new MathFuncInset(l->name));
|
return MathAtom(new MathFuncInset(l->name));
|
||||||
|
case LM_TK_STY:
|
||||||
|
return MathAtom(new MathSizeInset(l));
|
||||||
}
|
}
|
||||||
return MathAtom(new MathUnknownInset(l->name));
|
return MathAtom(new MathUnknownInset(l->name));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "math_parser.h"
|
#include "math_parser.h"
|
||||||
|
#include "math_metricsinfo.h"
|
||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "support/filetools.h" // LibFileSearch
|
#include "support/filetools.h" // LibFileSearch
|
||||||
@ -65,7 +66,7 @@ key_type wordlist_array[] =
|
|||||||
{"deg", LM_TK_FUNC, 0},
|
{"deg", LM_TK_FUNC, 0},
|
||||||
{"det", LM_TK_FUNCLIM, 0},
|
{"det", LM_TK_FUNCLIM, 0},
|
||||||
{"dim", LM_TK_FUNC, 0},
|
{"dim", LM_TK_FUNC, 0},
|
||||||
//{"displaystyle", LM_TK_STY, LM_ST_DISPLAY},
|
{"displaystyle", LM_TK_STY, LM_ST_DISPLAY},
|
||||||
{"dot", LM_TK_DECORATION, 0},
|
{"dot", LM_TK_DECORATION, 0},
|
||||||
{"end", LM_TK_END, 0},
|
{"end", LM_TK_END, 0},
|
||||||
{"exp", LM_TK_FUNC, 0},
|
{"exp", LM_TK_FUNC, 0},
|
||||||
|
@ -3,10 +3,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "math_lefteqninset.h"
|
#include "math_lefteqninset.h"
|
||||||
#include "LColor.h"
|
|
||||||
#include "Painter.h"
|
|
||||||
#include "math_cursor.h"
|
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
|
#include "math_support.h"
|
||||||
|
|
||||||
|
|
||||||
MathLefteqnInset::MathLefteqnInset()
|
MathLefteqnInset::MathLefteqnInset()
|
||||||
@ -32,10 +30,7 @@ void MathLefteqnInset::metrics(MathMetricsInfo const & mi) const
|
|||||||
void MathLefteqnInset::draw(Painter & pain, int x, int y) const
|
void MathLefteqnInset::draw(Painter & pain, int x, int y) const
|
||||||
{
|
{
|
||||||
xcell(0).draw(pain, x + 2, y);
|
xcell(0).draw(pain, x + 2, y);
|
||||||
if (mathcursor && mathcursor->isInside(this)) {
|
//mathed_draw_framebox(pain, x, y, this);
|
||||||
pain.rectangle(x, y - ascent(), xcell(0).width(), height(),
|
|
||||||
LColor::mathframe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ point to write some macros:
|
|||||||
#include "math_macrotemplate.h"
|
#include "math_macrotemplate.h"
|
||||||
#include "math_hullinset.h"
|
#include "math_hullinset.h"
|
||||||
#include "math_rootinset.h"
|
#include "math_rootinset.h"
|
||||||
|
#include "math_sizeinset.h"
|
||||||
#include "math_sqrtinset.h"
|
#include "math_sqrtinset.h"
|
||||||
#include "math_scriptinset.h"
|
#include "math_scriptinset.h"
|
||||||
#include "math_specialcharinset.h"
|
#include "math_specialcharinset.h"
|
||||||
@ -899,19 +900,6 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
case LM_TK_STY:
|
|
||||||
{
|
|
||||||
lyxerr[Debug::MATHED] << "LM_TK_STY not implemented\n";
|
|
||||||
//MathArray tmp = array;
|
|
||||||
//MathSizeInset * p = new MathSizeInset(MathStyles(lval_->id));
|
|
||||||
//array.push_back(p);
|
|
||||||
//parse_into(p->cell(0), FLAG_BRACE_FONT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
else if (t.cs() == "begin") {
|
else if (t.cs() == "begin") {
|
||||||
string const name = getArg('{', '}');
|
string const name = getArg('{', '}');
|
||||||
if (name == "array") {
|
if (name == "array") {
|
||||||
@ -1000,6 +988,13 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
|
|||||||
array.push_back(p);
|
array.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (l->token == LM_TK_STY) {
|
||||||
|
MathAtom p = createMathInset(t.cs());
|
||||||
|
parse_into(p->cell(0), flags, code);
|
||||||
|
array.push_back(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
MathAtom p = createMathInset(t.cs());
|
MathAtom p = createMathInset(t.cs());
|
||||||
for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
|
for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "math_parser.h"
|
#include "math_parser.h"
|
||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "math_streamstr.h"
|
#include "math_streamstr.h"
|
||||||
|
#include "math_support.h"
|
||||||
|
|
||||||
|
|
||||||
MathSizeInset::MathSizeInset(latexkeys const * l)
|
MathSizeInset::MathSizeInset(latexkeys const * l)
|
||||||
@ -23,7 +24,8 @@ MathInset * MathSizeInset::clone() const
|
|||||||
|
|
||||||
void MathSizeInset::draw(Painter & pain, int x, int y) const
|
void MathSizeInset::draw(Painter & pain, int x, int y) const
|
||||||
{
|
{
|
||||||
xcell(0).draw(pain, x, y);
|
xcell(0).draw(pain, x + 1, y);
|
||||||
|
mathed_draw_framebox(pain, x, y, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -32,9 +34,9 @@ void MathSizeInset::metrics(MathMetricsInfo const & mi) const
|
|||||||
MathMetricsInfo m = mi;
|
MathMetricsInfo m = mi;
|
||||||
m.style = MathStyles(key_->id);
|
m.style = MathStyles(key_->id);
|
||||||
xcell(0).metrics(m);
|
xcell(0).metrics(m);
|
||||||
ascent_ = xcell(0).ascent_;
|
ascent_ = xcell(0).ascent_ + 1;
|
||||||
descent_ = xcell(0).descent_;
|
descent_ = xcell(0).descent_ + 1;
|
||||||
width_ = xcell(0).width_;
|
width_ = xcell(0).width_ + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "FontLoader.h"
|
#include "FontLoader.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "math_cursor.h"
|
||||||
#include "math_defs.h"
|
#include "math_defs.h"
|
||||||
#include "math_inset.h"
|
#include "math_inset.h"
|
||||||
#include "math_parser.h"
|
#include "math_parser.h"
|
||||||
@ -709,6 +710,14 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void mathed_draw_framebox(Painter & pain, int x, int y, MathInset const * p)
|
||||||
|
{
|
||||||
|
if (mathcursor && mathcursor->isInside(p))
|
||||||
|
pain.rectangle(x, y - p->ascent(), p->width(), p->height(),
|
||||||
|
LColor::mathframe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// In the future maybe we use a better fonts renderer
|
// In the future maybe we use a better fonts renderer
|
||||||
void drawStr(Painter & pain, MathTextCodes type, MathMetricsInfo const & siz,
|
void drawStr(Painter & pain, MathTextCodes type, MathMetricsInfo const & siz,
|
||||||
int x, int y, string const & s)
|
int x, int y, string const & s)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
class Painter;
|
class Painter;
|
||||||
class latexkeys;
|
class latexkeys;
|
||||||
class MathMetricsInfo;
|
class MathMetricsInfo;
|
||||||
|
class MathInset;
|
||||||
|
|
||||||
extern char const * latex_mathspace[];
|
extern char const * latex_mathspace[];
|
||||||
|
|
||||||
@ -26,6 +27,8 @@ int mathed_char_descent(MathTextCodes type, MathMetricsInfo const & size,
|
|||||||
void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
|
void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
|
||||||
string const & name);
|
string const & name);
|
||||||
|
|
||||||
|
void mathed_draw_framebox(Painter & pain, int x, int y, MathInset const *);
|
||||||
|
|
||||||
void mathed_string_dim(MathTextCodes type, MathMetricsInfo const & size,
|
void mathed_string_dim(MathTextCodes type, MathMetricsInfo const & size,
|
||||||
string const & s, int & asc, int & des, int & wid);
|
string const & s, int & asc, int & des, int & wid);
|
||||||
int mathed_string_height(MathTextCodes type, MathMetricsInfo const & size,
|
int mathed_string_height(MathTextCodes type, MathMetricsInfo const & size,
|
||||||
|
Loading…
Reference in New Issue
Block a user