mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
mathed cleanup, change mask for tmpdir
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1641 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
95aa44f550
commit
7f6bd7f12d
@ -1,5 +1,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <ctime>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-02-28 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* BufferView_pimpl.C: add <ctime>
|
||||
|
||||
2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* BufferView_pimpl.C: add using std::find_if
|
||||
|
@ -123,7 +123,6 @@ lyx_SOURCES = \
|
||||
gettext.h \
|
||||
importer.C \
|
||||
importer.h \
|
||||
include_form.h \
|
||||
intl.C \
|
||||
intl.h \
|
||||
kbmap.C \
|
||||
|
@ -1,5 +1,49 @@
|
||||
2001-02-28 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* math_spaceinset.[Ch]: add pragma, make variables private add
|
||||
'_', change order of method definitions.
|
||||
|
||||
* math_root.h (~MathRootInset): delete
|
||||
Change uroot_ to be a real object instead of a pointer
|
||||
* math_root.C: changes because of the above
|
||||
|
||||
* math_macro.C (MathMacro(MathMacro*)): delete constructor
|
||||
(MathMacro(MathMacro const &)): new copy constructor
|
||||
|
||||
* math_inset.h: delete constructor taking a pointer to MathedInset
|
||||
(size, incSize): move inline method
|
||||
|
||||
* math_funcinset.h: add pragma, remove class vars ln and fname,
|
||||
change protected to private, add '_' to priv vars.
|
||||
(~MathFuncInset): remove
|
||||
|
||||
* math_fracinset.h: make MathParInset den_ a real object and not a
|
||||
pointer.
|
||||
|
||||
* math_fracinset.C (MathFracInset): clean up, move initalization
|
||||
to initialization list
|
||||
(~MathFracInset): remove
|
||||
(Clone): remove leak
|
||||
|
||||
* math_draw.C: delete file
|
||||
|
||||
* math_dotsinset.[Ch]: add pragma
|
||||
|
||||
* math_bigopinset.h: make protected variables private add '_' to vars.
|
||||
|
||||
* math_bigopinset.C: move methods to follow class definition order
|
||||
|
||||
* math_accentinset.h (getAccentCode): move inline here
|
||||
|
||||
* math_accentinset.C (MathAccentInset): cleanup
|
||||
(draw): constify dw
|
||||
|
||||
2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* math_inset.[Ch] (MathedInset): remove method
|
||||
|
||||
* Makefile.am (libmathed_la_SOURCES): correct typo
|
||||
|
||||
* math_parinset.C (draw): move MathedXiter data(this) up. and
|
||||
remove it two other places.
|
||||
|
||||
|
@ -21,7 +21,7 @@ libmathed_la_SOURCES = \
|
||||
math_accentinset.C \
|
||||
math_accentinset.h \
|
||||
math_bigopinset.C \
|
||||
math_bibopinset.h \
|
||||
math_bigopinset.h \
|
||||
math_cursor.C \
|
||||
math_cursor.h \
|
||||
math_decorationinset.C \
|
||||
|
@ -8,15 +8,15 @@
|
||||
using std::ostream;
|
||||
|
||||
MathAccentInset::MathAccentInset(byte cx, MathedTextCodes f, int cd, short st)
|
||||
: MathedInset("", LM_OT_ACCENT, st), c(cx), fn(f), code(cd)
|
||||
{
|
||||
inset = 0;
|
||||
}
|
||||
|
||||
|
||||
MathAccentInset::MathAccentInset(MathedInset *ins, int cd, short st)
|
||||
: MathedInset("", LM_OT_ACCENT, st),
|
||||
c(0), fn(LM_TC_MIN), code(cd), inset(ins) {}
|
||||
c(cx), fn(f), code(cd), inset(0)
|
||||
{}
|
||||
|
||||
|
||||
MathAccentInset::MathAccentInset(MathedInset * ins, int cd, short st)
|
||||
: MathedInset("", LM_OT_ACCENT, st),
|
||||
c(0), fn(LM_TC_MIN), code(cd), inset(ins)
|
||||
{}
|
||||
|
||||
|
||||
MathAccentInset::~MathAccentInset()
|
||||
@ -41,7 +41,7 @@ MathedInset * MathAccentInset::Clone()
|
||||
void
|
||||
MathAccentInset::draw(Painter & pain, int x, int y)
|
||||
{
|
||||
int dw = width - 2;
|
||||
int const dw = width - 2;
|
||||
|
||||
if (inset)
|
||||
inset->draw(pain, x, y);
|
||||
@ -50,7 +50,7 @@ MathAccentInset::draw(Painter & pain, int x, int y)
|
||||
s += c;
|
||||
drawStr(pain, fn, size(), x, y, s);
|
||||
}
|
||||
x += (code == LM_not) ? (width-dw) / 2 : 2;
|
||||
x += (code == LM_not) ? (width - dw) / 2 : 2;
|
||||
mathed_draw_deco(pain, x, y - dy, dw, dh, code);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "math_defs.h"
|
||||
|
||||
/// Accents
|
||||
class MathAccentInset: public MathedInset {
|
||||
class MathAccentInset : public MathedInset {
|
||||
public:
|
||||
///
|
||||
MathAccentInset(byte, MathedTextCodes, int, short st = LM_ST_TEXT);
|
||||
@ -24,8 +24,7 @@ public:
|
||||
///
|
||||
void Metrics();
|
||||
///
|
||||
int getAccentCode() const { return code; }
|
||||
|
||||
int getAccentCode() const;
|
||||
protected:
|
||||
///
|
||||
byte c;
|
||||
@ -38,4 +37,11 @@ protected:
|
||||
///
|
||||
int dh, dy;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
int MathAccentInset::getAccentCode() const
|
||||
{
|
||||
return code;
|
||||
}
|
||||
#endif
|
||||
|
@ -8,34 +8,14 @@
|
||||
|
||||
using std::ostream;
|
||||
|
||||
bool MathBigopInset::GetLimits() const
|
||||
{
|
||||
// Default case
|
||||
if (lims < 0) {
|
||||
return sym != LM_int && sym != LM_oint && GetStyle() == LM_ST_DISPLAY;
|
||||
}
|
||||
|
||||
// Custom
|
||||
return lims > 0;
|
||||
}
|
||||
|
||||
|
||||
void MathBigopInset::SetLimits(bool ls)
|
||||
{
|
||||
lims = ls ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
MathBigopInset::MathBigopInset(string const & nam, int id, short st)
|
||||
: MathedInset(nam, LM_OT_BIGOP, st), sym(id)
|
||||
{
|
||||
lims = -1;
|
||||
}
|
||||
: MathedInset(nam, LM_OT_BIGOP, st), lims_(-1), sym_(id)
|
||||
{}
|
||||
|
||||
|
||||
MathedInset * MathBigopInset::Clone()
|
||||
{
|
||||
return new MathBigopInset(name, sym, GetStyle());
|
||||
return new MathBigopInset(name, sym_, GetStyle());
|
||||
}
|
||||
|
||||
|
||||
@ -45,15 +25,15 @@ MathBigopInset::draw(Painter & pain, int x, int y)
|
||||
string s;
|
||||
short t;
|
||||
|
||||
if (sym < 256 || sym == LM_oint) {
|
||||
s += (sym == LM_oint) ? LM_int : sym;
|
||||
if (sym_ < 256 || sym_ == LM_oint) {
|
||||
s += (sym_ == LM_oint) ? LM_int : sym_;
|
||||
t = LM_TC_BSYM;
|
||||
} else {
|
||||
s = name;
|
||||
t = LM_TC_TEXTRM;
|
||||
}
|
||||
if (sym == LM_oint) {
|
||||
pain.arc(x, y - 5 * width / 4, width, width, 0, 360*64,
|
||||
if (sym_ == LM_oint) {
|
||||
pain.arc(x, y - 5 * width / 4, width, width, 0, 360 * 64,
|
||||
LColor::mathline);
|
||||
++x;
|
||||
}
|
||||
@ -61,6 +41,24 @@ MathBigopInset::draw(Painter & pain, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
void MathBigopInset::Write(ostream & os, bool /* fragile */)
|
||||
{
|
||||
bool const limp = GetLimits();
|
||||
|
||||
os << '\\' << name;
|
||||
|
||||
if (limp && !(sym_ != LM_int && sym_ != LM_oint
|
||||
&& (GetStyle() == LM_ST_DISPLAY)))
|
||||
os << "\\limits ";
|
||||
else
|
||||
if (!limp && (sym_ != LM_int && sym_ != LM_oint
|
||||
&& (GetStyle() == LM_ST_DISPLAY)))
|
||||
os << "\\nolimits ";
|
||||
else
|
||||
os << ' ';
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MathBigopInset::Metrics()
|
||||
{
|
||||
@ -68,8 +66,8 @@ MathBigopInset::Metrics()
|
||||
string s;
|
||||
short t;
|
||||
|
||||
if (sym < 256 || sym == LM_oint) {
|
||||
char c = (sym == LM_oint) ? LM_int: sym;
|
||||
if (sym_ < 256 || sym_ == LM_oint) {
|
||||
char const c = (sym_ == LM_oint) ? LM_int: sym_;
|
||||
s += c;
|
||||
t = LM_TC_BSYM;
|
||||
} else {
|
||||
@ -78,23 +76,25 @@ MathBigopInset::Metrics()
|
||||
}
|
||||
mathed_string_height(t, size(), s, ascent, descent);
|
||||
width = mathed_string_width(t, size(), s);
|
||||
if (sym == LM_oint) width += 2;
|
||||
if (sym_ == LM_oint) width += 2;
|
||||
}
|
||||
|
||||
|
||||
void MathBigopInset::Write(ostream & os, bool /* fragile */)
|
||||
{
|
||||
bool limp = GetLimits();
|
||||
bool MathBigopInset::GetLimits() const
|
||||
{
|
||||
// Default case
|
||||
if (lims_ < 0) {
|
||||
return sym_ != LM_int &&
|
||||
sym_ != LM_oint &&
|
||||
GetStyle() == LM_ST_DISPLAY;
|
||||
}
|
||||
|
||||
os << '\\' << name;
|
||||
|
||||
if (limp && !(sym != LM_int && sym != LM_oint
|
||||
&& (GetStyle() == LM_ST_DISPLAY)))
|
||||
os << "\\limits ";
|
||||
else
|
||||
if (!limp && (sym != LM_int && sym != LM_oint
|
||||
&& (GetStyle() == LM_ST_DISPLAY)))
|
||||
os << "\\nolimits ";
|
||||
else
|
||||
os << ' ';
|
||||
// Custom
|
||||
return lims_ > 0;
|
||||
}
|
||||
|
||||
|
||||
void MathBigopInset::SetLimits(bool ls)
|
||||
{
|
||||
lims_ = ls ? 1 : 0;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "math_defs.h"
|
||||
|
||||
/// big operators
|
||||
class MathBigopInset: public MathedInset {
|
||||
class MathBigopInset : public MathedInset {
|
||||
public:
|
||||
///
|
||||
MathBigopInset(string const &, int, short st = LM_ST_TEXT);
|
||||
@ -22,10 +22,10 @@ public:
|
||||
bool GetLimits() const;
|
||||
///
|
||||
void SetLimits(bool);
|
||||
protected:
|
||||
private:
|
||||
///
|
||||
int lims;
|
||||
int lims_;
|
||||
///
|
||||
int sym;
|
||||
int sym_;
|
||||
};
|
||||
#endif
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "math_dotsinset.h"
|
||||
#include "mathed/support.h"
|
||||
#include "support/LOstream.h"
|
||||
|
@ -1,11 +1,16 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef MATH_DOTSINSET_H
|
||||
#define MATH_DOTSINSET_H
|
||||
|
||||
#include "math_inset.h"
|
||||
#include "math_defs.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/// The different kinds of ellipsis
|
||||
class MathDotsInset: public MathedInset {
|
||||
class MathDotsInset : public MathedInset {
|
||||
public:
|
||||
///
|
||||
MathDotsInset(string const &, int, short st = LM_ST_TEXT);
|
||||
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* File: math_draw.C
|
||||
* Purpose: Interaction and drawing for mathed
|
||||
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
||||
* Created: January 1996
|
||||
* Description: Math drawing and interaction for a WYSIWYG math editor.
|
||||
*
|
||||
* Dependencies: Xlib, XForms
|
||||
*
|
||||
* Copyright: 1996, Alejandro Aguilar Sierra
|
||||
*
|
||||
* Version: 0.8beta, Mathed & Lyx project.
|
||||
*
|
||||
* You are free to use and modify this code under the terms of
|
||||
* the GNU General Public Licence version 2 or later.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include FORMS_H_LOCATION
|
||||
#include "math_cursor.h"
|
||||
#include "math_parser.h"
|
||||
#include "debug.h"
|
||||
#include "lyxfont.h"
|
||||
#include "Painter.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
//extern LyXFont const mathed_get_font(short type, int size);
|
||||
//extern int mathed_char_width(short type, int style, byte c);
|
||||
//extern int mathed_string_width(short type, int style, string const &);
|
||||
//extern int mathed_string_height(short, int, string const &, int &, int &);
|
||||
//extern int mathed_char_height(short, int, byte, int &, int &);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -15,12 +15,9 @@ using std::ostream;
|
||||
|
||||
|
||||
MathFracInset::MathFracInset(short ot)
|
||||
: MathParInset(LM_ST_TEXT, "frac", ot)
|
||||
: MathParInset(LM_ST_TEXT, "frac", ot),
|
||||
idx_(0), den_(LM_ST_TEXT), dh_(0)
|
||||
{
|
||||
|
||||
den_ = new MathParInset(LM_ST_TEXT); // this leaks
|
||||
dh_ = 0;
|
||||
idx_ = 0;
|
||||
if (objtype == LM_OT_STACKREL) {
|
||||
flag |= LMPF_SCRIPT;
|
||||
SetName("stackrel");
|
||||
@ -28,17 +25,9 @@ MathFracInset::MathFracInset(short ot)
|
||||
}
|
||||
|
||||
|
||||
MathFracInset::~MathFracInset()
|
||||
{
|
||||
delete den_;
|
||||
}
|
||||
|
||||
|
||||
MathedInset * MathFracInset::Clone()
|
||||
{
|
||||
MathFracInset * p = new MathFracInset(*this);
|
||||
// this cast will go again...
|
||||
p->den_ = static_cast<MathParInset*>(p->den_->Clone());
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -57,7 +46,7 @@ void MathFracInset::SetStyle(short st)
|
||||
{
|
||||
MathParInset::SetStyle(st);
|
||||
dh_ = 0;
|
||||
den_->SetStyle((size() == LM_ST_DISPLAY) ?
|
||||
den_.SetStyle((size() == LM_ST_DISPLAY) ?
|
||||
static_cast<short>(LM_ST_TEXT)
|
||||
: size());
|
||||
}
|
||||
@ -65,7 +54,7 @@ void MathFracInset::SetStyle(short st)
|
||||
|
||||
void MathFracInset::SetData(MathedArray const & n, MathedArray const & d)
|
||||
{
|
||||
den_->setData(d);
|
||||
den_.setData(d);
|
||||
MathParInset::setData(n);
|
||||
}
|
||||
|
||||
@ -75,7 +64,7 @@ void MathFracInset::setData(MathedArray const & d)
|
||||
if (idx_ == 0)
|
||||
MathParInset::setData(d);
|
||||
else {
|
||||
den_->setData(d);
|
||||
den_.setData(d);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +74,7 @@ void MathFracInset::GetXY(int & x, int & y) const
|
||||
if (idx_ == 0)
|
||||
MathParInset::GetXY(x, y);
|
||||
else
|
||||
den_->GetXY(x, y);
|
||||
den_.GetXY(x, y);
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +83,7 @@ MathedArray & MathFracInset::GetData()
|
||||
if (idx_ == 0)
|
||||
return array;
|
||||
else
|
||||
return den_->GetData();
|
||||
return den_.GetData();
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +114,7 @@ MathFracInset::draw(Painter & pain, int x, int y)
|
||||
idx_ = 0;
|
||||
if (size() == LM_ST_DISPLAY) incSize();
|
||||
MathParInset::draw(pain, x + (width - w0_) / 2, y - des0_);
|
||||
den_->draw(pain, x + (width - w1_) / 2, y + den_->Ascent() + 2 - dh_);
|
||||
den_.draw(pain, x + (width - w1_) / 2, y + den_.Ascent() + 2 - dh_);
|
||||
size(sizex);
|
||||
if (objtype == LM_OT_FRAC)
|
||||
pain.line(x + 2, y - dh_,
|
||||
@ -151,11 +140,11 @@ MathFracInset::Metrics()
|
||||
w0_ = width;
|
||||
int const as = Height() + 2 + dh_;
|
||||
des0_ = Descent() + 2 + dh_;
|
||||
den_->Metrics();
|
||||
w1_ = den_->Width();
|
||||
den_.Metrics();
|
||||
w1_ = den_.Width();
|
||||
width = ((w0_ > w1_) ? w0_: w1_) + 12;
|
||||
ascent = as;
|
||||
descent = den_->Height()+ 2 - dh_;
|
||||
descent = den_.Height()+ 2 - dh_;
|
||||
idx_ = idxp;
|
||||
}
|
||||
|
||||
@ -165,6 +154,6 @@ void MathFracInset::Write(ostream & os, bool fragile)
|
||||
os << '\\' << name << '{';
|
||||
MathParInset::Write(os, fragile);
|
||||
os << "}{";
|
||||
den_->Write(os, fragile);
|
||||
den_.Write(os, fragile);
|
||||
os << '}';
|
||||
}
|
||||
|
@ -11,13 +11,11 @@
|
||||
/** Fraction like objects (frac, stackrel, binom)
|
||||
\author Alejandro Aguilar Sierra
|
||||
*/
|
||||
class MathFracInset: public MathParInset {
|
||||
class MathFracInset : public MathParInset {
|
||||
public:
|
||||
///
|
||||
MathFracInset(short ot = LM_OT_FRAC);
|
||||
///
|
||||
~MathFracInset();
|
||||
///
|
||||
MathedInset * Clone();
|
||||
///
|
||||
void draw(Painter &, int x, int baseline);
|
||||
@ -52,7 +50,7 @@ private:
|
||||
///
|
||||
int idx_;
|
||||
///
|
||||
MathParInset * den_;
|
||||
MathParInset den_;
|
||||
///
|
||||
int w0_;
|
||||
///
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "math_funcinset.h"
|
||||
#include "lyxfont.h"
|
||||
#include "font.h"
|
||||
@ -7,39 +11,16 @@
|
||||
#include "mathed/support.h"
|
||||
#include "support/LOstream.h"
|
||||
|
||||
using std::ostream;
|
||||
|
||||
using std::ostream;
|
||||
|
||||
extern LyXFont WhichFont(short type, int size);
|
||||
|
||||
MathFuncInset::~MathFuncInset()
|
||||
{}
|
||||
|
||||
|
||||
bool MathFuncInset::GetLimits() const
|
||||
{
|
||||
return bool(lims && (GetStyle() == LM_ST_DISPLAY));
|
||||
}
|
||||
|
||||
|
||||
void MathFuncInset::Write(std::ostream & os, bool /* fragile */)
|
||||
{
|
||||
os << "\\" << name << ' ';
|
||||
}
|
||||
|
||||
|
||||
MathFuncInset::MathFuncInset(string const & nm, short ot, short st)
|
||||
: MathedInset("", ot, st)
|
||||
: MathedInset(nm, ot, st)
|
||||
{
|
||||
ln = 0;
|
||||
lims = (GetType() == LM_OT_FUNCLIM);
|
||||
if (GetType() == LM_OT_UNDEF) {
|
||||
fname = nm;
|
||||
SetName(fname);
|
||||
} else {
|
||||
//fname = 0;
|
||||
SetName(nm);
|
||||
}
|
||||
lims_ = (GetType() == LM_OT_FUNCLIM);
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +30,6 @@ MathedInset * MathFuncInset::Clone()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
MathFuncInset::draw(Painter & pain, int x, int y)
|
||||
{
|
||||
@ -62,10 +42,14 @@ MathFuncInset::draw(Painter & pain, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
void MathFuncInset::Write(std::ostream & os, bool /* fragile */)
|
||||
{
|
||||
os << "\\" << name << ' ';
|
||||
}
|
||||
|
||||
|
||||
void MathFuncInset::Metrics()
|
||||
{
|
||||
//ln = (name) ? strlen(name): 0;
|
||||
LyXFont font = WhichFont(LM_TC_TEXTRM, size());
|
||||
font.setLatex(LyXFont::ON);
|
||||
if (name.empty()) {
|
||||
@ -75,6 +59,13 @@ void MathFuncInset::Metrics()
|
||||
} else {
|
||||
width = lyxfont::width(name, font)
|
||||
+ lyxfont::width('I', font) / 2;
|
||||
mathed_string_height(LM_TC_TEXTRM, size(), name, ascent, descent);
|
||||
mathed_string_height(LM_TC_TEXTRM, size(),
|
||||
name, ascent, descent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool MathFuncInset::GetLimits() const
|
||||
{
|
||||
return bool(lims_ && (GetStyle() == LM_ST_DISPLAY));
|
||||
}
|
||||
|
@ -1,21 +1,24 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef MATH_FUNCINSET_H
|
||||
#define MATH_FUNCINSET_H
|
||||
|
||||
#include "math_inset.h"
|
||||
#include "math_defs.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/**
|
||||
Functions or LaTeX names for objects that I don't know how to draw.
|
||||
*/
|
||||
class MathFuncInset: public MathedInset {
|
||||
class MathFuncInset : public MathedInset {
|
||||
public:
|
||||
///
|
||||
explicit
|
||||
MathFuncInset(string const & nm,
|
||||
short ot = LM_OT_FUNC, short st = LM_ST_TEXT);
|
||||
///
|
||||
~MathFuncInset();
|
||||
///
|
||||
MathedInset * Clone();
|
||||
///
|
||||
void draw(Painter &, int, int);
|
||||
@ -25,12 +28,8 @@ public:
|
||||
void Metrics();
|
||||
///
|
||||
bool GetLimits() const;
|
||||
protected:
|
||||
private:
|
||||
///
|
||||
int ln;
|
||||
///
|
||||
bool lims;
|
||||
///
|
||||
string fname;
|
||||
bool lims_;
|
||||
};
|
||||
#endif
|
||||
|
@ -314,7 +314,9 @@ latexkeys const wordlist[] =
|
||||
{"vdash", LM_TK_SYM, LM_vdash},
|
||||
};
|
||||
|
||||
static short lookup[] =
|
||||
|
||||
static
|
||||
short lookup[] =
|
||||
{
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1,
|
||||
-1, 9, 10, -1, 11, -1, -1, -1, 12, -1, -1, 491, -13, -2,
|
||||
|
@ -28,35 +28,17 @@
|
||||
#include "mathed/support.h"
|
||||
#include "Painter.h"
|
||||
|
||||
|
||||
// Initialize some static class variables.
|
||||
int MathedInset::df_asc;
|
||||
int MathedInset::df_des;
|
||||
int MathedInset::df_width;
|
||||
int MathedInset::workWidth;
|
||||
|
||||
|
||||
MathedInset::MathedInset(MathedInset * inset)
|
||||
{
|
||||
if (inset) {
|
||||
name = inset->GetName();
|
||||
objtype = inset->GetType();
|
||||
size_ = inset->GetStyle();
|
||||
width = inset->Width();
|
||||
ascent = inset->Ascent();
|
||||
descent = inset->Descent();
|
||||
} else {
|
||||
objtype = LM_OT_UNDEF;
|
||||
size_ = LM_ST_TEXT;
|
||||
width = ascent = descent = 0;
|
||||
//name = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MathedInset::MathedInset(string const & nm, short ot, short st)
|
||||
: name(nm), objtype(ot), size_(st)
|
||||
{
|
||||
width = ascent = descent = 0;
|
||||
}
|
||||
: name(nm), objtype(ot), width(0), ascent(0), descent(0), size_(st)
|
||||
{}
|
||||
|
||||
|
||||
// In a near future maybe we use a better fonts renderer
|
||||
|
@ -36,16 +36,13 @@ class Painter;
|
||||
general LyX inset. It's used to represent all the math objects.
|
||||
The formulaInset (a LyX inset) encapsulates a math inset.
|
||||
*/
|
||||
class MathedInset {
|
||||
class MathedInset {
|
||||
public:
|
||||
/** A math inset has a name (usually its LaTeX name),
|
||||
type and font-size
|
||||
*/
|
||||
MathedInset(string const & nm, short ot, short st);
|
||||
///
|
||||
explicit
|
||||
MathedInset(MathedInset *);
|
||||
///
|
||||
/// The virtual base destructor
|
||||
virtual ~MathedInset() {}
|
||||
/// Draw the object
|
||||
virtual void draw(Painter &, int x, int baseline) = 0;
|
||||
@ -89,9 +86,7 @@ public:
|
||||
///
|
||||
static void defaultWidth(int dw);
|
||||
///
|
||||
short size() const {
|
||||
return size_;
|
||||
}
|
||||
short size() const;
|
||||
protected:
|
||||
///
|
||||
string name;
|
||||
@ -112,14 +107,32 @@ protected:
|
||||
/// In a near future maybe we use a better fonts renderer than X
|
||||
void drawStr(Painter &, short, int, int, int, string const &);
|
||||
///
|
||||
void size(short s) {
|
||||
size_ = s;
|
||||
}
|
||||
void incSize() {
|
||||
++size_;
|
||||
}
|
||||
void size(short s);
|
||||
///
|
||||
void incSize();
|
||||
private:
|
||||
///
|
||||
short size_;
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
short MathedInset::size() const
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void MathedInset::size(short s)
|
||||
{
|
||||
size_ = s;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void MathedInset::incSize()
|
||||
{
|
||||
++size_;
|
||||
}
|
||||
#endif
|
||||
|
@ -58,27 +58,31 @@ MathMacro::MathMacro(MathMacroTemplate * t)
|
||||
}
|
||||
|
||||
|
||||
MathMacro::MathMacro(MathMacro * m)
|
||||
: MathParInset(LM_ST_TEXT, m->GetName(), LM_OT_MACRO)
|
||||
MathMacro::MathMacro(MathMacro const & m)
|
||||
: MathParInset(LM_ST_TEXT, m.GetName(), LM_OT_MACRO),
|
||||
tmplate_(m.tmplate_), idx_(0)
|
||||
{
|
||||
tmplate_ = m->tmplate_;
|
||||
nargs_ = tmplate_->getNoArgs();
|
||||
tcode_ = tmplate_->getTCode();
|
||||
args_.resize(nargs_);
|
||||
idx_ = 0;
|
||||
SetName(tmplate_->GetName());
|
||||
for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
|
||||
//m->setArgumentIdx(i);
|
||||
args_[i].row = m->args_[i].row;
|
||||
//args_[i].array = m->GetData();
|
||||
args_[i].array = m->args_[i].array;
|
||||
|
||||
std::vector<MacroArgumentBase>::const_iterator cit = m.args_.begin();
|
||||
std::vector<MacroArgumentBase>::const_iterator end = m.args_.end();
|
||||
|
||||
//args_.resize(nargs_);
|
||||
//for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
|
||||
// args_[i].row = m->args_[i].row;
|
||||
// args_[i].array = m->args_[i].array;
|
||||
//}
|
||||
for (; cit != end; ++cit) {
|
||||
args_.push_back(*cit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MathedInset * MathMacro::Clone()
|
||||
{
|
||||
return new MathMacro(this);
|
||||
return new MathMacro(*this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,15 +31,14 @@ class MathMacroTemplate;
|
||||
\author Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
||||
\version November 1996
|
||||
*/
|
||||
class MathMacro : public MathParInset
|
||||
{
|
||||
class MathMacro : public MathParInset {
|
||||
public:
|
||||
/// A macro can only be builded from an existing template
|
||||
explicit
|
||||
MathMacro(MathMacroTemplate *);
|
||||
/// or from another macro.
|
||||
explicit
|
||||
MathMacro(MathMacro *);
|
||||
MathMacro(MathMacro const &);
|
||||
///
|
||||
void draw(Painter &, int, int);
|
||||
///
|
||||
|
@ -30,10 +30,6 @@ MathMacroTemplate::MathMacroTemplate(string const & nm, int na, int flg):
|
||||
}
|
||||
|
||||
|
||||
//MathMacroTemplate::~MathMacroTemplate()
|
||||
//{}
|
||||
|
||||
|
||||
void MathMacroTemplate::setTCode(MathedTextCodes t)
|
||||
{
|
||||
tcode_ = t;
|
||||
|
@ -22,8 +22,6 @@ public:
|
||||
explicit
|
||||
MathMacroTemplate(string const &, int na = 0, int f = 0);
|
||||
///
|
||||
//~MathMacroTemplate();
|
||||
///
|
||||
void draw(Painter &, int, int);
|
||||
///
|
||||
void Metrics();
|
||||
|
@ -26,23 +26,13 @@
|
||||
using std::ostream;
|
||||
|
||||
MathRootInset::MathRootInset(short st)
|
||||
: MathSqrtInset(st)
|
||||
{
|
||||
idx_ = 1;
|
||||
uroot_ = new MathParInset(LM_ST_TEXT);
|
||||
}
|
||||
|
||||
|
||||
MathRootInset::~MathRootInset()
|
||||
{
|
||||
delete uroot_;
|
||||
}
|
||||
: MathSqrtInset(st), idx_(1), uroot_(LM_ST_TEXT)
|
||||
{}
|
||||
|
||||
|
||||
MathedInset * MathRootInset::Clone()
|
||||
{
|
||||
MathRootInset * p = new MathRootInset(*this);
|
||||
p->uroot_ = static_cast<MathParInset *>(p->uroot_->Clone());
|
||||
p->setArgumentIdx(0);
|
||||
return p;
|
||||
}
|
||||
@ -52,9 +42,8 @@ void MathRootInset::setData(MathedArray const & d)
|
||||
{
|
||||
if (idx_ == 1)
|
||||
MathParInset::setData(d);
|
||||
else {
|
||||
uroot_->setData(d);
|
||||
}
|
||||
else
|
||||
uroot_.setData(d);
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +62,7 @@ void MathRootInset::GetXY(int & x, int & y) const
|
||||
if (idx_ == 1)
|
||||
MathParInset::GetXY(x, y);
|
||||
else
|
||||
uroot_->GetXY(x, y);
|
||||
uroot_.GetXY(x, y);
|
||||
}
|
||||
|
||||
|
||||
@ -82,40 +71,40 @@ MathedArray & MathRootInset::GetData()
|
||||
if (idx_ == 1)
|
||||
return array;
|
||||
else
|
||||
return uroot_->GetData();
|
||||
return uroot_.GetData();
|
||||
}
|
||||
|
||||
|
||||
bool MathRootInset::Inside(int x, int y)
|
||||
{
|
||||
return (uroot_->Inside(x, y) || MathSqrtInset::Inside(x, y));
|
||||
return (uroot_.Inside(x, y) || MathSqrtInset::Inside(x, y));
|
||||
}
|
||||
|
||||
|
||||
void MathRootInset::Metrics()
|
||||
{
|
||||
int idxp = idx_;
|
||||
int const idxp = idx_;
|
||||
|
||||
idx_ = 1;
|
||||
MathSqrtInset::Metrics();
|
||||
uroot_->Metrics();
|
||||
wroot_ = uroot_->Width();
|
||||
dh_ = Height()/2;
|
||||
uroot_.Metrics();
|
||||
wroot_ = uroot_.Width();
|
||||
dh_ = Height() / 2;
|
||||
width += wroot_;
|
||||
// if (uroot->Ascent() > dh)
|
||||
if (uroot_->Height() > dh_)
|
||||
ascent += uroot_->Height() - dh_;
|
||||
dh_ -= descent - uroot_->Descent();
|
||||
// if (uroot_.Ascent() > dh)
|
||||
if (uroot_.Height() > dh_)
|
||||
ascent += uroot_.Height() - dh_;
|
||||
dh_ -= descent - uroot_.Descent();
|
||||
idx_ = idxp;
|
||||
}
|
||||
|
||||
|
||||
void MathRootInset::draw(Painter & pain, int x, int y)
|
||||
{
|
||||
int idxp = idx_;
|
||||
int const idxp = idx_;
|
||||
|
||||
idx_ = 1;
|
||||
uroot_->draw(pain, x, y - dh_);
|
||||
uroot_.draw(pain, x, y - dh_);
|
||||
MathSqrtInset::draw(pain, x + wroot_, y);
|
||||
idx_ = idxp;
|
||||
}
|
||||
@ -125,7 +114,7 @@ void MathRootInset::SetStyle(short st)
|
||||
{
|
||||
MathSqrtInset::SetStyle(st);
|
||||
|
||||
uroot_->SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
|
||||
uroot_.SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +127,7 @@ void MathRootInset::SetFocus(int x, int)
|
||||
void MathRootInset::Write(ostream & os, bool fragile)
|
||||
{
|
||||
os << '\\' << name << '[';
|
||||
uroot_->Write(os, fragile);
|
||||
uroot_.Write(os, fragile);
|
||||
os << "]{";
|
||||
MathParInset::Write(os, fragile);
|
||||
os << '}';
|
||||
|
@ -32,8 +32,6 @@ public:
|
||||
explicit
|
||||
MathRootInset(short st = LM_ST_TEXT);
|
||||
///
|
||||
~MathRootInset();
|
||||
///
|
||||
MathedInset * Clone();
|
||||
///
|
||||
void draw(Painter &, int x, int baseline);
|
||||
@ -63,7 +61,7 @@ private:
|
||||
///
|
||||
int idx_;
|
||||
///
|
||||
MathParInset * uroot_;
|
||||
MathParInset uroot_;
|
||||
///
|
||||
int wroot_;
|
||||
///
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "math_spaceinset.h"
|
||||
#include "LColor.h"
|
||||
#include "Painter.h"
|
||||
@ -9,31 +13,14 @@
|
||||
using std::ostream;
|
||||
|
||||
|
||||
void MathSpaceInset::Metrics()
|
||||
{
|
||||
width = space ? space * 2 : 2;
|
||||
if (space > 3) width *= 2;
|
||||
if (space == 5) width *= 2;
|
||||
width += 4;
|
||||
ascent = 4; descent = 0;
|
||||
}
|
||||
|
||||
|
||||
void MathSpaceInset::SetSpace(int sp)
|
||||
{
|
||||
space = sp;
|
||||
Metrics();
|
||||
}
|
||||
|
||||
|
||||
MathSpaceInset::MathSpaceInset(int sp, short ot, short st)
|
||||
: MathedInset("", ot, st), space(sp)
|
||||
: MathedInset("", ot, st), space_(sp)
|
||||
{}
|
||||
|
||||
|
||||
MathedInset * MathSpaceInset::Clone()
|
||||
{
|
||||
return new MathSpaceInset(space, GetType(), GetStyle());
|
||||
return new MathSpaceInset(space_, GetType(), GetStyle());
|
||||
}
|
||||
|
||||
|
||||
@ -53,20 +40,38 @@ MathSpaceInset::draw(Painter & pain, int x, int y)
|
||||
xp[2] = x + width - 2; yp[2] = y;
|
||||
xp[3] = x + width - 2; yp[3] = y - 3;
|
||||
|
||||
pain.lines(xp, yp, 4, (space) ? LColor::latex : LColor::math);
|
||||
pain.lines(xp, yp, 4, (space_) ? LColor::latex : LColor::math);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MathSpaceInset::Write(ostream & os, bool /* fragile */)
|
||||
{
|
||||
if (space >= 0 && space < 6) {
|
||||
os << '\\' << latex_mathspace[space] << ' ';
|
||||
}
|
||||
if (space_ >= 0 && space_ < 6) {
|
||||
os << '\\' << latex_mathspace[space_] << ' ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MathSpaceInset::Metrics()
|
||||
{
|
||||
width = space_ ? space_ * 2 : 2;
|
||||
if (space_ > 3) width *= 2;
|
||||
if (space_ == 5) width *= 2;
|
||||
width += 4;
|
||||
ascent = 4;
|
||||
descent = 0;
|
||||
}
|
||||
|
||||
|
||||
void MathSpaceInset::SetSpace(int sp)
|
||||
{
|
||||
space_ = sp;
|
||||
Metrics();
|
||||
}
|
||||
|
||||
|
||||
int MathSpaceInset::GetSpace()
|
||||
{
|
||||
return space;
|
||||
return space_;
|
||||
}
|
||||
|
@ -1,11 +1,16 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef MATH_SPACEINSET_H
|
||||
#define MATH_SPACEINSET_H
|
||||
|
||||
#include "math_inset.h"
|
||||
#include "math_defs.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
/// Smart spaces
|
||||
class MathSpaceInset: public MathedInset {
|
||||
class MathSpaceInset : public MathedInset {
|
||||
public:
|
||||
///
|
||||
MathSpaceInset(int sp, short ot = LM_OT_SPACE, short st = LM_ST_TEXT);
|
||||
@ -21,8 +26,8 @@ public:
|
||||
void SetSpace(int sp);
|
||||
///
|
||||
int GetSpace();
|
||||
protected:
|
||||
private:
|
||||
///
|
||||
int space;
|
||||
int space_;
|
||||
};
|
||||
#endif
|
||||
|
@ -24,15 +24,6 @@ MathedInset * MathSqrtInset::Clone()
|
||||
}
|
||||
|
||||
|
||||
bool MathSqrtInset::Inside(int x, int y)
|
||||
{
|
||||
return x >= xo() - hmax_
|
||||
&& x <= xo() + width - hmax_
|
||||
&& y <= yo() + descent
|
||||
&& y >= yo() - ascent;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MathSqrtInset::draw(Painter & pain, int x, int y)
|
||||
{
|
||||
@ -51,6 +42,14 @@ MathSqrtInset::draw(Painter & pain, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
void MathSqrtInset::Write(ostream & os, bool fragile)
|
||||
{
|
||||
os << '\\' << name << '{';
|
||||
MathParInset::Write(os, fragile);
|
||||
os << '}';
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MathSqrtInset::Metrics()
|
||||
{
|
||||
@ -66,9 +65,10 @@ MathSqrtInset::Metrics()
|
||||
}
|
||||
|
||||
|
||||
void MathSqrtInset::Write(ostream & os, bool fragile)
|
||||
bool MathSqrtInset::Inside(int x, int y)
|
||||
{
|
||||
os << '\\' << name << '{';
|
||||
MathParInset::Write(os, fragile);
|
||||
os << '}';
|
||||
return x >= xo() - hmax_
|
||||
&& x <= xo() + width - hmax_
|
||||
&& y <= yo() + descent
|
||||
&& y >= yo() - ascent;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-02-27 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
|
||||
|
||||
* filetools.C (CreateTmpDir): change umask to 0700.
|
||||
|
||||
2001-02-27 José Matos <jamatos@fep.up.pt>
|
||||
|
||||
* filetools.h (BasePath):
|
||||
|
@ -442,7 +442,7 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
|
||||
// safe because of the gap between unlink and mkdir. (Lgb)
|
||||
lyx::unlink(tmpfl.c_str());
|
||||
|
||||
if (tmpfl.empty() || lyx::mkdir(tmpfl, 0777)) {
|
||||
if (tmpfl.empty() || lyx::mkdir(tmpfl, 0700)) {
|
||||
WriteFSAlert(_("Error! Couldn't create temporary directory:"),
|
||||
tempdir);
|
||||
return string();
|
||||
|
Loading…
x
Reference in New Issue
Block a user