]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.C
new LFUN_MOUSE_(PRESS|MOTION|RELEASE)
[lyx.git] / src / mathed / math_inset.C
index 6d0e9cda0e56cacf9cffd9f36464f66f72cd21a5..f075e4654c53bc689ec2c13e3344ede477e99765 100644 (file)
@@ -46,66 +46,42 @@ int MathInset::height() const
 
 
 ostream & operator<<(ostream & os, MathAtom const & at)
-{
-       if (at.nucleus())
-               os << *(at.nucleus());
-       else
-               os << "(nil)";
-       return os;
-}
-
-
-ostream & operator<<(ostream & os, MathInset const & inset)
 {
        WriteStream wi(os, false, false);
-       inset.write(wi);
+       at->write(wi);
        return os;
 }
 
+
 MathInset::size_type MathInset::nargs() const
 {
        return 0;
 }
 
 
-void MathInset::dimensions(Dimension & dim) const
+Dimension MathInset::dimensions() const
 {
-       dim.w = width();
-       dim.a = ascent();
-       dim.d = descent();
+       lyxerr << "call MathInset::dimensions()\n";
+       return Dimension(width(), ascent(), descent());
 }
 
 
-MathXArray dummyCell;
+MathArray dummyCell;
 
-MathXArray & MathInset::xcell(idx_type)
+MathArray & MathInset::cell(idx_type)
 {
        lyxerr << "I don't have a cell 1\n";
        return dummyCell;
 }
 
 
-MathXArray const & MathInset::xcell(idx_type) const
+MathArray const & MathInset::cell(idx_type) const
 {
        lyxerr << "I don't have a cell 2\n";
        return dummyCell;
 }
 
 
-MathArray & MathInset::cell(idx_type)
-{
-       lyxerr << "I don't have a cell 3\n";
-       return dummyCell.data();
-}
-
-
-MathArray const & MathInset::cell(idx_type) const
-{
-       lyxerr << "I don't have a cell 4\n";
-       return dummyCell.data();
-}
-
-
 MathInset::idx_type MathInset::index(row_type row, col_type col) const
 {
        if (row != 0)
@@ -143,7 +119,7 @@ bool MathInset::idxLeft(idx_type &, pos_type &) const
 }
 
 
-bool MathInset::idxUpDown(idx_type &, pos_type &, bool) const
+bool MathInset::idxUpDown(idx_type &, pos_type &, bool, int) const
 {
        return false;
 }
@@ -180,15 +156,6 @@ void MathInset::getPos(idx_type, pos_type, int & x, int & y) const
 }
 
 
-void MathInset::normalize(NormalStream & os) const
-{
-       os << "[unknown ";
-       WriteStream wi(os.os(), false, true);
-       write(wi);
-       os << "] ";
-}
-
-
 void MathInset::dump() const
 {
        lyxerr << "---------------------------------------------\n";
@@ -198,17 +165,9 @@ void MathInset::dump() const
 }
 
 
-void MathInset::validate(LaTeXFeatures &) const
-{}
-
-
-vector<MathInset::idx_type>
-       MathInset::idxBetween(idx_type from, idx_type to) const
+bool MathInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
 {
-       vector<idx_type> res;
-       for (idx_type i = from; i <= to; ++i)
-               res.push_back(i);
-       return res;
+       return from <= idx && idx <= to;
 }
 
 
@@ -224,6 +183,13 @@ void MathInset::draw(MathPainterInfo &, int, int) const
 }
 
 
+void MathInset::drawSelection(MathPainterInfo &,
+       idx_type, pos_type, idx_type, pos_type) const
+{
+       lyxerr << "MathInset::drawSelection() called directly!\n";
+}
+
+
 void MathInset::metricsT(TextMetricsInfo const &) const
 {
 #ifdef WITH_WARNINGS
@@ -241,9 +207,15 @@ void MathInset::drawT(TextPainter &, int, int) const
 
 
 
-void MathInset::write(WriteStream &) const
+void MathInset::write(WriteStream & os) const
 {
-       lyxerr << "MathInset::write() called directly!\n";
+       os << '\\' << name().c_str() << ' ';
+}
+
+
+void MathInset::normalize(NormalStream & os) const
+{
+       os << '[' << name().c_str() << "] ";
 }
 
 
@@ -293,22 +265,22 @@ int MathInset::docbook(std::ostream &, bool) const
 }
 
 
-int MathInset::dispatch(string const &, idx_type, pos_type) 
+int MathInset::dispatch(FuncRequest const &, idx_type, pos_type) 
 {
        return 0; // undispatched
 }
 
 
-std::vector<string> MathInset::getLabelList() const
+string const & MathInset::getType() const
 {
-       return std::vector<string>();
+       static string t("none");
+       return t;
 }
 
 
-string const & MathInset::getType() const
+string MathInset::name() const
 {
-       static string t("none");
-       return t;
+       return "unknown";
 }