X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FRow.h;h=f053b4c5a9913106237a17143cdbab07b9519917;hb=2f271f61bcd514da3ab5b44d2b7bf61e12ac0c44;hp=5b67abba5e463d655edfbb3b3dcf621c5db91634;hpb=26f336769af8dd5c48c2c0241cd3fbfc50a3c65e;p=lyx.git diff --git a/src/Row.h b/src/Row.h index 5b67abba5e..f053b4c5a9 100644 --- a/src/Row.h +++ b/src/Row.h @@ -22,6 +22,8 @@ namespace lyx { +class DocIterator; + /** * An on-screen row of text. A paragraph is broken into a * RowList for display. Each Row contains position pointers @@ -38,10 +40,20 @@ public: /// void setChanged(bool c) { changed_ = c; } /// - void setCrc(size_type crc); - /// - void setSelection(pos_type sel_beg, pos_type sel_end); - + void setCrc(size_type crc) const; + /// Set the selection begin and end. + /** + * This is const because we update the selection status only at draw() + * time. + */ + void setSelection(pos_type sel_beg, pos_type sel_end) const; + /// + bool selection() const; + /// Set the selection begin and end and whether the left and/or right + /// margins are selected. + void setSelectionAndMargins(DocIterator const & beg, + DocIterator const & end) const; + /// void pos(pos_type p); /// @@ -68,21 +80,33 @@ public: /// 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; /// - pos_type sel_beg; + mutable pos_type sel_beg; + /// + mutable pos_type sel_end; /// - pos_type sel_end; + mutable bool left_margin_sel; + /// + mutable bool right_margin_sel; + private: + /// Decides whether the margin is selected. + /** + * \param margin_begin + * \param beg + * \param end + */ + bool isMarginSelected(bool left_margin, DocIterator const & beg, + DocIterator const & end) const; + /// has the Row appearance changed since last drawing? - bool changed_; + mutable bool changed_; /// CRC of row contents. - size_type crc_; + mutable size_type crc_; /// first pos covered by this row pos_type pos_; /// one behind last pos covered by this row