X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxrow.h;h=652366abcf4657dfda909758363ef971fb932f74;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=7339c889595e10aa414bebcc4968ebcdb5a08c6b;hpb=50a25e9a76d753f5229b4fca1076e242a99af467;p=lyx.git diff --git a/src/lyxrow.h b/src/lyxrow.h index 7339c88959..652366abcf 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -1,117 +1,90 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file lyxrow.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor + * \author Matthias Ettrich + * \author Lars Gullik Bjønnes * - * 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. + */ #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); + 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 baseline(unsigned int b); + void descent(int b) { descent_ = b; } /// - unsigned int baseline() const; - /// - void next(Row * r); - /// - Row * next() const; - /// - void previous(Row * r); - /// - 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_; + int ascent_; /// - lyx::pos_type pos_; - /** what is missing to a full row can be negative. - Needed for hfills, flushright, block etc. */ - mutable int fill_; + int descent_; /// - unsigned short height_; - /// - unsigned int width_; - /// - unsigned short ascent_of_text_; - /// - unsigned int baseline_; - /// - Row * next_; - /// - 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