From d8f81752eb871b6c0fe6ee681b5dde7536df3374 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 13 Jan 2004 14:13:51 +0000 Subject: [PATCH] replace LyXCursor by CursorSlice git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8338 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 4 +- src/BufferView_pimpl.h | 5 ++- src/ChangeLog | 12 +++++ src/Makefile.am | 2 - src/bufferview_funcs.C | 2 +- src/cursor_slice.C | 6 +++ src/frontends/screen.h | 2 +- src/insets/inset.h | 2 +- src/insets/insetcollapsable.h | 2 +- src/insets/insettext.h | 2 +- src/lyxcursor.C | 85 ----------------------------------- src/lyxcursor.h | 77 ------------------------------- src/lyxtext.h | 30 ++++++------- src/mathed/formula.C | 7 --- src/text.C | 46 +++++++++---------- src/text2.C | 20 ++++----- src/text3.C | 12 ++--- src/textcursor.C | 8 ++-- src/textcursor.h | 14 +++--- 19 files changed, 93 insertions(+), 245 deletions(-) delete mode 100644 src/lyxcursor.C delete mode 100644 src/lyxcursor.h diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 9277ed07fb..9e8bb28013 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -739,7 +739,7 @@ void BufferView::Pimpl::stuffClipboard(string const & stuff) const InsetOld * BufferView::Pimpl::getInsetByCode(InsetOld::Code code) { #if 0 - LyXCursor cursor = bv_->getLyXText()->cursor; + CursorSlice cursor = bv_->getLyXText()->cursor; Buffer::inset_iterator it = find_if(Buffer::inset_iterator( cursorPar(), cursor().pos()), @@ -1286,7 +1286,7 @@ bool BufferView::Pimpl::ChangeInsets(InsetOld::Code code, string const & from, string const & to) { bool need_update = false; - LyXCursor cur = bv_->text()->cursor(); + CursorSlice cur = bv_->text()->cursor(); ParIterator end = bv_->buffer()->par_iterator_end(); for (ParIterator it = bv_->buffer()->par_iterator_begin(); diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index 1c291ca8d7..e63b7b5df6 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -41,6 +41,7 @@ class WorkArea; class LyXScreen; class FuncRequest; + /// struct BufferView::Pimpl : public boost::signals::trackable { /// @@ -195,8 +196,8 @@ private: WorkArea & workarea() const; /// this is used to handle XSelection events in the right manner struct { - LyXCursor cursor; - LyXCursor anchor; + CursorSlice cursor; + CursorSlice anchor; bool set; } xsel_cache_; /// diff --git a/src/ChangeLog b/src/ChangeLog index b343099e21..94d2b85301 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -19,6 +19,18 @@ * cursor.h: * cursor_slice.[Ch]: some integer type changes for inset unification + * lyxcursor.[hC]: remove, it's CursorSlice now. + + * Makefile.am: + * BufferView_pimpl.[Ch]: + * bufferview_funcs.C: + * cursor_slice.C: + * lyxtext.h: + * text.C: + * text2.C: + * text3.C: + * textcursor.[Ch]: adjust + 2004-01-08 Alfredo Braunstein * text2.C (undoSpan): add and use diff --git a/src/Makefile.am b/src/Makefile.am index 5df6fdfa49..6a6193e14e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -182,8 +182,6 @@ lyx_SOURCES = \ lyx_main.h \ lyx_sty.C \ lyx_sty.h \ - lyxcursor.C \ - lyxcursor.h \ lyxfont.C \ lyxfont.h \ lyxfind.C \ diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 846da45c98..c8445a2935 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -179,7 +179,7 @@ string const currentState(BufferView * bv) LyXText * text = bv->getLyXText(); Buffer * buffer = bv->buffer(); - LyXCursor const & c = text->cursor(); + CursorSlice const & c = text->cursor(); bool const show_change = buffer->params().tracking_changes && text->cursor().pos() != text->cursorPar()->size() diff --git a/src/cursor_slice.C b/src/cursor_slice.C index 25e5f3f141..278a29e8bb 100644 --- a/src/cursor_slice.C +++ b/src/cursor_slice.C @@ -149,6 +149,12 @@ bool operator<(CursorSlice const & p, CursorSlice const & q) } +bool operator>(CursorSlice const & p, CursorSlice const & q) +{ + return q < p; +} + + //std::ostream & operator<<(std::ostream & os, CursorSlice const & p) //{ // os << "(par: " << p.inset_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ')'; diff --git a/src/frontends/screen.h b/src/frontends/screen.h index 2845592450..d0d3dc741e 100644 --- a/src/frontends/screen.h +++ b/src/frontends/screen.h @@ -14,7 +14,7 @@ #define SCREEN_H class LyXText; -class LyXCursor; +class CursorSlice; class WorkArea; class BufferView; diff --git a/src/insets/inset.h b/src/insets/inset.h index 2bcf2c0289..f1242d6c7f 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -24,7 +24,7 @@ class Buffer; class LColor_color; class FuncRequest; class OutputParams; -class LyXCursor; +class CursorSlice; class LyXLex; class LyXText; class Painter; diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 2712beef77..be75893a9d 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -23,7 +23,7 @@ class Painter; class LyXText; class Paragraph; -class LyXCursor; +class CursorSlice; /** A collapsable text inset diff --git a/src/insets/insettext.h b/src/insets/insettext.h index b6d4afa48b..6ed086f9d6 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -28,7 +28,7 @@ class BufferParams; class BufferView; class Dimension; class LColor_color; -class LyXCursor; +class CursorSlice; class Painter; class Paragraph; class Row; diff --git a/src/lyxcursor.C b/src/lyxcursor.C deleted file mode 100644 index 66b063da2a..0000000000 --- a/src/lyxcursor.C +++ /dev/null @@ -1,85 +0,0 @@ -/** - * \file lyxcursor.C - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * \author Matthias Ettrich - * \author André Pönitz - * \author Jürgen Vigna - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "lyxcursor.h" - - -LyXCursor::LyXCursor() - : par_(0), pos_(0), boundary_(false) -{} - - -void LyXCursor::par(lyx::paroffset_type par) -{ - par_ = par; -} - - -lyx::paroffset_type LyXCursor::par() const -{ - return par_; -} - - -void LyXCursor::pos(lyx::pos_type pos) -{ - pos_ = pos; -} - - -lyx::pos_type LyXCursor::pos() const -{ - return pos_; -} - - -void LyXCursor::boundary(bool boundary) -{ - boundary_ = boundary; -} - - -bool LyXCursor::boundary() const -{ - return boundary_; -} - - -bool operator==(LyXCursor const & a, LyXCursor const & b) -{ - return a.par() == b.par() - && a.pos() == b.pos() - && a.boundary() == b.boundary(); -} - - -bool operator!=(LyXCursor const & a, LyXCursor const & b) -{ - return !(a == b); -} - - -bool operator<(LyXCursor const & a, LyXCursor const & b) -{ - return (a.par() < b.par() || - (a.par() == b.par() && a.pos() < b.pos())); -} - - -bool operator>(LyXCursor const & a, LyXCursor const & b) -{ - return (a.par() > b.par() || - (a.par() == b.par() && a.pos() > b.pos())); -} diff --git a/src/lyxcursor.h b/src/lyxcursor.h deleted file mode 100644 index f27c0db105..0000000000 --- a/src/lyxcursor.h +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- -/** - * \file lyxcursor.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Lars Gullik Bjønnes - * \author Matthias Ettrich - * \author John Levon - * \author André Pönitz - * \author Dekel Tsur - * \author Jürgen Vigna - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef LYXCURSOR_H -#define LYXCURSOR_H - -#include "support/types.h" - -/** - * The cursor class describes the position of a cursor within a document. - * Several cursors exist within LyX; for example, when locking an inset, - * the position of the cursor in the containing inset is stored. - * - * FIXME: true ? - */ -class LyXCursor { -public: - LyXCursor(); - /// set the paragraph that contains this cursor - void par(lyx::paroffset_type pit); - /// return the paragraph this cursor is in - lyx::paroffset_type par() const; - /// set the position within the paragraph - void pos(lyx::pos_type p); - /// return the position within the paragraph - lyx::pos_type pos() const; - /// FIXME - void boundary(bool b); - /// FIXME - bool boundary() const; - -private: - /// The paragraph the cursor is in. - lyx::paroffset_type par_; - /// The position inside the paragraph - lyx::pos_type pos_; - /** - * When the cursor position is i, is the cursor is after the i-th char - * or before the i+1-th char ? Normally, these two interpretations are - * equivalent, except when the fonts of the i-th and i+1-th char - * differ. - * We use boundary_ to distinguish between the two options: - * If boundary_=true, then the cursor is after the i-th char - * and if boundary_=false, then the cursor is before the i+1-th char. - * - * We currently use the boundary only when the language direction of - * the i-th char is different than the one of the i+1-th char. - * In this case it is important to distinguish between the two - * cursor interpretations, in order to give a reasonable behavior to - * the user. - */ - bool boundary_; -}; - -/// -bool operator==(LyXCursor const & a, LyXCursor const & b); -/// -bool operator!=(LyXCursor const & a, LyXCursor const & b); -/// -bool operator<(LyXCursor const & a, LyXCursor const & b); -/// -bool operator>(LyXCursor const & a, LyXCursor const & b); - -#endif // LYXCURSOR_H diff --git a/src/lyxtext.h b/src/lyxtext.h index 687fcb8d4e..06d2f0c144 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -32,7 +32,7 @@ class BufferParams; class BufferView; class Dimension; class LColor_color; -class LyXCursor; +class CursorSlice; class MetricsInfo; class Paragraph; class Row; @@ -141,7 +141,7 @@ public: friend class LyXScreen; /// returns an iterator pointing to a cursor paragraph - ParagraphList::iterator getPar(LyXCursor const & cursor) const; + ParagraphList::iterator getPar(CursorSlice const & cursor) const; /// ParagraphList::iterator getPar(lyx::paroffset_type par) const; /// @@ -170,7 +170,7 @@ public: void clearSelection(); /// select the word we need depending on word_location - void getWord(LyXCursor & from, LyXCursor & to, lyx::word_location const); + void getWord(CursorSlice & from, CursorSlice & to, lyx::word_location const); /// just selects the word the cursor is in void selectWord(lyx::word_location loc); /// returns the inset at cursor (if it exists), 0 otherwise @@ -188,7 +188,7 @@ public: bool setCursor(lyx::paroffset_type par, lyx::pos_type pos, bool setfont = true, bool boundary = false); /// - void setCursor(LyXCursor &, lyx::paroffset_type par, + void setCursor(CursorSlice &, lyx::paroffset_type par, lyx::pos_type pos, bool boundary = false); /// void setCursorIntern(lyx::paroffset_type par, lyx::pos_type pos, @@ -203,7 +203,7 @@ public: /// void setCursorFromCoordinates(int x, int y); /// - void setCursorFromCoordinates(LyXCursor &, int x, int y); + void setCursorFromCoordinates(CursorSlice &, int x, int y); /// void cursorUp(bool selecting = false); /// @@ -367,9 +367,9 @@ public: /// double spacing(Paragraph const &) const; /// - void cursorLeftOneWord(LyXCursor &); + void cursorLeftOneWord(CursorSlice &); /// - void cursorRightOneWord(LyXCursor &); + void cursorRightOneWord(CursorSlice &); /// DispatchResult moveRight(); @@ -402,18 +402,18 @@ public: /// int cursorY() const; /// - int cursorX(LyXCursor const & cursor) const; + int cursorX(CursorSlice const & cursor) const; /// - int cursorY(LyXCursor const & cursor) const; + int cursorY(CursorSlice const & cursor) const; /// the topmost cursor slice - LyXCursor & cursor(); + CursorSlice & cursor(); /// the topmost cursor slice - LyXCursor const & cursor() const; + CursorSlice const & cursor() const; /// access to the selection anchor - LyXCursor & anchor(); + CursorSlice & anchor(); /// access to the selection anchor - LyXCursor const & anchor() const; + CursorSlice const & anchor() const; public: @@ -465,10 +465,10 @@ private: // fix the cursor `cur' after a characters has been deleted at `where' // position. Called by deleteEmptyParagraphMechanism - void fixCursorAfterDelete(LyXCursor & cur, LyXCursor const & where); + void fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where); /// delete double space (false) or empty paragraphs (true) around old_cursor - bool deleteEmptyParagraphMechanism(LyXCursor const & old_cursor); + bool deleteEmptyParagraphMechanism(CursorSlice const & old_cursor); /// void setCounter(Buffer const &, ParagraphList::iterator pit); diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 5c3a71e493..c80334a056 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -174,13 +174,6 @@ void InsetFormula::read(Buffer const &, LyXLex & lex) } -//ostream & operator<<(ostream & os, LyXCursor const & c) -//{ -// os << '[' << c.x() << ' ' << c.y() << ' ' << c.pos() << ']'; -// return os; -//} - - namespace { bool editing_inset(InsetFormula const * inset) diff --git a/src/text.C b/src/text.C index d4f8f74a6c..3828e4efe6 100644 --- a/src/text.C +++ b/src/text.C @@ -1088,7 +1088,7 @@ void LyXText::cursorRightOneWord() // of prior word, not to end of next prior word. void LyXText::cursorLeftOneWord() { - LyXCursor tmpcursor = cursor(); + CursorSlice tmpcursor = cursor(); cursorLeftOneWord(tmpcursor); setCursor(getPar(tmpcursor), tmpcursor.pos()); } @@ -1096,8 +1096,8 @@ void LyXText::cursorLeftOneWord() void LyXText::selectWord(word_location loc) { - LyXCursor from = cursor(); - LyXCursor to = cursor(); + CursorSlice from = cursor(); + CursorSlice to = cursor(); getWord(from, to, loc); if (cursor() != from) setCursor(from.par(), from.pos()); @@ -1127,8 +1127,8 @@ void LyXText::acceptChange() return; if (selStart().par() == selEnd().par()) { - LyXCursor const & startc = selStart(); - LyXCursor const & endc = selEnd(); + CursorSlice const & startc = selStart(); + CursorSlice const & endc = selEnd(); recordUndo(Undo::INSERT, this, startc.par()); getPar(startc)->acceptChange(startc.pos(), endc.pos()); finishUndo(); @@ -1146,8 +1146,8 @@ void LyXText::rejectChange() return; if (selStart().par() == selEnd().par()) { - LyXCursor const & startc = selStart(); - LyXCursor const & endc = selEnd(); + CursorSlice const & startc = selStart(); + CursorSlice const & endc = selEnd(); recordUndo(Undo::INSERT, this, startc.par()); getPar(startc)->rejectChange(startc.pos(), endc.pos()); finishUndo(); @@ -1165,7 +1165,7 @@ void LyXText::deleteWordForward() if (cursorPar()->empty()) cursorRight(bv()); else { - LyXCursor tmpcursor = cursor(); + CursorSlice tmpcursor = cursor(); selection.set(true); // to avoid deletion cursorRightOneWord(); setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); @@ -1183,7 +1183,7 @@ void LyXText::deleteWordBackward() if (cursorPar()->empty()) cursorLeft(bv()); else { - LyXCursor tmpcursor = cursor(); + CursorSlice tmpcursor = cursor(); selection.set(true); // to avoid deletion cursorLeftOneWord(); setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); @@ -1202,7 +1202,7 @@ void LyXText::deleteLineForward() // Paragraph is empty, so we just go to the right cursorRight(bv()); } else { - LyXCursor tmpcursor = cursor(); + CursorSlice tmpcursor = cursor(); selection.set(true); // to avoid deletion cursorEnd(); setCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); @@ -1220,8 +1220,8 @@ void LyXText::deleteLineForward() void LyXText::changeCase(LyXText::TextCase action) { - LyXCursor from; - LyXCursor to; + CursorSlice from; + CursorSlice to; if (selection.set()) { from = selStart(); @@ -1270,7 +1270,7 @@ void LyXText::changeCase(LyXText::TextCase action) void LyXText::Delete() { // this is a very easy implementation - LyXCursor old_cursor = cursor(); + CursorSlice old_cursor = cursor(); // just move to the right cursorRight(true); @@ -1387,7 +1387,7 @@ RowList::iterator LyXText::cursorRow() const } -ParagraphList::iterator LyXText::getPar(LyXCursor const & cur) const +ParagraphList::iterator LyXText::getPar(CursorSlice const & cur) const { return getPar(cur.par()); } @@ -1646,7 +1646,7 @@ bool LyXText::isFirstRow(ParagraphList::iterator pit, Row const & row) const } -void LyXText::cursorLeftOneWord(LyXCursor & cur) +void LyXText::cursorLeftOneWord(CursorSlice & cur) { // treat HFills, floats and Insets as words @@ -1680,7 +1680,7 @@ void LyXText::cursorLeftOneWord(LyXCursor & cur) } -void LyXText::cursorRightOneWord(LyXCursor & cur) +void LyXText::cursorRightOneWord(CursorSlice & cur) { // treat floats, HFills and Insets as words ParagraphList::iterator pit = cursorPar(); @@ -1706,7 +1706,7 @@ void LyXText::cursorRightOneWord(LyXCursor & cur) } -void LyXText::getWord(LyXCursor & from, LyXCursor & to, word_location const loc) +void LyXText::getWord(CursorSlice & from, CursorSlice & to, word_location const loc) { ParagraphList::iterator from_par = getPar(from); ParagraphList::iterator to_par = getPar(to); @@ -1865,7 +1865,7 @@ int LyXText::cursorY() const } -int LyXText::cursorX(LyXCursor const & cur) const +int LyXText::cursorX(CursorSlice const & cur) const { ParagraphList::iterator pit = getPar(cur); if (pit->rows.empty()) @@ -1926,7 +1926,7 @@ int LyXText::cursorX(LyXCursor const & cur) const } -int LyXText::cursorY(LyXCursor const & cur) const +int LyXText::cursorY(CursorSlice const & cur) const { Paragraph & par = *getPar(cur); Row & row = *par.getRow(cur.pos()); @@ -1934,25 +1934,25 @@ int LyXText::cursorY(LyXCursor const & cur) const } -LyXCursor & LyXText::cursor() +CursorSlice & LyXText::cursor() { return cursor_; } -LyXCursor const & LyXText::cursor() const +CursorSlice const & LyXText::cursor() const { return cursor_; } -LyXCursor & LyXText::anchor() +CursorSlice & LyXText::anchor() { return anchor_; } -LyXCursor const & LyXText::anchor() const +CursorSlice const & LyXText::anchor() const { return anchor_; } diff --git a/src/text2.C b/src/text2.C index ed3b4f405a..3e25913b84 100644 --- a/src/text2.C +++ b/src/text2.C @@ -538,7 +538,7 @@ void LyXText::toggleFree(LyXFont const & font, bool toggleall) // Try implicit word selection // If there is a change in the language the implicit word selection // is disabled. - LyXCursor resetCursor = cursor(); + CursorSlice resetCursor = cursor(); bool implicitSelection = font.language() == ignore_language && font.number() == LyXFont::IGNORE @@ -562,7 +562,7 @@ string LyXText::getStringToIndex() // Try implicit word selection // If there is a change in the language the implicit word selection // is disabled. - LyXCursor const reset_cursor = cursor(); + CursorSlice const reset_cursor = cursor(); bool const implicitSelection = selectWordWhenUnderCursor(lyx::PREVIOUS_WORD); @@ -1150,13 +1150,13 @@ void LyXText::setCursor(ParagraphList::iterator pit, pos_type pos) bool LyXText::setCursor(paroffset_type par, pos_type pos, bool setfont, bool boundary) { - LyXCursor old_cursor = cursor(); + CursorSlice old_cursor = cursor(); setCursorIntern(par, pos, setfont, boundary); return deleteEmptyParagraphMechanism(old_cursor); } -void LyXText::setCursor(LyXCursor & cur, paroffset_type par, +void LyXText::setCursor(CursorSlice & cur, paroffset_type par, pos_type pos, bool boundary) { BOOST_ASSERT(par != int(paragraphs().size())); @@ -1362,7 +1362,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit, void LyXText::setCursorFromCoordinates(int x, int y) { - LyXCursor old_cursor = cursor(); + CursorSlice old_cursor = cursor(); setCursorFromCoordinates(cursor(), x, y); setCurrentFont(); deleteEmptyParagraphMechanism(old_cursor); @@ -1370,7 +1370,7 @@ void LyXText::setCursorFromCoordinates(int x, int y) // x,y are coordinates relative to this LyXText -void LyXText::setCursorFromCoordinates(LyXCursor & cur, int x, int y) +void LyXText::setCursorFromCoordinates(CursorSlice & cur, int x, int y) { ParagraphList::iterator pit; Row const & row = *getRowNearY(y, pit); @@ -1562,7 +1562,7 @@ void LyXText::cursorDownParagraph() // fix the cursor `cur' after a characters has been deleted at `where' // position. Called by deleteEmptyParagraphMechanism -void LyXText::fixCursorAfterDelete(LyXCursor & cur, LyXCursor const & where) +void LyXText::fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where) { // if cursor is not in the paragraph where the delete occured, // do nothing @@ -1581,7 +1581,7 @@ void LyXText::fixCursorAfterDelete(LyXCursor & cur, LyXCursor const & where) } -bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) +bool LyXText::deleteEmptyParagraphMechanism(CursorSlice const & old_cursor) { // Would be wrong to delete anything if we have a selection. if (selection.set()) @@ -1637,7 +1637,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) #warning This will not work anymore when we have multiple views of the same buffer // In this case, we will have to correct also the cursors held by // other bufferviews. It will probably be easier to do that in a more -// automated way in LyXCursor code. (JMarc 26/09/2001) +// automated way in CursorSlice code. (JMarc 26/09/2001) #endif // correct all cursors held by the LyXText fixCursorAfterDelete(cursor(), old_cursor); @@ -1665,7 +1665,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) if (old_pit->empty() || (old_pit->size() == 1 && old_pit->isLineSeparator(0))) { // ok, we will delete something - LyXCursor tmpcursor; + CursorSlice tmpcursor; deleted = true; diff --git a/src/text3.C b/src/text3.C index f2d0356a79..7850838a6a 100644 --- a/src/text3.C +++ b/src/text3.C @@ -91,7 +91,7 @@ namespace { if (font.language() != ignore_language || font.number() != LyXFont::IGNORE) { - LyXCursor & cur = text->cursor(); + CursorSlice & cur = text->cursor(); Paragraph & par = *text->cursorPar(); text->bidi.computeTables(par, *bv->buffer(), *par.getRow(cur.pos())); @@ -337,7 +337,7 @@ void LyXText::gotoInset(vector const & codes, if (!gotoNextInset(codes, contents)) { if (cursor().pos() || cursorPar() != paragraphs().begin()) { - LyXCursor tmp = cursor(); + CursorSlice tmp = cursor(); cursor().par(0); cursor().pos(0); if (!gotoNextInset(codes, contents)) { @@ -634,8 +634,8 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) break; case LFUN_WORDSEL: { - LyXCursor cur1 = cursor(); - LyXCursor cur2; + CursorSlice cur1 = cursor(); + CursorSlice cur2; getWord(cur1, cur2, lyx::WHOLE_WORD); setCursor(cur1.par(), cur1.pos()); clearSelection(); @@ -770,7 +770,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) case LFUN_BACKSPACE_SKIP: // Reverse the effect of LFUN_BREAKPARAGRAPH_SKIP. if (!selection.set()) { - LyXCursor cur = cursor(); + CursorSlice cur = cursor(); backspace(); anchor() = cur; } else { @@ -801,7 +801,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd) // When at the beginning of a paragraph, remove // indentation and add a "defskip" at the top. // Otherwise, do the same as LFUN_BREAKPARAGRAPH. - LyXCursor cur = cursor(); + CursorSlice cur = cursor(); replaceSelection(bv->getLyXText()); if (cur.pos() == 0) { ParagraphParameters & params = getPar(cur)->params(); diff --git a/src/textcursor.C b/src/textcursor.C index 0b4a9a1468..407825c3df 100644 --- a/src/textcursor.C +++ b/src/textcursor.C @@ -13,7 +13,7 @@ #include "textcursor.h" -LyXCursor const & TextCursor::selStart() const +CursorSlice const & TextCursor::selStart() const { if (!selection.set()) return cursor_; @@ -22,7 +22,7 @@ LyXCursor const & TextCursor::selStart() const } -LyXCursor const & TextCursor::selEnd() const +CursorSlice const & TextCursor::selEnd() const { if (!selection.set()) return cursor_; @@ -30,7 +30,7 @@ LyXCursor const & TextCursor::selEnd() const } -LyXCursor & TextCursor::selStart() +CursorSlice & TextCursor::selStart() { if (!selection.set()) return cursor_; @@ -38,7 +38,7 @@ LyXCursor & TextCursor::selStart() } -LyXCursor & TextCursor::selEnd() +CursorSlice & TextCursor::selEnd() { if (!selection.set()) return cursor_; diff --git a/src/textcursor.h b/src/textcursor.h index 41f672873a..8aca6619c4 100644 --- a/src/textcursor.h +++ b/src/textcursor.h @@ -15,7 +15,7 @@ #ifndef TEXTCURSOR_H #define TEXTCURSOR_H -#include "lyxcursor.h" +#include "cursor_slice.h" // Do not even think of forward declaring LyXText/BufferView etc here! // If you need Paragraph proper, go to text_func.h @@ -63,16 +63,16 @@ struct TextCursor { void clearSelection(); // actual cursor position - LyXCursor cursor_; + CursorSlice cursor_; // the other end of the selection - LyXCursor anchor_; + CursorSlice anchor_; Selection selection; - LyXCursor const & selStart() const; - LyXCursor const & selEnd() const; - LyXCursor & selStart(); - LyXCursor & selEnd(); + CursorSlice const & selStart() const; + CursorSlice const & selEnd() const; + CursorSlice & selStart(); + CursorSlice & selEnd(); }; #endif -- 2.39.5