]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.C
fix typo that put too many include paths for most people
[lyx.git] / src / mathed / math_inset.C
index 5d10501998d45fce3f0d0732e468c4107f0d95c3..87af584c5c28098d9a54a4348547f4a58a332f91 100644 (file)
@@ -1,9 +1,9 @@
 /*
  *  File:        math_inset.C
  *  Purpose:     Implementation of insets for mathed
- *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
+ *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
  *  Created:     January 1996
- *  Description: 
+ *  Description:
  *
  *  Dependencies: Xlib, XForms
  *
 #pragma implementation
 #endif
 
+#include <config.h>
+
+#include "Lsstream.h"
 #include "math_inset.h"
 #include "math_scriptinset.h"
+#include "math_mathmlstream.h"
 #include "debug.h"
 
 
-int MathInset::workwidth;
-
-
-MathInset::MathInset()
-       : size_(LM_ST_DISPLAY), xo_(0), yo_(0)
-{}
-
-
-MathInset::~MathInset()
-{}
+using std::ostream;
+using std::vector;
 
 
 int MathInset::height() const
@@ -42,50 +38,15 @@ int MathInset::height() const
 }
 
 
-MathStyles MathInset::size() const
-{
-       return size_;
-}
-
-
-void MathInset::size(MathStyles s) const
+ostream & operator<<(ostream & os, MathInset const & inset)
 {
-       size_ = s;
-}
-
-
-std::ostream & operator<<(std::ostream & os, MathInset const & inset)
-{
-       inset.write(os, false);
+       WriteStream wi(os, false, false);
+       inset.write(wi);
        return os;
 }
 
 
-int MathInset::xo() const
-{
-       return xo_;
-}
-
-
-int MathInset::yo() const
-{
-       return yo_;
-}
-
-
-void MathInset::xo(int x) const
-{
-       xo_ = x;
-}
-
-
-void MathInset::yo(int y) const
-{
-       yo_ = y;
-}
-
-
-int MathInset::nargs() const
+MathInset::size_type MathInset::nargs() const
 {
        return 0;
 }
@@ -93,215 +54,180 @@ int MathInset::nargs() const
 
 MathXArray dummyCell;
 
-MathXArray & MathInset::xcell(int)
+MathXArray & MathInset::xcell(idx_type)
 {
-       lyxerr << "I don't have a cell\n";
+       lyxerr << "I don't have a cell 1\n";
        return dummyCell;
 }
 
 
-MathXArray const & MathInset::xcell(int) const
+MathXArray const & MathInset::xcell(idx_type) const
 {
-       lyxerr << "I don't have a cell\n";
+       lyxerr << "I don't have a cell 2\n";
        return dummyCell;
 }
 
 
-MathArray & MathInset::cell(int)
+MathArray & MathInset::cell(idx_type)
 {
-       lyxerr << "I don't have a cell\n";
+       lyxerr << "I don't have a cell 3\n";
        return dummyCell.data_;
 }
 
 
-MathArray const & MathInset::cell(int) const
+MathArray const & MathInset::cell(idx_type) const
 {
-       lyxerr << "I don't have a cell\n";
+       lyxerr << "I don't have a cell 4\n";
        return dummyCell.data_;
 }
 
 
-void MathInset::substitute(MathMacro const &)
-{}
-
-
-bool MathInset::idxNext(int &, int &) const
+MathInset::idx_type MathInset::index(row_type row, col_type col) const
 {
-       return false;
+       if (row != 0)
+               lyxerr << "illegal row: " << row << "\n";
+       if (col != 0)
+               lyxerr << "illegal col: " << col << "\n";
+       return 0;
 }
 
-
-bool MathInset::idxRight(int &, int &) const
-{
-       return false;
-}
+void MathInset::substitute(MathMacro const &)
+{}
 
 
-bool MathInset::idxPrev(int &, int &) const
+bool MathInset::idxNext(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxLeft(int &, int &) const
+bool MathInset::idxRight(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxUp(int &, int &) const
+bool MathInset::idxPrev(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxDown(int &, int &) const
+bool MathInset::idxLeft(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxFirst(int &, int &) const
+bool MathInset::idxUpDown(idx_type &, bool) const
 {
        return false;
 }
 
 
-bool MathInset::idxLast(int &, int &) const
+bool MathInset::idxFirst(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxHome(int &, int &) const
+bool MathInset::idxLast(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxEnd(int &, int &) const
+bool MathInset::idxHome(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxFirstUp(int &, int &) const
+bool MathInset::idxEnd(idx_type &, pos_type &) const
 {
        return false;
 }
 
 
-bool MathInset::idxFirstDown(int &, int &) const
+void MathInset::normalize(NormalStream & os) const
 {
-       return false;
+       os << "[unknown ";
+       WriteStream wi(os.os(), false, true);
+       write(wi);
+       os << "] ";
 }
 
 
-void MathInset::idxDelete(int &, bool & popit, bool & deleteit)
+void MathInset::dump() const
 {
-       popit    = false;
-       deleteit = false;
+       lyxerr << "---------------------------------------------\n";
+       WriteStream wi(lyxerr, false, true);
+       write(wi);
+       lyxerr << "\n---------------------------------------------\n";
 }
 
 
-void MathInset::idxDeleteRange(int, int)
+void MathInset::validate(LaTeXFeatures &) const
 {}
 
 
-bool MathInset::idxLastUp(int &, int &) const
-{
-       return false;
-}
-
-
-bool MathInset::idxLastDown(int &, int &) const
-{
-       return false;
-}
-
-
-void MathInset::getXY(int & x, int & y) const
-{
-   x = xo();
-   y = yo();
-}
-
-
-/*
-void MathInset::userSetSize(MathStyles sz)
-{
-       if (sz >= 0) {
-               size_ = sz;      
-               flag = flag & ~LMPF_FIXED_SIZE;
-       }
-}
-*/
-
-void MathInset::writeNormal(std::ostream & os) const
+vector<MathInset::idx_type>
+       MathInset::idxBetween(idx_type from, idx_type to) const
 {
-       os << "[unknown] ";
+       vector<idx_type> res;
+       for (idx_type i = from; i <= to; ++i)
+               res.push_back(i);
+       return res;
 }
 
 
-void MathInset::dump() const
+void MathInset::metrics(MathMetricsInfo const &) const
 {
-       lyxerr << "---------------------------------------------\n";
-       write(lyxerr, false);
-       lyxerr << "\n---------------------------------------------\n";
+       lyxerr << "MathInset::metrics() called directly!\n";
 }
 
 
-void MathInset::push_back(unsigned char, MathTextCodes)
+void MathInset::draw(Painter &, int, int) const
 {
-       lyxerr << "can't push without a cell\n";
+       lyxerr << "MathInset::draw() called directly!\n";
 }
 
 
-void MathInset::push_back(MathInset *)
+void MathInset::metricsT(TextMetricsInfo const &) const
 {
-       lyxerr << "can't push without a cell\n";
+       lyxerr << "MathInset::metricsT(Text) called directly!\n";
 }
 
 
-bool MathInset::covers(int x, int y) const
+void MathInset::drawT(TextPainter &, int, int) const
 {
-       //lyxerr << "cover? p: " << this << " x: " << x << " y: " <<  y
-       //      << " xo_: " << xo_ << " yo_: " << yo_  << endl;
-       return
-               x >= xo_ &&
-               x <= xo_ + width() &&
-               y >= yo_ - ascent() &&
-               y <= yo_ + descent();
+       lyxerr << "MathInset::drawT(Text) called directly!\n";
 }
 
 
-void MathInset::validate(LaTeXFeatures &) const
-{}
-
 
-std::vector<int> MathInset::idxBetween(int from, int to) const
+void MathInset::write(WriteStream &) const
 {
-       std::vector<int> res;
-       for (int i = from; i <= to; ++i)
-               res.push_back(i);
-       return res;
+       lyxerr << "MathInset::write() called directly!\n";
 }
 
 
-void MathInset::metrics(MathStyles st) const
+void MathInset::octavize(OctaveStream & os) const
 {
-       lyxerr << "MathInset::metrics() called directly!\n";
-       size_ = st;
+       NormalStream ns(os.os());
+       normalize(ns);
 }
 
 
-void MathInset::draw(Painter &, int, int) const
+void MathInset::maplize(MapleStream & os) const
 {
-       lyxerr << "MathInset::draw() called directly!\n";
+       NormalStream ns(os.os());
+       normalize(ns);
 }
 
 
-void MathInset::write(std::ostream &, bool) const
+void MathInset::mathmlize(MathMLStream & os) const
 {
-       lyxerr << "MathInset::write() called directly!\n";
+       NormalStream ns(os.os());
+       normalize(ns);
 }