mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2511 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8766c98cfe
commit
4310ee2793
@ -160,6 +160,7 @@ void InsetFormula::metrics() const
|
||||
par_->metrics(display() ? LM_ST_DISPLAY : LM_ST_TEXT);
|
||||
}
|
||||
|
||||
|
||||
vector<string> const InsetFormula::getLabelList() const
|
||||
{
|
||||
return par_->getLabelList();
|
||||
|
@ -177,7 +177,9 @@ void InsetFormulaBase::edit(BufferView * bv, int x, int /*y*/, unsigned int)
|
||||
lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl;
|
||||
|
||||
metrics();
|
||||
//bv->updateInset(this, false);
|
||||
// if that is removed, we won't get the magenta box when entering an
|
||||
// inset for the first time
|
||||
bv->updateInset(this, false);
|
||||
if (x == 0)
|
||||
mathcursor->first();
|
||||
else
|
||||
|
@ -399,15 +399,12 @@ void MathCursor::insert(char c, MathTextCodes t)
|
||||
if (t != LM_TC_VAR)
|
||||
lastcode_ = t;
|
||||
|
||||
if (imacro_ && !(MathIsAlphaFont(t) || t == LM_TC_VAR))
|
||||
if (imacro_ && t != LM_TC_TEX)
|
||||
macroModeClose();
|
||||
|
||||
if (imacro_) {
|
||||
if (MathIsAlphaFont(t) || t == LM_TC_VAR) {
|
||||
// was MacroModeinsert(c);
|
||||
imacro_->setName(imacro_->name() + c);
|
||||
return;
|
||||
}
|
||||
imacro_->setName(imacro_->name() + c);
|
||||
return;
|
||||
}
|
||||
|
||||
array().insert(pos(), new MathCharInset(c, t));
|
||||
|
@ -16,12 +16,6 @@ using std::endl;
|
||||
using std::max;
|
||||
|
||||
|
||||
bool MathIsAlphaFont(MathTextCodes x)
|
||||
{
|
||||
return LM_TC_VAR <= x && x <= LM_TC_TEXTRM;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
class Matrix {
|
||||
public:
|
||||
@ -457,35 +451,43 @@ math_deco_struct math_deco_table[] = {
|
||||
|
||||
struct math_deco_compare {
|
||||
/// for use by sort and lower_bound
|
||||
inline
|
||||
int operator()(math_deco_struct const & a,
|
||||
math_deco_struct const & b) const {
|
||||
int operator()(math_deco_struct const & a, math_deco_struct const & b) const
|
||||
{
|
||||
return a.code < b.code;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int const math_deco_table_size =
|
||||
sizeof(math_deco_table) /sizeof(math_deco_struct);
|
||||
sizeof(math_deco_table) / sizeof(math_deco_struct);
|
||||
|
||||
|
||||
class init_deco_table {
|
||||
public:
|
||||
// sort the table on startup
|
||||
struct init_deco_table {
|
||||
init_deco_table() {
|
||||
if (!init) {
|
||||
sort(math_deco_table,
|
||||
std::sort(math_deco_table,
|
||||
math_deco_table + math_deco_table_size,
|
||||
math_deco_compare());
|
||||
init_deco_table::init = true;
|
||||
}
|
||||
}
|
||||
private:
|
||||
static bool init;
|
||||
};
|
||||
|
||||
static init_deco_table dummy;
|
||||
|
||||
|
||||
math_deco_struct const * search_deco(int code)
|
||||
{
|
||||
static const math_deco_struct search_elem = { code, 0, 0 };
|
||||
|
||||
math_deco_struct const * res =
|
||||
lower_bound(math_deco_table,
|
||||
math_deco_table + math_deco_table_size,
|
||||
search_elem, math_deco_compare());
|
||||
if (res != math_deco_table + math_deco_table_size &&
|
||||
res->code == code)
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool init_deco_table::init = false;
|
||||
static init_deco_table idt;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
@ -529,8 +531,6 @@ int mathed_char_descent(MathTextCodes type, MathStyles size, unsigned char c)
|
||||
return lyxfont::descent(c, font);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int mathed_char_width(MathTextCodes type, MathStyles size, unsigned char c)
|
||||
{
|
||||
LyXFont const font = WhichFont(type, size);
|
||||
@ -560,31 +560,12 @@ int mathed_string_height(MathTextCodes type, MathStyles size, string const & s,
|
||||
return asc + des;
|
||||
}
|
||||
|
||||
|
||||
int mathed_string_width(MathTextCodes type, MathStyles size, string const & s)
|
||||
{
|
||||
return lyxfont::width(s, WhichFont(type, size));
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
math_deco_struct const * search_deco(int code)
|
||||
{
|
||||
math_deco_struct search_elem = { code, 0, 0 };
|
||||
|
||||
math_deco_struct const * res =
|
||||
lower_bound(math_deco_table,
|
||||
math_deco_table + math_deco_table_size,
|
||||
search_elem, math_deco_compare());
|
||||
if (res != math_deco_table + math_deco_table_size &&
|
||||
res->code == code)
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
|
||||
latexkeys const * l)
|
||||
{
|
||||
@ -674,6 +655,7 @@ bool isBinaryOp(char c)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// In a near future maybe we use a better fonts renderer
|
||||
void drawStr(Painter & pain, MathTextCodes type, MathStyles siz,
|
||||
int x, int y, string const & s)
|
||||
|
@ -32,8 +32,6 @@ int mathed_string_width(MathTextCodes type, MathStyles size, string const & s);
|
||||
int mathed_string_ascent(MathTextCodes type, MathStyles size, string const & s);
|
||||
int mathed_string_descent(MathTextCodes type, MathStyles size, string const & s);
|
||||
|
||||
bool MathIsAlphaFont(MathTextCodes x);
|
||||
|
||||
void drawStr(Painter & pain, MathTextCodes type, MathStyles siz,
|
||||
int x, int y, string const & s);
|
||||
void drawChar(Painter & pain, MathTextCodes type, MathStyles siz,
|
||||
|
Loading…
Reference in New Issue
Block a user