]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrow.h
fix typo in commit 16925
[lyx.git] / src / lyxrow.h
index 4909a3dcddea1b3feeb268c327488518e41ce32a..652366abcf4657dfda909758363ef971fb932f74 100644 (file)
@@ -1,43 +1,90 @@
 // -*- C++ -*-
-/* This file is part of
- * ====================================================== 
- * 
- *           LyX, The Document Processor
- *      
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+/**
+ * \file lyxrow.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ====================================================== */
+ * \author Matthias Ettrich
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ *
+ * Metrics for an on-screen text row.
+ */
 
 #ifndef LYXROW_H
 #define LYXROW_H
 
-#include "lyxparagraph.h"
+#include "support/types.h"
+
 
-///
-struct Row {
+namespace lyx {
+
+/**
+ * An on-screen row of text. A paragraph is broken into a
+ * RowList for display. Each Row contains position pointers
+ * into the first and last character positions of that row.
+ */
+class Row {
+public:
+       ///
+       Row();
        ///
-       LyXParagraph * par;
+       Row(pos_type pos);
        ///
-       LyXParagraph::size_type pos;
-       /** what is missing to a full row can be negative.
-         Needed for hfills, flushright, block etc. */
-       mutable int fill;
+       void pos(pos_type p);
        ///
-       unsigned short  height;
+       pos_type pos() const;
        ///
-       unsigned short ascent_of_text;
+       void endpos(pos_type p);
        ///
-       unsigned int  baseline;
+       pos_type endpos() const;
        ///
-       Row()
-               : par(0), pos(0), fill(0), height(0),
-                 ascent_of_text(0), baseline(0), next(0), previous(0)
-               {}
+       int height() const { return ascent_ + descent_; }
        ///
-       Row * next;
+       void width(int w);
        ///
-       Row * previous;
+       int width() const;
+       ///
+       void ascent(int b);
+       ///
+       int ascent() const;
+       ///
+       void descent(int b) { descent_ = b; }
+       ///
+       int descent() const { return descent_; }
+       /// current debugging only
+       void dump(const char * = "") const;
+
+private:
+       /// first pos covered by this row
+       pos_type pos_;
+       /// one behind last pos covered by this row
+       pos_type end_;
+       ///
+       int ascent_;
+       ///
+       int descent_;
+       ///
+       int width_;
 };
 
+
+class RowMetrics {
+public:
+       RowMetrics();
+       /// width of a separator (i.e. space)
+       double separator;
+       /// width of hfills in the body
+       double hfill;
+       /// width of hfills in the label
+       double label_hfill;
+       /// the x position of the row
+       double x;
+};
+
+
+
+} // namespace lyx
+
 #endif