1999-09-27 18:44:28 +00:00
|
|
|
/*
|
|
|
|
* File: math_inset.C
|
|
|
|
* Purpose: Implementation of insets for mathed
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
* Created: January 1996
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Dependencies: Xlib, XForms
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright: 1996, 1997 Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* Version: 0.8beta.
|
|
|
|
*
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
2001-02-13 13:28:32 +00:00
|
|
|
#pragma implementation
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
#include <config.h>
|
2001-11-07 08:51:35 +00:00
|
|
|
|
2001-11-07 10:25:05 +00:00
|
|
|
#include "Lsstream.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "math_inset.h"
|
2001-09-11 10:58:17 +00:00
|
|
|
#include "math_scriptinset.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "debug.h"
|
2001-02-13 13:28:32 +00:00
|
|
|
|
2001-02-28 11:56:36 +00:00
|
|
|
|
2001-08-08 17:26:30 +00:00
|
|
|
MathInset::MathInset()
|
2001-02-28 11:56:36 +00:00
|
|
|
{}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-24 22:14:46 +00:00
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
MathInset::~MathInset()
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
int MathInset::height() const
|
2001-02-15 12:22:01 +00:00
|
|
|
{
|
2001-08-03 17:55:10 +00:00
|
|
|
return ascent() + descent();
|
2001-02-15 12:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
std::ostream & operator<<(std::ostream & os, MathInset const & inset)
|
|
|
|
{
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream wi(0, os, false);
|
2001-10-19 11:25:48 +00:00
|
|
|
inset.write(wi);
|
2001-06-25 00:06:33 +00:00
|
|
|
return os;
|
2001-02-15 12:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
MathInset::size_type MathInset::nargs() const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return 0;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-03 17:10:22 +00:00
|
|
|
MathXArray dummyCell;
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
MathXArray & MathInset::xcell(idx_type)
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-10-24 18:29:55 +00:00
|
|
|
lyxerr << "I don't have a cell 1\n";
|
2001-08-03 17:10:22 +00:00
|
|
|
return dummyCell;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
MathXArray const & MathInset::xcell(idx_type) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-10-24 18:29:55 +00:00
|
|
|
lyxerr << "I don't have a cell 2\n";
|
2001-08-03 17:10:22 +00:00
|
|
|
return dummyCell;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
MathArray & MathInset::cell(idx_type)
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-10-24 18:29:55 +00:00
|
|
|
lyxerr << "I don't have a cell 3\n";
|
2001-08-03 17:10:22 +00:00
|
|
|
return dummyCell.data_;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
MathArray const & MathInset::cell(idx_type) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-10-24 18:29:55 +00:00
|
|
|
lyxerr << "I don't have a cell 4\n";
|
2001-08-03 17:10:22 +00:00
|
|
|
return dummyCell.data_;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-09-11 15:46:51 +00:00
|
|
|
void MathInset::substitute(MathMacro const &)
|
|
|
|
{}
|
2001-06-25 00:06:33 +00:00
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxNext(idx_type &, pos_type &) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-02-15 12:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxRight(idx_type &, pos_type &) const
|
2001-07-06 12:09:32 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-07-06 12:09:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxPrev(idx_type &, pos_type &) const
|
2001-02-15 12:22:01 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-02-15 12:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxLeft(idx_type &, pos_type &) const
|
2001-07-06 12:09:32 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-07-06 12:09:32 +00:00
|
|
|
}
|
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxUp(idx_type &, pos_type &) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2001-02-15 12:22:01 +00:00
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxDown(idx_type &, pos_type &) const
|
2001-02-15 12:22:01 +00:00
|
|
|
{
|
2001-06-25 00:06:33 +00:00
|
|
|
return false;
|
2001-02-15 12:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxFirst(idx_type &, pos_type &) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-11-15 09:51:57 +00:00
|
|
|
bool MathInset::idxFirstUp(idx_type &, pos_type &) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathInset::idxFirstDown(idx_type &, pos_type &) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxLast(idx_type &, pos_type &) const
|
2001-02-15 12:22:01 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-02-15 12:22:01 +00:00
|
|
|
}
|
|
|
|
|
2001-03-01 19:57:01 +00:00
|
|
|
|
2001-11-15 09:51:57 +00:00
|
|
|
bool MathInset::idxLastUp(idx_type &, pos_type &) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathInset::idxLastDown(idx_type &, pos_type &) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxHome(idx_type &, pos_type &) const
|
2001-03-01 19:57:01 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-03-01 19:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
bool MathInset::idxEnd(idx_type &, pos_type &) const
|
2001-03-01 19:57:01 +00:00
|
|
|
{
|
2001-08-03 17:10:22 +00:00
|
|
|
return false;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
void MathInset::idxDelete(idx_type &, bool & popit, bool & deleteit)
|
2001-06-27 14:10:35 +00:00
|
|
|
{
|
2001-07-09 16:59:57 +00:00
|
|
|
popit = false;
|
|
|
|
deleteit = false;
|
2001-06-27 14:10:35 +00:00
|
|
|
}
|
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
void MathInset::idxDeleteRange(idx_type, idx_type)
|
2001-07-16 15:53:25 +00:00
|
|
|
{}
|
|
|
|
|
2001-06-27 14:10:35 +00:00
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathInset::normalize(NormalStream & os) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-10-18 13:21:21 +00:00
|
|
|
os << "[unknown ";
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream wi(0, os.os_, false);
|
2001-10-19 11:25:48 +00:00
|
|
|
write(wi);
|
2001-10-18 13:21:21 +00:00
|
|
|
os << "] ";
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathInset::dump() const
|
|
|
|
{
|
|
|
|
lyxerr << "---------------------------------------------\n";
|
2001-11-09 08:35:57 +00:00
|
|
|
WriteStream wi(0, lyxerr, false);
|
2001-10-19 11:25:48 +00:00
|
|
|
write(wi);
|
2001-08-03 17:10:22 +00:00
|
|
|
lyxerr << "\n---------------------------------------------\n";
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-07 08:51:35 +00:00
|
|
|
bool MathInset::covers(int, int) const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-10-24 09:16:06 +00:00
|
|
|
lyxerr << "MathInset::covers() called directly!\n";
|
|
|
|
return false;
|
2001-06-25 00:06:33 +00:00
|
|
|
}
|
2001-07-13 14:54:56 +00:00
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-08-03 17:10:22 +00:00
|
|
|
void MathInset::validate(LaTeXFeatures &) const
|
|
|
|
{}
|
2001-07-16 15:53:25 +00:00
|
|
|
|
2001-08-03 09:54:48 +00:00
|
|
|
|
2001-09-26 16:52:34 +00:00
|
|
|
std::vector<MathInset::idx_type>
|
|
|
|
MathInset::idxBetween(idx_type from, idx_type to) const
|
2001-07-16 15:53:25 +00:00
|
|
|
{
|
2001-09-26 16:52:34 +00:00
|
|
|
std::vector<idx_type> res;
|
|
|
|
for (idx_type i = from; i <= to; ++i)
|
2001-07-16 15:53:25 +00:00
|
|
|
res.push_back(i);
|
|
|
|
return res;
|
|
|
|
}
|
2001-08-03 09:54:48 +00:00
|
|
|
|
|
|
|
|
2001-10-22 15:37:49 +00:00
|
|
|
void MathInset::metrics(MathMetricsInfo const &) const
|
2001-08-03 17:55:10 +00:00
|
|
|
{
|
2001-08-07 08:40:14 +00:00
|
|
|
lyxerr << "MathInset::metrics() called directly!\n";
|
2001-08-03 17:55:10 +00:00
|
|
|
}
|
2001-08-06 17:20:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
void MathInset::draw(Painter &, int, int) const
|
|
|
|
{
|
|
|
|
lyxerr << "MathInset::draw() called directly!\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathInset::write(WriteStream &) const
|
2001-08-06 17:20:26 +00:00
|
|
|
{
|
|
|
|
lyxerr << "MathInset::write() called directly!\n";
|
|
|
|
}
|
2001-11-07 08:51:35 +00:00
|
|
|
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
void MathInset::octavize(OctaveStream & os) const
|
2001-11-07 08:51:35 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
NormalStream ns(os.os_);
|
2001-11-09 08:35:57 +00:00
|
|
|
normalize(ns);
|
2001-11-07 08:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
void MathInset::maplize(MapleStream & os) const
|
2001-11-07 08:51:35 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
NormalStream ns(os.os_);
|
2001-11-09 08:35:57 +00:00
|
|
|
normalize(ns);
|
2001-11-07 08:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
void MathInset::mathmlize(MathMLStream & os) const
|
2001-11-07 08:51:35 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
NormalStream ns(os.os_);
|
2001-11-09 08:35:57 +00:00
|
|
|
normalize(ns);
|
2001-11-07 08:51:35 +00:00
|
|
|
}
|