]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrow.C
* lyxrow.[Ch]: add end_ member
[lyx.git] / src / lyxrow.C
index 3dbe39095f9f23fee7db15faa03773d663c1e7fe..40adfda74840f3bb25ce44dd84b84cacde57e842 100644 (file)
@@ -1,46 +1,79 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file lyxrow.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author unknown
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
+ * Full author contact details are available in file CREDITS
  *
- * ====================================================== */
+ * Metrics for an on-screen text row.
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "lyxrow.h"
+#include "debug.h"
+
+using lyx::pos_type;
 
+using std::max;
+using std::min;
 
 Row::Row()
-       : par_(0), pos_(0), fill_(0), height_(0), width_(0),
-         ascent_of_text_(0), baseline_(0), next_(0), previous_(0)
+       : pos_(0), end_(0), fill_(0), height_(0), width_(0), y_(0),
+         ascent_of_text_(0), baseline_(0)
+{}
+
+
+Row::Row(pos_type pos)
+       : pos_(pos), end_(0), fill_(0), height_(0), width_(0), y_(0),
+         ascent_of_text_(0), baseline_(0)
 {}
 
 
-void Row::par(Paragraph * p)
+void Row::y(unsigned int newy)
+{
+       y_ = newy;
+}
+
+
+unsigned int Row::y() const
+{
+       return y_;
+}
+
+
+unsigned short Row::height() const
 {
-       par_ = p;
+       return height_;
 }
 
 
-void Row::pos(lyx::pos_type p)
+void Row::pos(pos_type p)
 {
        pos_ = p;
 }
 
 
-lyx::pos_type Row::pos() const
+pos_type Row::pos() const
 {
        return pos_;
 }
 
 
+void Row::end(pos_type p)
+{
+       end_ = p;
+}
+
+
+pos_type Row::end() const
+{
+       return end_;
+}
+
+
 void Row::fill(int f)
 {
        fill_ = f;
@@ -83,6 +116,18 @@ unsigned short Row::ascent_of_text() const
 }
 
 
+void Row::top_of_text(unsigned int top)
+{
+       top_of_text_ = top;
+}
+
+
+unsigned int Row::top_of_text() const
+{
+       return top_of_text_;
+}
+
+
 void Row::baseline(unsigned int b)
 {
        baseline_ = b;
@@ -95,19 +140,19 @@ unsigned int Row::baseline() const
 }
 
 
-void Row::next(Row * r)
+bool Row::isParStart() const
 {
-       next_ = r;
+       return !pos();
 }
 
 
-void Row::previous(Row * r)
+void Row::dump(const char * s) const
 {
-       previous_ = r;
+       lyxerr << s << " pos: " << pos_ << " width: " << width_
+               << " height: " << height_
+               << " fill: " << fill_
+               << " ascent_of_text: " << ascent_of_text_
+               << " top_of_text: " << top_of_text_
+               << " y: " << y_ << std::endl;
 }
 
-
-Row * Row::previous() const
-{
-       return previous_;
-}