mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Andre's mathinset shrink patch ; default .lyx extension when loading files
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2399 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ab9eb4667d
commit
a36dbaf607
@ -1,3 +1,11 @@
|
||||
2001-08-01 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* lyxfunc.C: small change due to changed mathed interface
|
||||
|
||||
2001-08-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* bufferlist.C (loadLyXFile): add .lyx to file name if necessary
|
||||
|
||||
2001-08-01 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* lyxfunc.c: fail gracefully if file doesn't exist
|
||||
@ -21,7 +29,7 @@
|
||||
|
||||
2001-07-30 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* converter.[hC] + affected fiels: move to (inital-char)lowercase
|
||||
* converter.[hC] + affected files: move to (inital-char)lowercase
|
||||
function names.
|
||||
|
||||
* ParagraphParameters.C (ParagraphParameters): remove commented code
|
||||
@ -158,6 +166,8 @@
|
||||
* LyXAction.C:
|
||||
* lyxfunc.C: new LFUN 'math-space'
|
||||
|
||||
* BufferView.[Ch]: remove unneeded reference to 'WorkArea'
|
||||
|
||||
2001-07-25 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||
|
||||
* text2.C (toggleInset): call open/close
|
||||
|
@ -477,8 +477,12 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
|
||||
|
||||
Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
|
||||
{
|
||||
// make sure our path is absolute
|
||||
string const s = MakeAbsPath(filename);
|
||||
// get absolute path of file and add ".lyx" to the filename if
|
||||
// necessary
|
||||
string s = FileSearch(string(), filename, "lyx");
|
||||
if (s.empty()) {
|
||||
s = filename;
|
||||
}
|
||||
|
||||
// file already open?
|
||||
if (exists(s)) {
|
||||
|
@ -550,7 +550,7 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
||||
case LFUN_MATH_MUTATE: {
|
||||
Inset * tli = owner->view()->theLockingInset();
|
||||
if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
|
||||
MathInsetTypes type = mathcursor->par()->GetType();
|
||||
MathInsetTypes type = mathcursor->formula()->getType();
|
||||
func_status::value_type box = func_status::ToggleOff;
|
||||
if (argument == "inline") {
|
||||
if (type == LM_OT_SIMPLE)
|
||||
|
@ -307,7 +307,7 @@ void InsetFormula::handleExtern(const string & arg, BufferView *)
|
||||
|
||||
bool InsetFormula::display() const
|
||||
{
|
||||
return par_->getType() != LM_OT_SIMPLE;
|
||||
return par()->getType() != LM_OT_SIMPLE;
|
||||
}
|
||||
|
||||
|
||||
@ -357,3 +357,9 @@ int InsetFormula::width(BufferView *, LyXFont const &) const
|
||||
metrics();
|
||||
return par()->width();
|
||||
}
|
||||
|
||||
|
||||
MathInsetTypes InsetFormula::getType() const
|
||||
{
|
||||
return par()->getType();;
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ public:
|
||||
bool display() const;
|
||||
///
|
||||
bool ams() const;
|
||||
///
|
||||
MathInsetTypes getType() const;
|
||||
private:
|
||||
/// Safe setting of contents
|
||||
void par(MathInset *);
|
||||
|
@ -104,26 +104,18 @@ bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
|
||||
}
|
||||
|
||||
|
||||
} // namespaces
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
// returns the nearest enclosing matrix
|
||||
// returns the nearest enclosing grid
|
||||
MathArrayInset * matrixpar(int & idx)
|
||||
{
|
||||
idx = 0;
|
||||
return
|
||||
static_cast<MathArrayInset *>
|
||||
(mathcursor ? mathcursor->enclosing(LM_OT_MATRIX, idx) : 0);
|
||||
return (mathcursor ? mathcursor->enclosingArray(idx) : 0);
|
||||
}
|
||||
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
|
||||
InsetFormulaBase::InsetFormulaBase(MathInset * par)
|
||||
: par_(par)
|
||||
{
|
||||
@ -131,6 +123,7 @@ InsetFormulaBase::InsetFormulaBase(MathInset * par)
|
||||
#warning This is needed as long the math parser is not re-entrant
|
||||
#endif
|
||||
MathMacroTable::builtinMacros();
|
||||
//lyxerr << "sizeof MathInset: " << sizeof(MathInset) << "\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,6 +22,9 @@
|
||||
#include <iosfwd>
|
||||
#include "insets/inset.h"
|
||||
|
||||
// only for getType():
|
||||
#include "math_defs.h"
|
||||
|
||||
class Buffer;
|
||||
class BufferView;
|
||||
class MathInset;
|
||||
@ -58,6 +61,8 @@ public:
|
||||
virtual int linuxdoc(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
virtual int docBook(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
virtual MathInsetTypes getType() const = 0;
|
||||
|
||||
protected:
|
||||
/// the actual functions don't use the Buffer * parameter
|
||||
|
@ -194,3 +194,8 @@ Inset::Code InsetFormulaMacro::lyxCode() const
|
||||
return Inset::MATHMACRO_CODE;
|
||||
}
|
||||
|
||||
|
||||
MathInsetTypes InsetFormulaMacro::getType() const
|
||||
{
|
||||
return LM_OT_MACRO;
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
Inset::Code lyxCode() const;
|
||||
///
|
||||
RESULT localDispatch(BufferView *, kb_action, string const &);
|
||||
///
|
||||
MathInsetTypes getType() const;
|
||||
private:
|
||||
/// prefix in inset
|
||||
string prefix() const;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
MathArrayInset::MathArrayInset(int m, int n)
|
||||
: MathGridInset(m, n, "array", LM_OT_MATRIX)
|
||||
: MathGridInset(m, n, "array")
|
||||
{}
|
||||
|
||||
|
||||
|
@ -17,6 +17,8 @@ public:
|
||||
virtual MathInset * clone() const;
|
||||
///
|
||||
void write(std::ostream &, bool fragile) const;
|
||||
///
|
||||
bool isArray() const { return true; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -958,13 +958,12 @@ MathTextCodes MathCursor::getLastCode() const
|
||||
}
|
||||
|
||||
|
||||
MathInset * MathCursor::enclosing(MathInsetTypes t, int & idx) const
|
||||
MathArrayInset * MathCursor::enclosingArray(int & idx) const
|
||||
{
|
||||
for (int i = Cursor_.size() - 1; i >= 0; --i) {
|
||||
//lyxerr << "checking level " << i << "\n";
|
||||
if (Cursor_[i].par_->getType() == t) {
|
||||
if (Cursor_[i].par_->isArray()) {
|
||||
idx = Cursor_[i].idx_;
|
||||
return Cursor_[i].par_;
|
||||
return static_cast<MathArrayInset *>(Cursor_[i].par_);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -998,10 +997,10 @@ void MathCursor::normalize() const
|
||||
#endif
|
||||
MathCursor * it = const_cast<MathCursor *>(this);
|
||||
|
||||
if (cursor().idx_ < 0 || cursor().idx_ > cursor().par_->nargs())
|
||||
if (cursor().idx_ < 0 || cursor().idx_ > cursor().par_->nargs() - 1)
|
||||
lyxerr << "this should not really happen - 1\n";
|
||||
it->cursor().idx_ = max(cursor().idx_, 0);
|
||||
it->cursor().idx_ = min(cursor().idx_, cursor().par_->nargs());
|
||||
it->cursor().idx_ = min(cursor().idx_, cursor().par_->nargs() - 1);
|
||||
|
||||
if (cursor().pos_ < 0 || cursor().pos_ > array().size())
|
||||
lyxerr << "this should not really happen - 2\n";
|
||||
@ -1177,8 +1176,7 @@ void MathCursor::breakLine()
|
||||
char MathCursor::valign() const
|
||||
{
|
||||
int idx;
|
||||
MathGridInset * p =
|
||||
static_cast<MathGridInset *>(enclosing(LM_OT_MATRIX, idx));
|
||||
MathArrayInset * p = enclosingArray(idx);
|
||||
return p ? p->valign() : 0;
|
||||
}
|
||||
|
||||
@ -1186,8 +1184,7 @@ char MathCursor::valign() const
|
||||
char MathCursor::halign() const
|
||||
{
|
||||
int idx;
|
||||
MathGridInset * p =
|
||||
static_cast<MathGridInset *>(enclosing(LM_OT_MATRIX, idx));
|
||||
MathArrayInset * p = enclosingArray(idx);
|
||||
return p ? p->halign(idx % p->ncols()) : 0;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ class MathInset;
|
||||
class MathFuncInset;
|
||||
class MathScriptInset;
|
||||
class MathSpaceInset;
|
||||
class MathArrayInset;
|
||||
class InsetFormulaBase;
|
||||
class MathArray;
|
||||
class MathXArray;
|
||||
@ -109,9 +110,8 @@ public:
|
||||
void getPos(int & x, int & y);
|
||||
///
|
||||
MathInset * par() const;
|
||||
/// return the next enclosing par of the given type and the cursor's
|
||||
//index in it
|
||||
MathInset * enclosing(MathInsetTypes, int &) const;
|
||||
/// return the next enclosing grid inset and the cursor's index in it
|
||||
MathArrayInset * enclosingArray(int &) const;
|
||||
///
|
||||
InsetFormulaBase const * formula();
|
||||
///
|
||||
|
@ -29,8 +29,8 @@ MathGridInset::ColInfo::ColInfo()
|
||||
{}
|
||||
|
||||
|
||||
MathGridInset::MathGridInset(int m, int n, string const & nm, MathInsetTypes ot)
|
||||
: MathInset(m * n, nm, ot), rowinfo_(n), colinfo_(m), v_align_('c')
|
||||
MathGridInset::MathGridInset(int m, int n, string const & nm)
|
||||
: MathInset(m * n, nm), rowinfo_(n), colinfo_(m), v_align_('c')
|
||||
{
|
||||
if (m <= 0)
|
||||
lyxerr << "positve number of columns expected\n";
|
||||
|
@ -52,7 +52,7 @@ class MathGridInset : public MathInset {
|
||||
|
||||
public:
|
||||
///
|
||||
MathGridInset(int m, int n, string const & nm, MathInsetTypes ot);
|
||||
MathGridInset(int m, int n, string const & nm);
|
||||
///
|
||||
virtual MathInset * clone() const = 0;
|
||||
///
|
||||
@ -77,6 +77,8 @@ public:
|
||||
const RowInfo & rowinfo(int row) const;
|
||||
///
|
||||
RowInfo & rowinfo(int row);
|
||||
///
|
||||
bool isGrid() const { return true; }
|
||||
|
||||
///
|
||||
int ncols() const { return colinfo_.size(); }
|
||||
|
@ -26,8 +26,8 @@
|
||||
int MathInset::workwidth;
|
||||
|
||||
|
||||
MathInset::MathInset(int nargs, string const & name, MathInsetTypes ot)
|
||||
: name_(name), objtype(ot), width_(0), ascent_(0), descent_(0),
|
||||
MathInset::MathInset(int nargs, string const & name)
|
||||
: name_(name), width_(0), ascent_(0), descent_(0),
|
||||
size_(LM_ST_DISPLAY), cells_(nargs), xo_(0), yo_(0)
|
||||
{}
|
||||
|
||||
@ -63,8 +63,8 @@ int MathInset::limits() const
|
||||
|
||||
|
||||
void MathInset::limits(int)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
string const & MathInset::name() const
|
||||
{
|
||||
@ -72,18 +72,6 @@ string const & MathInset::name() const
|
||||
}
|
||||
|
||||
|
||||
MathInsetTypes MathInset::getType() const
|
||||
{
|
||||
return objtype;
|
||||
}
|
||||
|
||||
|
||||
void MathInset::setType(MathInsetTypes t)
|
||||
{
|
||||
objtype = t;
|
||||
}
|
||||
|
||||
|
||||
void MathInset::setName(string const & n)
|
||||
{
|
||||
name_ = n;
|
||||
|
@ -44,8 +44,7 @@ class LaTeXFeatures;
|
||||
class MathInset {
|
||||
public:
|
||||
///
|
||||
explicit MathInset
|
||||
(int na = 0, string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE);
|
||||
explicit MathInset(int na = 0, string const & nm = string());
|
||||
|
||||
/// the virtual base destructor
|
||||
virtual ~MathInset() {}
|
||||
@ -77,13 +76,6 @@ public:
|
||||
///
|
||||
string const & name() const;
|
||||
///
|
||||
MathInsetTypes getType() const;
|
||||
///
|
||||
MathInsetTypes GetType() const { return getType(); }
|
||||
//Man: Avoid to use these functions if it's not strictly necessary
|
||||
///
|
||||
virtual void setType(MathInsetTypes t);
|
||||
///
|
||||
virtual void setName(string const & n);
|
||||
///
|
||||
MathStyles size() const;
|
||||
@ -177,12 +169,16 @@ public:
|
||||
void getXY(int & x, int & y) const;
|
||||
///
|
||||
bool covers(int x, int y) const;
|
||||
/// Identifies things that can get scripts
|
||||
/// identifies things that can get scripts
|
||||
virtual bool isScriptable() const { return false; }
|
||||
/// Identifies ScriptInsets
|
||||
/// identifies ScriptInsets
|
||||
virtual bool isScriptInset() const { return false; }
|
||||
/// Identifies SpaceInsets
|
||||
/// identifies SpaceInsets
|
||||
virtual bool isSpaceInset() const { return false; }
|
||||
/// identifies GridInsets
|
||||
virtual bool isGrid() const { return false; }
|
||||
/// identifies ArrayInsets
|
||||
virtual bool isArray() const { return false; }
|
||||
///
|
||||
virtual bool isActive() const { return nargs() > 0; }
|
||||
|
||||
@ -202,8 +198,6 @@ public:
|
||||
protected:
|
||||
/// usually the LaTeX name of the thingy
|
||||
string name_;
|
||||
///
|
||||
MathInsetTypes objtype;
|
||||
/// the width of this inset as computed by metrics()
|
||||
int width_;
|
||||
///
|
||||
|
@ -33,7 +33,7 @@
|
||||
using std::endl;
|
||||
|
||||
MathMacro::MathMacro(MathMacroTemplate const & t)
|
||||
: MathInset(t.numargs(), t.name(), LM_OT_MACRO), tmplate_(&t)
|
||||
: MathInset(t.numargs(), t.name()), tmplate_(&t)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
|
||||
|
||||
MathMacroTemplate::MathMacroTemplate() :
|
||||
MathInset(1, "undefined", LM_OT_MACRO), numargs_(0)
|
||||
MathInset(1, "undefined"), numargs_(0)
|
||||
{}
|
||||
|
||||
|
||||
MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs) :
|
||||
MathInset(1, nm, LM_OT_MACRO), numargs_(numargs)
|
||||
MathInset(1, nm), numargs_(numargs)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -78,12 +78,12 @@ int firstRelOp(MathArray const & array)
|
||||
}
|
||||
|
||||
MathMatrixInset::MathMatrixInset(MathInsetTypes t)
|
||||
: MathGridInset(getCols(t), 1, "formula", t), nonum_(1), label_(1)
|
||||
: MathGridInset(getCols(t), 1, "formula"), objtype_(t), nonum_(1), label_(1)
|
||||
{}
|
||||
|
||||
|
||||
MathMatrixInset::MathMatrixInset()
|
||||
: MathGridInset(1, 1, "formula", LM_OT_SIMPLE), nonum_(1), label_(1)
|
||||
: MathGridInset(1, 1, "formula"), objtype_(LM_OT_SIMPLE), nonum_(1), label_(1)
|
||||
{}
|
||||
|
||||
MathInset * MathMatrixInset::clone() const
|
||||
@ -410,6 +410,20 @@ void MathMatrixInset::glueall()
|
||||
cell(0) = ar;
|
||||
}
|
||||
|
||||
|
||||
MathInsetTypes MathMatrixInset::getType() const
|
||||
{
|
||||
return objtype_;
|
||||
}
|
||||
|
||||
|
||||
void MathMatrixInset::setType(MathInsetTypes t)
|
||||
{
|
||||
objtype_ = t;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MathMatrixInset::mutate(short newtype)
|
||||
{
|
||||
//lyxerr << "mutating from '" << getType() << "' to '" << newtype << "'\n";
|
||||
|
@ -65,7 +65,12 @@ public:
|
||||
///
|
||||
void mutate(short);
|
||||
|
||||
///
|
||||
MathInsetTypes getType() const;
|
||||
|
||||
private:
|
||||
///
|
||||
virtual void setType(MathInsetTypes t);
|
||||
///
|
||||
void validate1(LaTeXFeatures & features);
|
||||
///
|
||||
@ -77,6 +82,8 @@ private:
|
||||
///
|
||||
string nicelabel(int row) const;
|
||||
|
||||
///
|
||||
MathInsetTypes objtype_;
|
||||
///
|
||||
std::vector<int> nonum_;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user