#include <config.h>
+#include <ctime>
#include <unistd.h>
#include <sys/wait.h>
+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
gettext.h \
importer.C \
importer.h \
- include_form.h \
intl.C \
intl.h \
kbmap.C \
+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.
math_accentinset.C \
math_accentinset.h \
math_bigopinset.C \
- math_bibopinset.h \
+ math_bigopinset.h \
math_cursor.C \
math_cursor.h \
math_decorationinset.C \
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;
-}
+ : MathedInset("", LM_OT_ACCENT, st),
+ c(cx), fn(f), code(cd), inset(0)
+{}
-MathAccentInset::MathAccentInset(MathedInset *ins, int cd, short st)
+MathAccentInset::MathAccentInset(MathedInset * ins, int cd, short st)
: MathedInset("", LM_OT_ACCENT, st),
- c(0), fn(LM_TC_MIN), code(cd), inset(ins) {}
+ c(0), fn(LM_TC_MIN), code(cd), inset(ins)
+{}
MathAccentInset::~MathAccentInset()
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);
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);
}
#include "math_defs.h"
/// Accents
-class MathAccentInset: public MathedInset {
+class MathAccentInset : public MathedInset {
public:
///
MathAccentInset(byte, MathedTextCodes, int, short st = LM_ST_TEXT);
///
void Metrics();
///
- int getAccentCode() const { return code; }
-
+ int getAccentCode() const;
protected:
///
byte c;
///
int dh, dy;
};
+
+
+inline
+int MathAccentInset::getAccentCode() const
+{
+ return code;
+}
#endif
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());
}
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;
}
}
+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()
{
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 {
}
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();
-
- os << '\\' << name;
+bool MathBigopInset::GetLimits() const
+{
+ // Default case
+ if (lims_ < 0) {
+ return sym_ != LM_int &&
+ sym_ != LM_oint &&
+ GetStyle() == LM_ST_DISPLAY;
+ }
- 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;
}
#include "math_defs.h"
/// big operators
-class MathBigopInset: public MathedInset {
+class MathBigopInset : public MathedInset {
public:
///
MathBigopInset(string const &, int, short st = LM_ST_TEXT);
bool GetLimits() const;
///
void SetLimits(bool);
-protected:
+private:
///
- int lims;
+ int lims_;
///
- int sym;
+ int sym_;
};
#endif
#include <config.h>
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
#include "math_dotsinset.h"
#include "mathed/support.h"
#include "support/LOstream.h"
+// -*- 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);
+++ /dev/null
-/*
- * 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 &);
-
-
-
-
-
-
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");
}
-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;
}
{
MathParInset::SetStyle(st);
dh_ = 0;
- den_->SetStyle((size() == LM_ST_DISPLAY) ?
+ den_.SetStyle((size() == LM_ST_DISPLAY) ?
static_cast<short>(LM_ST_TEXT)
: size());
}
void MathFracInset::SetData(MathedArray const & n, MathedArray const & d)
{
- den_->setData(d);
+ den_.setData(d);
MathParInset::setData(n);
}
if (idx_ == 0)
MathParInset::setData(d);
else {
- den_->setData(d);
+ den_.setData(d);
}
}
if (idx_ == 0)
MathParInset::GetXY(x, y);
else
- den_->GetXY(x, y);
+ den_.GetXY(x, y);
}
if (idx_ == 0)
return array;
else
- return den_->GetData();
+ return den_.GetData();
}
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_,
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;
}
os << '\\' << name << '{';
MathParInset::Write(os, fragile);
os << "}{";
- den_->Write(os, fragile);
+ den_.Write(os, fragile);
os << '}';
}
/** 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);
///
int idx_;
///
- MathParInset * den_;
+ MathParInset den_;
///
int w0_;
///
#include <config.h>
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
#include "math_funcinset.h"
#include "lyxfont.h"
#include "font.h"
#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);
}
}
-
void
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()) {
} 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));
+}
+// -*- 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);
void Metrics();
///
bool GetLimits() const;
-protected:
- ///
- int ln;
- ///
- bool lims;
+private:
///
- string fname;
+ bool lims_;
};
#endif
{"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,
#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
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;
///
static void defaultWidth(int dw);
///
- short size() const {
- return size_;
- }
+ short size() const;
protected:
///
string name;
/// 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
}
-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);
}
\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);
///
}
-//MathMacroTemplate::~MathMacroTemplate()
-//{}
-
-
void MathMacroTemplate::setTCode(MathedTextCodes t)
{
tcode_ = t;
explicit
MathMacroTemplate(string const &, int na = 0, int f = 0);
///
- //~MathMacroTemplate();
- ///
void draw(Painter &, int, int);
///
void Metrics();
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;
}
{
if (idx_ == 1)
MathParInset::setData(d);
- else {
- uroot_->setData(d);
- }
+ else
+ uroot_.setData(d);
}
if (idx_ == 1)
MathParInset::GetXY(x, y);
else
- uroot_->GetXY(x, y);
+ uroot_.GetXY(x, y);
}
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;
}
{
MathSqrtInset::SetStyle(st);
- uroot_->SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
+ uroot_.SetStyle((size() < LM_ST_SCRIPTSCRIPT) ? size() + 1 : size());
}
void MathRootInset::Write(ostream & os, bool fragile)
{
os << '\\' << name << '[';
- uroot_->Write(os, fragile);
+ uroot_.Write(os, fragile);
os << "]{";
MathParInset::Write(os, fragile);
os << '}';
explicit
MathRootInset(short st = LM_ST_TEXT);
///
- ~MathRootInset();
- ///
MathedInset * Clone();
///
void draw(Painter &, int x, int baseline);
///
int idx_;
///
- MathParInset * uroot_;
+ MathParInset uroot_;
///
int wroot_;
///
#include <config.h>
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
#include "math_spaceinset.h"
#include "LColor.h"
#include "Painter.h"
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());
}
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_;
}
+// -*- 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);
void SetSpace(int sp);
///
int GetSpace();
-protected:
+private:
///
- int space;
+ int space_;
};
#endif
}
-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)
{
}
+void MathSqrtInset::Write(ostream & os, bool fragile)
+{
+ os << '\\' << name << '{';
+ MathParInset::Write(os, fragile);
+ os << '}';
+}
+
+
void
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;
}
+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):
// 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();