mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
replace LyXCursor by CursorSlice
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8338 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7f48aeeab1
commit
d8f81752eb
@ -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();
|
||||
|
@ -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_;
|
||||
///
|
||||
|
@ -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 <abraunst@lyx.org>
|
||||
|
||||
* text2.C (undoSpan): add and use
|
||||
|
@ -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 \
|
||||
|
@ -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()
|
||||
|
@ -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_ << ')';
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define SCREEN_H
|
||||
|
||||
class LyXText;
|
||||
class LyXCursor;
|
||||
class CursorSlice;
|
||||
class WorkArea;
|
||||
class BufferView;
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Buffer;
|
||||
class LColor_color;
|
||||
class FuncRequest;
|
||||
class OutputParams;
|
||||
class LyXCursor;
|
||||
class CursorSlice;
|
||||
class LyXLex;
|
||||
class LyXText;
|
||||
class Painter;
|
||||
|
@ -23,7 +23,7 @@
|
||||
class Painter;
|
||||
class LyXText;
|
||||
class Paragraph;
|
||||
class LyXCursor;
|
||||
class CursorSlice;
|
||||
|
||||
/** A collapsable text inset
|
||||
|
||||
|
@ -28,7 +28,7 @@ class BufferParams;
|
||||
class BufferView;
|
||||
class Dimension;
|
||||
class LColor_color;
|
||||
class LyXCursor;
|
||||
class CursorSlice;
|
||||
class Painter;
|
||||
class Paragraph;
|
||||
class Row;
|
||||
|
@ -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 <config.h>
|
||||
|
||||
#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()));
|
||||
}
|
@ -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
|
@ -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);
|
||||
|
@ -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)
|
||||
|
46
src/text.C
46
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_;
|
||||
}
|
||||
|
20
src/text2.C
20
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;
|
||||
|
||||
|
12
src/text3.C
12
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<InsetOld::Code> 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();
|
||||
|
@ -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_;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user