X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxrow.h;h=652366abcf4657dfda909758363ef971fb932f74;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=ac71a2d6615b6b56c1781d4bed02085b52d45103;hpb=10f096880fec5afc402fc0910ff44220de0398c9;p=lyx.git diff --git a/src/lyxrow.h b/src/lyxrow.h index ac71a2d661..652366abcf 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -1,116 +1,90 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 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 -#ifdef __GNUG__ -#pragma interface -#endif - #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); - /// - lyx::pos_type pos() const; - /// - void fill(int f); - /// - int fill() const; - /// - void height(unsigned short h); + Row(pos_type pos); /// - unsigned short height() const; + void pos(pos_type p); /// - void width(unsigned int w); + pos_type pos() const; /// - unsigned int width() const; + void endpos(pos_type p); /// - void ascent_of_text(unsigned short a); + pos_type endpos() const; /// - unsigned short ascent_of_text() const; + int height() const { return ascent_ + descent_; } /// - void baseline(unsigned int b); + void width(int w); /// - unsigned int baseline() const; + int width() const; /// - void next(Row * r); + void ascent(int b); /// - Row * next() const; + int ascent() const; /// - void previous(Row * r); + void descent(int b) { descent_ = b; } /// - Row * previous() const; + 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_; /// - 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_; - /// - unsigned short ascent_of_text_; - /// - unsigned int baseline_; + int ascent_; /// - Row * next_; + int descent_; /// - Row * previous_; + int width_; }; -inline -Paragraph * Row::par() -{ - return par_; -} - - -inline -Paragraph * Row::par() const -{ - return par_; -} - +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; +}; -inline -unsigned short Row::height() const -{ - return height_; -} -inline -Row * Row::next() const -{ - return next_; -} +} // namespace lyx #endif