]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrow.C
Alfredo's second patch
[lyx.git] / src / lyxrow.C
index 804cbc7e99517f640363a1a401522f5710e25df1..682186c71f8f118d0ca034a5d689f5b697ed1806 100644 (file)
@@ -1,41 +1,82 @@
-/* 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 "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), width_(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(Paragraph * p)
+void Row::y(unsigned int newy)
+{
+       y_ = newy;
+}
+
+
+unsigned int Row::y() const
 {
-       par_ = p;
+       return y_;
 }
 
 
-void Row::pos(lyx::pos_type p)
+ParagraphList::iterator Row::par()
+{
+       return pit_;
+}
+
+
+ParagraphList::iterator Row::par() const
+{
+       return pit_;
+}
+
+
+unsigned short Row::height() const
+{
+       return height_;
+}
+
+
+void Row::par(ParagraphList::iterator pit)
+{
+       pit_ = pit;
+}
+
+
+void Row::pos(pos_type p)
 {
        pos_ = p;
 }
 
 
-lyx::pos_type Row::pos() const
+pos_type Row::pos() const
 {
        return pos_;
 }
@@ -88,13 +129,13 @@ 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;
@@ -107,19 +148,7 @@ unsigned int Row::baseline() const
 }
 
 
-void Row::next(Row * r)
-{
-       next_ = r;
-}
-
-
-void Row::previous(Row * r)
-{
-       previous_ = r;
-}
-
-
-Row * Row::previous() const
+bool Row::isParStart() const
 {
-       return previous_;
+       return !pos();
 }