-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2000 The LyX Team.
+/**
+ * \file lyxrow.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * ====================================================== */
+ * \author unknown
+ *
+ * Full author contact details are available in file CREDITS
+ *
+ * Metrics for an on-screen text row.
+ */
#include <config.h>
#include "lyxrow.h"
+#include "paragraph.h"
+#include "layout.h"
+#include "lyxlayout.h"
+
+using lyx::pos_type;
+using std::max;
+using std::min;
Row::Row()
- : par_(0), pos_(0), fill_(0), height_(0),
- ascent_of_text_(0), baseline_(0), next_(0), previous_(0)
+ : pos_(0), fill_(0), height_(0), width_(0), y_(0),
+ ascent_of_text_(0), baseline_(0)
+{}
+
+
+Row::Row(ParagraphList::iterator pit, pos_type po)
+ : pit_(pit), pos_(po), fill_(0), height_(0), width_(0), y_(0),
+ ascent_of_text_(0), baseline_(0)
{}
-void Row::par(LyXParagraph * p)
+void Row::y(unsigned int newy)
+{
+ y_ = newy;
+}
+
+
+unsigned int Row::y() const
{
- par_ = p;
+ return y_;
}
-LyXParagraph * Row::par()
+ParagraphList::iterator Row::par()
+{
+ return pit_;
+}
+
+
+ParagraphList::iterator Row::par() const
+{
+ return pit_;
+}
+
+
+unsigned short Row::height() const
{
- return par_;
+ return height_;
}
-LyXParagraph * Row::par() const
+void Row::par(ParagraphList::iterator pit)
{
- return par_;
+ pit_ = pit;
}
-void Row::pos(LyXParagraph::size_type p)
+void Row::pos(pos_type p)
{
pos_ = p;
}
-LyXParagraph::size_type Row::pos() const
+pos_type Row::pos() const
{
return pos_;
}
}
-unsigned short Row::height() const
+void Row::width(unsigned int w)
{
- return height_;
+ width_ = w;
}
-void Row::ascent_of_text(unsigned short a)
+unsigned int Row::width() const
{
- ascent_of_text_ = a;
+ return width_;
}
-unsigned short Row::ascent_of_text() const
+void Row::ascent_of_text(unsigned short a)
{
- return ascent_of_text_;
+ ascent_of_text_ = a;
}
-void Row::baseline(unsigned int b)
+unsigned short Row::ascent_of_text() const
{
- baseline_ = b;
+ return ascent_of_text_;
}
-unsigned int Row::baseline() const
+void Row::top_of_text(unsigned int top)
{
- return baseline_;
+ top_of_text_ = top;
}
-void Row::next(Row * r)
+unsigned int Row::top_of_text() const
{
- next_ = r;
+ return top_of_text_;
}
-Row * Row::next() const
+void Row::baseline(unsigned int b)
{
- return next_;
+ baseline_ = b;
}
-void Row::previous(Row * r)
+unsigned int Row::baseline() const
{
- previous_ = r;
+ return baseline_;
}
-Row * Row::previous() const
+bool Row::isParStart() const
{
- return previous_;
+ return !pos();
}