]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.h
Account for old versions of Pygments
[lyx.git] / src / BufferView.h
index f57801f6a3bc6c7335e4fbc3944f943429b85e24..92e898735065ac2f8146fbb7b14fd8a3f43fac80 100644 (file)
@@ -16,6 +16,7 @@
 #define BUFFER_VIEW_H
 
 #include "DocumentClassPtr.h"
+#include "TexRow.h"
 #include "update_flags.h"
 
 #include "support/strfwd.h"
@@ -40,6 +41,7 @@ class FuncRequest;
 class FuncStatus;
 class Intl;
 class Inset;
+class Length;
 class PainterInfo;
 class ParIterator;
 class ParagraphMetrics;
@@ -57,15 +59,15 @@ enum CursorStatus {
 /// Scrollbar Parameters.
 struct ScrollbarParameters
 {
+       // These parameters are normalized against the screen geometry and pixel
+       // coordinates. Position 0 corresponds to the top the the screen.
        ScrollbarParameters()
-               : min(0), max(0), position(0), single_step(1), page_step(1)
+               : min(0), max(0), single_step(1), page_step(1)
        {}
        /// Minimum scrollbar position in pixels.
        int min;
        /// Maximum scrollbar position in pixels.
        int max;
-       /// Current position in the document in pixels.
-       int position;
        /// Line-scroll amount in pixels.
        int single_step;
        /// Page-scroll amount in pixels.
@@ -104,6 +106,14 @@ public:
        /// left margin
        int leftMargin() const;
 
+       /// return the on-screen size of this length
+       /*
+        *  This is a wrapper around Length::inPixels that uses the
+        *  bufferview width as width and the EM value of the default
+        *  document font.
+        */
+       int inPixels(Length const & len) const;
+
        /// \return true if the BufferView is at the top of the document.
        bool isTopScreen() const;
 
@@ -162,9 +172,9 @@ public:
        void gotoLabel(docstring const & label);
 
        /// set the cursor based on the given TeX source row.
-       void setCursorFromRow(int row);
-       ///
-       void setCursorFromRow(int row, TexRow const & texrow);
+       bool setCursorFromRow(int row);
+       /// set the cursor based on the given start and end TextEntries.
+       bool setCursorFromEntries(TexRow::TextEntry start, TexRow::TextEntry end);
 
        /// set cursor to the given inset. Return true if found.
        bool setCursorFromInset(Inset const *);
@@ -249,6 +259,8 @@ public:
        /// sets cursor.
        /// This will also open all relevant collapsable insets.
        void setCursor(DocIterator const &);
+       /// set the selection up to dit.
+       void setCursorSelectionTo(DocIterator const & dit);
        /// Check deleteEmptyParagraphMechanism and update metrics if needed.
        /// \retval true if an update was needed.
        bool checkDepm(Cursor & cur, Cursor & old);