]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_inset.C
small stuff
[lyx.git] / src / mathed / math_inset.C
index ade5ec2db17a2c54084614834f5b393cdd9d73e6..9bc23390677907a362a73df3f06b728794f56084 100644 (file)
  *   the GNU General Public Licence version 2 or later.
  */
 
-#include <config.h>
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include "math_iter.h"
 #include "math_inset.h"
-#include "symbol_def.h"
-#include "lyxfont.h"
-#include "mathed/support.h"
-#include "Painter.h"
+#include "debug.h"
 
 
-// Initialize some static class variables.
-int MathedInset::df_asc;
-int MathedInset::df_des;
-int MathedInset::df_width;
-int MathedInset::workWidth;
+int MathInset::workwidth;
 
 
-MathedInset::MathedInset(string const & nm, short ot, short st)
-       : name(nm), objtype(ot), width(0), ascent(0), descent(0), size_(st) 
+MathInset::MathInset()
+       : size_(LM_ST_DISPLAY), xo_(0), yo_(0)
 {}
 
 
-// In a near future maybe we use a better fonts renderer
-void MathedInset::drawStr(Painter & pain, short type, int siz,
-                         int x, int y, string const & s)
+int MathInset::height() const
+{
+       return ascent() + descent();
+}
+
+
+MathStyles MathInset::size() const
+{
+       return size_;
+}
+
+
+void MathInset::size(MathStyles s) const
+{
+       size_ = s;
+}
+
+
+std::ostream & operator<<(std::ostream & os, MathInset const & inset)
 {
-       string st;
-       if (MathIsBinary(type))
-               for (string::const_iterator it = s.begin();
-                    it != s.end(); ++it) {
-                       st += ' ';
-                       st += *it;
-                       st += ' ';
-               }
-       else
-               st = s;
-       
-       LyXFont const mf = mathed_get_font(type, siz);
-       pain.text(x, y, st, mf);
+       inset.write(os, false);
+       return os;
 }
 
 
-int MathedInset::Ascent() const
+int MathInset::xo() const
 {
-       return ascent;
+       return xo_;
 }
 
 
-int MathedInset::Descent() const
+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
+{
+       return 0;
+}
+
+
+MathXArray dummyCell;
+
+MathXArray & MathInset::xcell(int)
 {
-       return descent;
+       lyxerr << "I don't have a cell\n";
+       return dummyCell;
 }
 
 
-int MathedInset::Width() const
+MathXArray const & MathInset::xcell(int) const
 {
-       return width;
+       lyxerr << "I don't have a cell\n";
+       return dummyCell;
 }
 
 
-int MathedInset::Height() const
+MathArray & MathInset::cell(int)
 {
-       return ascent + descent;
+       lyxerr << "I don't have a cell\n";
+       return dummyCell.data_;
 }
 
 
-bool MathedInset::GetLimits() const
+MathArray const & MathInset::cell(int) const
+{
+       lyxerr << "I don't have a cell\n";
+       return dummyCell.data_;
+}
+
+
+void MathInset::substitute(MathArray & array, MathMacro const &) const
+{
+       array.push_back(clone());
+}
+
+
+bool MathInset::idxNext(int &, int &) const
 {
        return false;
 }
 
 
-void MathedInset::SetLimits(bool) {}   
+bool MathInset::idxRight(int &, int &) const
+{
+       return false;
+}
 
 
-string const & MathedInset::GetName() const
+bool MathInset::idxPrev(int &, int &) const
 {
-       return name;
+       return false;
 }
 
 
-short MathedInset::GetType() const
+bool MathInset::idxLeft(int &, int &) const
 {
-       return objtype;
+       return false;
 }
 
 
-short MathedInset::GetStyle() const
+bool MathInset::idxUp(int &, int &) const
 {
-       return size_;
+       return false;
 }
 
 
-void  MathedInset::SetType(short t)
+bool MathInset::idxDown(int &, int &) const
 {
-       objtype = t;
+       return false;
 }
 
 
-void  MathedInset::SetStyle(short st)
+bool MathInset::idxFirst(int &, int &) const
 {
-       size_ = st;
+       return false;
 }
 
 
-void MathedInset::SetName(string const & n)
+bool MathInset::idxLast(int &, int &) const
 {
-       name = n;
+       return false;
 }
 
 
-void MathedInset::defaultAscent(int da)
+bool MathInset::idxHome(int &, int &) const
 {
-       df_asc = da;
+       return false;
 }
 
 
+bool MathInset::idxEnd(int &, int &) const
+{
+       return false;
+}
 
-void MathedInset::defaultDescent(int dd)
+
+bool MathInset::idxFirstUp(int &, int &) const
 {
-       df_des = dd;
+       return false;
+}
+
+
+bool MathInset::idxFirstDown(int &, int &) const
+{
+       return false;
 }
 
 
-void MathedInset::defaultWidth(int dw)
+void MathInset::idxDelete(int &, bool & popit, bool & deleteit)
 {
-       df_width = dw;
+       popit    = false;
+       deleteit = false;
 }
 
+
+void MathInset::idxDeleteRange(int, int)
+{}
+
+
+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
+{
+       os << "[unknown] ";
+}
+
+
+void MathInset::dump() const
+{
+       lyxerr << "---------------------------------------------\n";
+       write(lyxerr, false);
+       lyxerr << "\n---------------------------------------------\n";
+}
+
+
+void MathInset::push_back(unsigned char, MathTextCodes)
+{
+       lyxerr << "can't push without a cell\n";
+}
+
+
+void MathInset::push_back(MathInset *)
+{
+       lyxerr << "can't push without a cell\n";
+}
+
+
+bool MathInset::covers(int x, int y) const
+{
+       return
+               x >= xo_ &&
+               x <= xo_ + width() &&
+               y >= yo_ - ascent() &&
+               y <= yo_ + descent();
+}
+
+
+void MathInset::validate(LaTeXFeatures &) const
+{}
+
+
+std::vector<int> MathInset::idxBetween(int from, int to) const
+{
+       std::vector<int> res;
+       for (int i = from; i <= to; ++i)
+               res.push_back(i);
+       return res;
+}
+
+
+void MathInset::metrics(MathStyles st) const
+{
+       lyxerr << "MathInset::metrics() called directly!\n";
+       size_ = st;
+}
+
+
+void MathInset::draw(Painter &, int, int) const
+{
+       lyxerr << "MathInset::draw() called directly!\n";
+}
+
+
+void MathInset::write(std::ostream &, bool) const
+{
+       lyxerr << "MathInset::write() called directly!\n";
+}