X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCursor.h;h=f5490479851b8322f7b095d0bf4ae6ce0c3d152b;hb=3bf1b97ae547aea5d0243e41b2d8af463a6e40c5;hp=dcce84920a43a6904aedf1c72a282cecf35f745a;hpb=86398b5d9135b05d368a0a4af45510d6d0827ac0;p=features.git diff --git a/src/Cursor.h b/src/Cursor.h index dcce84920a..f549047985 100644 --- a/src/Cursor.h +++ b/src/Cursor.h @@ -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,10 +131,10 @@ 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 CursorSlice normalAnchor() const; @@ -154,27 +154,19 @@ public: DocIterator selectionEnd() const; /// - docstring selectionAsString(bool with_label) const; + docstring selectionAsString(bool const with_label, + bool const skipdelete = false) const; /// get some interesting description of top position void info(odocstream & os, bool devel_mode) const; /// docstring currentState(bool devel_mode) const; - /// auto-correct mode - bool autocorrect() const { return autocorrect_; } - /// auto-correct mode - bool & autocorrect() { return autocorrect_; } - /// fix cursor in circumstances that should never happen. /// \retval true if a fix occurred. bool fixIfBroken(); /// Repopulate the slices insets from bottom to top. Useful /// for stable iterators or Undo data. void sanitize(); - /// - bool isInside(Inset const *) const; - /// make sure we are outside of given inset - void leaveInset(Inset const & inset); /// bool undoAction(); @@ -187,6 +179,8 @@ public: void beginUndoGroup() const; /// end the current undo group void endUndoGroup() const; + /// end abruptly the current group and create a new one wih the same nesting level + void splitUndoGroup() const; /// The general case: prepare undo for an arbitrary range. void recordUndo(pit_type from, pit_type to) const; @@ -196,7 +190,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 @@ -213,7 +207,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 @@ -240,14 +234,13 @@ private: // // math specific stuff that could be promoted to "global" later // - /// do we allow autocorrection - bool autocorrect_; // FIXME: make them private public: - /// the current font settings + /// The current font settings. This holds the settings for output. Font current_font; - /// the current font + /// The current display font. This holds the settings of the text + /// in the workarea. Font real_current_font; }; @@ -263,6 +256,10 @@ public: void push(Inset & inset); /// add a new cursor slice, place cursor at front (move backwards) void pushBackward(Inset & inset); + /// try to put cursor in inset before it in entry cell, or next one + /// if it is not empty, or exit the slice if there is no next one. + void editInsertedInset(); + /// pop one level off the cursor void pop(); /// pop one slice off the cursor stack and go backwards @@ -273,17 +270,23 @@ 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 + /* Considers first exact math with the codes used in the document, + * then approximate match among the same list, and finally exact + * or partial match with the whole list of languages. + */ + void setLanguageFromInput(); + /// Set the current font of the cursor from its location. void setCurrentFont(); /** @@ -521,13 +524,9 @@ public: /// the name of the macro we are currently inputting docstring macroName(); - /// replace selected stuff with at, placing the former // selection in entry cell of atom void handleNest(MathAtom const & at); - /// replace selected stuff with at, placing the former - // selection in given cell of atom - void handleNest(MathAtom const & at, int cell); /// make sure cursor position is valid /// FIXME: It does a subset of fixIfBroken. Maybe merge them?