X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxrow.h;h=652366abcf4657dfda909758363ef971fb932f74;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=68f229f7fb44ec8268f3e0d33ef544732b75699c;hpb=1829cdef6a34ec623c25ec8967dc048e8f19eee9;p=lyx.git diff --git a/src/lyxrow.h b/src/lyxrow.h index 68f229f7fb..652366abcf 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -4,9 +4,10 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author unknown + * \author Matthias Ettrich + * \author Lars Gullik Bjønnes * - * Full author contact details are available in file CREDITS + * Full author contact details are available in file CREDITS. * * Metrics for an on-screen text row. */ @@ -16,112 +17,74 @@ #include "support/types.h" -class Paragraph; -/// +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(); - - /// - void par(Paragraph * p); - /// - Paragraph * par(); - /// - Paragraph * par() const; /// - void pos(lyx::pos_type p); + Row(pos_type pos); /// - lyx::pos_type pos() const; + void pos(pos_type p); /// - void fill(int f); + pos_type pos() const; /// - int fill() const; + void endpos(pos_type p); /// - void height(unsigned short h); + pos_type endpos() const; /// - unsigned short height() const; + int height() const { return ascent_ + descent_; } /// - void width(unsigned int w); + void width(int w); /// - unsigned int width() const; + int width() const; /// - void ascent_of_text(unsigned short a); + void ascent(int b); /// - unsigned short ascent_of_text() const; + int ascent() const; /// - void top_of_text(unsigned int top); + void descent(int b) { descent_ = b; } /// - unsigned int top_of_text() const; - /// - void baseline(unsigned int b); - /// - unsigned int baseline() const; - /// - void next(Row * r); + 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_; /// - Row * next() const; + int ascent_; /// - void previous(Row * r); + int descent_; /// - Row * previous() const; - - /// return true if this row is the start of a paragraph - bool isParStart() const; - - /// return true if this row is the end of a paragraph - bool isParEnd() const; - - /// return the position of the last character in this row - lyx::pos_type lastPos() const; - /// return the position of the last normal, printable character in this row - lyx::pos_type lastPrintablePos() const; + int width_; +}; - /** - * Returns the number of separators. - * The separator on the very last column doesnt count. - */ - int numberOfSeparators() const; - /** - * Returns the number of hfills. It works like a LaTeX \hfill: - * the hfills at the beginning and at the end are ignored. - * This is much more useful than not to ignore! - */ - int numberOfHfills() const; +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; +}; - /// Returns the number of hfills in the manual label. See numberOfHfills(). - int numberOfLabelHfills() const; - /** - * Returns true if a expansion is needed at the given position. - * Rules are given by LaTeX - */ - bool hfillExpansion(lyx::pos_type pos) const; -private: - /// - Paragraph * par_; - /// - lyx::pos_type pos_; - /** what is missing to a full row can be negative. - Needed for hfills, flushright, block etc. */ - mutable int fill_; - /// - unsigned short height_; - /// - unsigned int width_; - /// ascent from baseline including prelude space - unsigned short ascent_of_text_; - /// the top of the real text in the row - unsigned int top_of_text_; - /// - unsigned int baseline_; - /// - Row * next_; - /// - Row * previous_; -}; +} // namespace lyx #endif