]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.h
Amend 6c3447c8: FindAdv: sometimes a space is added on some math symbols
[lyx.git] / src / Cursor.h
index ba353b6cb8ad247d14fb52004d7d74ad6d45498b..094a540f24e1dbb6c18609817b7db9a36b9c147f 100644 (file)
@@ -118,7 +118,7 @@ public:
        ///
        void setWordSelection(bool set) { word_selection_ = set; }
        ///
-       bool wordSelection() { return word_selection_; }
+       bool wordSelection() const { return word_selection_; }
        /// did we place the anchor?
        bool mark() const { return mark_; }
        /// did we place the anchor?
@@ -131,12 +131,13 @@ public:
        void clearSelection();
        /// check whether selection contains specific type of inset
        /// returns 0 if no selection was made
-       bool insetInSelection(InsetCode const & inset);
+       bool insetInSelection(InsetCode const & inset) const;
        /// count occurences of specific inset type in the selection
        /// returns 0 if no selection was made
-       int countInsetsInSelection(InsetCode const & inset);
+       int countInsetsInSelection(InsetCode const & inset) const;
 
        /// access to normalized selection anchor
+       // FIXME: this should return a full DocIterator
        CursorSlice normalAnchor() const;
        /// access to real selection anchor
        DocIterator const & realAnchor() const { return anchor_; }
@@ -190,7 +191,7 @@ public:
        /// containing the cursor
        void recordUndo(UndoKind kind = ATOMIC_UNDO) const;
        /// Convenience: prepare undo for the inset containing the cursor
-       void recordUndoInset(Inset const * inset = 0) const;
+       void recordUndoInset(Inset const * inset = nullptr) const;
        /// Convenience: prepare undo for the whole buffer
        void recordUndoFullBuffer() const;
        /// Convenience: prepare undo for buffer parameters
@@ -207,7 +208,7 @@ public:
        DocIterator newWord() const { return new_word_; }
 
        /// are we in math mode (2), text mode (1) or unsure (0)?
-       int currentMode();
+       int currentMode() const;
 
        /// Return true if the next or previous inset has confirmDeletion depending
        /// on the boolean before. If there is a selection, return true if at least
@@ -270,14 +271,14 @@ public:
        void setCursorData(CursorData const & data);
 
        /// returns true if we made a decision
-       bool getStatus(FuncRequest const & cmd, FuncStatus & flag) const;
+       bool getStatus(FuncRequest const & cmd, FuncStatus & status) const;
        /// dispatch from innermost inset upwards
        void dispatch(FuncRequest const & cmd);
        /// display a message
        void message(docstring const & msg) const;
        /// display an error message
        void errorMessage(docstring const & msg) const;
-       /// get the resut of the last dispatch
+       /// get the result of the last dispatch
        DispatchResult const & result() const;
 
        /// Set the cursor language from current input method language
@@ -286,7 +287,7 @@ public:
         * or partial match with the whole list of languages.
         */
        void setLanguageFromInput();
-       /// Set the current font of the cursor from its location. 
+       /// Set the current font of the cursor from its location.
        void setCurrentFont();
 
        /**
@@ -380,6 +381,12 @@ public:
        void setTargetX();
        /// clear targetX, i.e. set it to -1
        void clearTargetX();
+       /// return x position of latest mouse press or -1 if unset
+       int xClickPos() const { return x_clickpos_; }
+       /// return y position of latest mouse press or -1 if unset
+       int yClickPos() const { return y_clickpos_; }
+       /// register mouse press coordinates
+       void setClickPos(int x, int y);
        /// set offset to actual position - targetX
        void updateTextTargetOffset();
        /// distance between actual and targeted position during last up/down in text
@@ -469,6 +476,9 @@ private:
        int x_target_;
        /// if a x_target cannot be hit exactly in a text, put the difference here
        int textTargetOffset_;
+       /// Exact position of mouse click
+       int x_clickpos_;
+       int y_clickpos_;
        /// position before dispatch started
        DocIterator beforeDispatchCursor_;
        /// cursor screen coordinates before dispatch started
@@ -496,9 +506,8 @@ public:
        /// return true if fullscreen update is needed
        bool down();
        /// move up/down in a text inset, called for LFUN_UP/DOWN,
-       /// return true if successful, updateNeeded set to true if fullscreen
-       /// update is needed, otherwise it's not touched
-       bool upDownInText(bool up, bool & updateNeeded);
+       /// return true if fullscreen update is needed
+       bool upDownInText(bool up);
        /// move up/down in math or any non text inset, call for LFUN_UP/DOWN
        /// return true if successful
        bool upDownInMath(bool up);