mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Remove the BufferView* arg from almost all LyXText class functions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6519 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e5d401f632
commit
064714a102
@ -13,12 +13,10 @@ src/frontends/controllers/biblio.C
|
||||
src/frontends/controllers/character.C
|
||||
src/frontends/controllers/ControlAboutlyx.C
|
||||
src/frontends/controllers/ControlBibtex.C
|
||||
src/frontends/controllers/ControlCharacter.C
|
||||
src/frontends/controllers/ControlDocument.C
|
||||
src/frontends/controllers/ControlExternal.C
|
||||
src/frontends/controllers/ControlGraphics.C
|
||||
src/frontends/controllers/ControlInclude.C
|
||||
src/frontends/controllers/ControlParagraph.C
|
||||
src/frontends/controllers/ControlPreamble.C
|
||||
src/frontends/controllers/ControlPrefs.C
|
||||
src/frontends/controllers/ControlPrint.C
|
||||
@ -135,6 +133,7 @@ src/importer.C
|
||||
src/insets/insetbibtex.C
|
||||
src/insets/inset.C
|
||||
src/insets/insetcaption.C
|
||||
src/insets/insetenv.C
|
||||
src/insets/inseterror.C
|
||||
src/insets/insetert.C
|
||||
src/insets/insetexternal.C
|
||||
@ -180,6 +179,7 @@ src/mathed/ref_inset.C
|
||||
src/MenuBackend.C
|
||||
src/paragraph.C
|
||||
src/paragraph_funcs.C
|
||||
src/ParagraphParameters.C
|
||||
src/rowpainter.C
|
||||
src/support/filetools.C
|
||||
src/tabular.C
|
||||
|
@ -349,7 +349,7 @@ bool BufferView::removeAutoInsets()
|
||||
// loop once at most. However for safety we iterate rather than just
|
||||
// make this an if () conditional.
|
||||
while ((cursor_par_prev || cursor_par_next)
|
||||
&& text->setCursor(this,
|
||||
&& text->setCursor(
|
||||
cursor_par_prev ? cursor_par_prev : cursor_par_next,
|
||||
0)) {
|
||||
// We just removed cursor_par so have to fix the "cursor"
|
||||
@ -379,7 +379,7 @@ bool BufferView::removeAutoInsets()
|
||||
Paragraph * par_prev = par ? par->previous() : 0;
|
||||
bool removed = false;
|
||||
|
||||
if (text->setCursor(this, par, 0)
|
||||
if (text->setCursor(par, 0)
|
||||
&& cursor_par == par_prev) {
|
||||
// The previous setCursor line was deleted and that
|
||||
// was the cursor_par line. This can only happen if an
|
||||
@ -443,14 +443,14 @@ bool BufferView::removeAutoInsets()
|
||||
}
|
||||
if (removed) {
|
||||
found = true;
|
||||
text->redoParagraph(this);
|
||||
text->redoParagraph();
|
||||
}
|
||||
}
|
||||
|
||||
// It is possible that the last line is empty if it was cursor_par
|
||||
// and/or only had an error inset on it. So we set the cursor to the
|
||||
// start of the doc to force its removal and ensure a valid saved cursor
|
||||
if (text->setCursor(this, text->ownerParagraph(), 0)
|
||||
if (text->setCursor(text->ownerParagraph(), 0)
|
||||
&& 0 == cursor_par_next) {
|
||||
cursor_par = cursor_par_prev;
|
||||
cursor_pos = cursor_par->size();
|
||||
@ -463,7 +463,7 @@ bool BufferView::removeAutoInsets()
|
||||
}
|
||||
|
||||
// restore the original cursor in its corrected location.
|
||||
text->setCursorIntern(this, cursor_par, cursor_pos);
|
||||
text->setCursorIntern(cursor_par, cursor_pos);
|
||||
|
||||
return found;
|
||||
}
|
||||
@ -504,13 +504,13 @@ void BufferView::insertErrors(TeXErrors & terr)
|
||||
|
||||
freezeUndo();
|
||||
InsetError * new_inset = new InsetError(msgtxt);
|
||||
text->setCursorIntern(this, texrowpar, tmppos);
|
||||
text->insertInset(this, new_inset);
|
||||
text->fullRebreak(this);
|
||||
text->setCursorIntern(texrowpar, tmppos);
|
||||
text->insertInset(new_inset);
|
||||
text->fullRebreak();
|
||||
unFreezeUndo();
|
||||
}
|
||||
// Restore the cursor position
|
||||
text->setCursorIntern(this, cursor.par(), cursor.pos());
|
||||
text->setCursorIntern(cursor.par(), cursor.pos());
|
||||
}
|
||||
|
||||
|
||||
@ -529,7 +529,7 @@ void BufferView::setCursorFromRow(int row)
|
||||
} else {
|
||||
texrowpar = buffer()->getParFromID(tmpid);
|
||||
}
|
||||
text->setCursor(this, texrowpar, tmppos);
|
||||
text->setCursor(texrowpar, tmppos);
|
||||
}
|
||||
|
||||
|
||||
@ -552,7 +552,7 @@ bool BufferView::gotoLabel(string const & label)
|
||||
if (find(labels.begin(),labels.end(),label)
|
||||
!= labels.end()) {
|
||||
beforeChange(text);
|
||||
text->setCursor(this, it.getPar(), it.getPos());
|
||||
text->setCursor(it.getPar(), it.getPos());
|
||||
text->selection.cursor = text->cursor;
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
return true;
|
||||
@ -608,7 +608,7 @@ void BufferView::copyEnvironment()
|
||||
void BufferView::pasteEnvironment()
|
||||
{
|
||||
if (available()) {
|
||||
text->pasteEnvironmentType(this);
|
||||
text->pasteEnvironmentType();
|
||||
owner()->message(_("Paragraph environment type set"));
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
@ -623,7 +623,7 @@ WordLangTuple const BufferView::nextWord(float & value)
|
||||
return WordLangTuple();
|
||||
}
|
||||
|
||||
return text->selectNextWordToSpellcheck(this, value);
|
||||
return text->selectNextWordToSpellcheck(value);
|
||||
}
|
||||
|
||||
|
||||
@ -636,7 +636,7 @@ void BufferView::selectLastWord()
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
text->selection.cursor = cur;
|
||||
text->selectSelectedWord(this);
|
||||
text->selectSelectedWord();
|
||||
toggleSelection(false);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
}
|
||||
@ -648,7 +648,7 @@ void BufferView::endOfSpellCheck()
|
||||
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
text->selectSelectedWord(this);
|
||||
text->selectSelectedWord();
|
||||
text->clearSelection();
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
}
|
||||
@ -669,9 +669,9 @@ void BufferView::replaceWord(string const & replacestring)
|
||||
|
||||
// clear the selection (if there is any)
|
||||
toggleSelection(false);
|
||||
tt->replaceSelectionWithString(this, replacestring);
|
||||
tt->replaceSelectionWithString(replacestring);
|
||||
|
||||
tt->setSelectionRange(this, replacestring.length());
|
||||
tt->setSelectionRange(replacestring.length());
|
||||
|
||||
// Go back so that replacement string is also spellchecked
|
||||
for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
|
||||
@ -709,12 +709,12 @@ bool BufferView::lockInset(UpdatableInset * inset)
|
||||
InsetList::iterator end = pit->insetlist.end();
|
||||
for (; it != end; ++it) {
|
||||
if (it.getInset() == inset) {
|
||||
text->setCursorIntern(this, &*pit, it.getPos());
|
||||
text->setCursorIntern(&*pit, it.getPos());
|
||||
theLockingInset(inset);
|
||||
return true;
|
||||
}
|
||||
if (it.getInset()->getInsetFromID(id)) {
|
||||
text->setCursorIntern(this, &*pit, it.getPos());
|
||||
text->setCursorIntern(&*pit, it.getPos());
|
||||
it.getInset()->edit(this);
|
||||
return theLockingInset()->lockInsetInInset(this, inset);
|
||||
}
|
||||
@ -736,7 +736,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
|
||||
cursor.par()->isInset(cursor.pos() - 1) &&
|
||||
(cursor.par()->getInset(cursor.pos() - 1) ==
|
||||
locking_inset))
|
||||
text->setCursor(this, cursor,
|
||||
text->setCursor(cursor,
|
||||
cursor.par(), cursor.pos() - 1);
|
||||
LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE;
|
||||
LyXText * txt = getLyXText();
|
||||
@ -852,14 +852,14 @@ bool BufferView::ChangeInsets(Inset::Code code,
|
||||
// The test it.size()==1 was needed to prevent crashes.
|
||||
// How to set the cursor corretly when it.size()>1 ??
|
||||
if (it.size() == 1) {
|
||||
text->setCursorIntern(this, par, 0);
|
||||
text->redoParagraphs(this, text->cursor,
|
||||
text->setCursorIntern(par, 0);
|
||||
text->redoParagraphs(text->cursor,
|
||||
text->cursor.par()->next());
|
||||
text->fullRebreak(this);
|
||||
text->fullRebreak();
|
||||
}
|
||||
}
|
||||
}
|
||||
text->setCursorIntern(this, cursor.par(), cursor.pos());
|
||||
text->setCursorIntern(cursor.par(), cursor.pos());
|
||||
return need_update;
|
||||
}
|
||||
|
||||
|
@ -308,13 +308,13 @@ int BufferView::Pimpl::resizeCurrentBuffer()
|
||||
// Mechanism when setting the cursor.
|
||||
bv_->text->selection.mark(mark_set);
|
||||
if (selection) {
|
||||
bv_->text->setCursor(bv_, selstartpar, selstartpos);
|
||||
bv_->text->setCursor(selstartpar, selstartpos);
|
||||
bv_->text->selection.cursor = bv_->text->cursor;
|
||||
bv_->text->setCursor(bv_, selendpar, selendpos);
|
||||
bv_->text->setSelection(bv_);
|
||||
bv_->text->setCursor(bv_, par, pos);
|
||||
bv_->text->setCursor(selendpar, selendpos);
|
||||
bv_->text->setSelection();
|
||||
bv_->text->setCursor(par, pos);
|
||||
} else {
|
||||
bv_->text->setCursor(bv_, par, pos);
|
||||
bv_->text->setCursor(par, pos);
|
||||
bv_->text->selection.cursor = bv_->text->cursor;
|
||||
bv_->text->selection.set(false);
|
||||
}
|
||||
@ -376,9 +376,9 @@ void BufferView::Pimpl::scrollDocView(int value)
|
||||
int const last = static_cast<int>((bv_->text->top_y() + workarea().workHeight() - height));
|
||||
|
||||
if (vbt->cursor.y() < first)
|
||||
vbt->setCursorFromCoordinates(bv_, 0, first);
|
||||
vbt->setCursorFromCoordinates(0, first);
|
||||
else if (vbt->cursor.y() > last)
|
||||
vbt->setCursorFromCoordinates(bv_, 0, last);
|
||||
vbt->setCursorFromCoordinates(0, last);
|
||||
}
|
||||
|
||||
|
||||
@ -503,19 +503,19 @@ void BufferView::Pimpl::update()
|
||||
screen().update(*bv_);
|
||||
bool fitc = false;
|
||||
while (bv_->text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
bv_->text->fullRebreak(bv_);
|
||||
bv_->text->setCursor(bv_, bv_->text->cursor.par(),
|
||||
bv_->text->fullRebreak();
|
||||
bv_->text->setCursor(bv_->text->cursor.par(),
|
||||
bv_->text->cursor.pos());
|
||||
if (bv_->text->selection.set()) {
|
||||
bv_->text->setCursor(bv_, bv_->text->selection.start,
|
||||
bv_->text->setCursor(bv_->text->selection.start,
|
||||
bv_->text->selection.start.par(),
|
||||
bv_->text->selection.start.pos());
|
||||
bv_->text->setCursor(bv_, bv_->text->selection.end,
|
||||
bv_->text->setCursor(bv_->text->selection.end,
|
||||
bv_->text->selection.end.par(),
|
||||
bv_->text->selection.end.pos());
|
||||
}
|
||||
fitc = true;
|
||||
bv_->text->postPaint(*bv_, 0);
|
||||
bv_->text->postPaint(0);
|
||||
screen().update(*bv_);
|
||||
}
|
||||
|
||||
@ -574,7 +574,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
|
||||
text->selection.cursor = text->cursor;
|
||||
}
|
||||
|
||||
text->fullRebreak(bv_);
|
||||
text->fullRebreak();
|
||||
|
||||
if (text->inset_owner) {
|
||||
text->inset_owner->setUpdateStatus(bv_, InsetText::NONE);
|
||||
@ -680,7 +680,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
|
||||
if (!par)
|
||||
return;
|
||||
|
||||
bv_->text->setCursor(bv_, par,
|
||||
bv_->text->setCursor(par,
|
||||
min(par->size(), saved_positions[i].par_pos));
|
||||
|
||||
update(bv_->text, BufferView::SELECT | BufferView::FITCUR);
|
||||
@ -940,7 +940,7 @@ void BufferView::Pimpl::trackChanges()
|
||||
buf->undostack.clear();
|
||||
} else {
|
||||
bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR);
|
||||
bv_->text->setCursor(bv_, &(*buf->paragraphs.begin()), 0);
|
||||
bv_->text->setCursor(&(*buf->paragraphs.begin()), 0);
|
||||
#warning changes FIXME
|
||||
//moveCursorUpdate(false);
|
||||
|
||||
@ -1236,7 +1236,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
// FIXME
|
||||
if (arg.size() > 100 || arg.empty()) {
|
||||
// Get word or selection
|
||||
bv_->getLyXText()->selectWordWhenUnderCursor(bv_, LyXText::WHOLE_WORD);
|
||||
bv_->getLyXText()->selectWordWhenUnderCursor(LyXText::WHOLE_WORD);
|
||||
arg = bv_->getLyXText()->selectionAsString(buffer_, false);
|
||||
// FIXME: where is getLyXText()->unselect(bv_) ?
|
||||
}
|
||||
@ -1256,12 +1256,12 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
|
||||
case LFUN_ACCEPT_ALL_CHANGES: {
|
||||
bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR);
|
||||
bv_->text->setCursor(bv_, &(*bv_->buffer()->paragraphs.begin()), 0);
|
||||
bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0);
|
||||
#warning FIXME changes
|
||||
//moveCursorUpdate(false);
|
||||
|
||||
while (lyxfind::findNextChange(bv_)) {
|
||||
bv_->getLyXText()->acceptChange(bv_);
|
||||
bv_->getLyXText()->acceptChange();
|
||||
}
|
||||
update(bv_->text,
|
||||
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
||||
@ -1270,12 +1270,12 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
|
||||
case LFUN_REJECT_ALL_CHANGES: {
|
||||
bv_->update(bv_->text, BufferView::SELECT | BufferView::FITCUR);
|
||||
bv_->text->setCursor(bv_, &(*bv_->buffer()->paragraphs.begin()), 0);
|
||||
bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0);
|
||||
#warning FIXME changes
|
||||
//moveCursorUpdate(false);
|
||||
|
||||
while (lyxfind::findNextChange(bv_)) {
|
||||
bv_->getLyXText()->rejectChange(bv_);
|
||||
bv_->getLyXText()->rejectChange();
|
||||
}
|
||||
update(bv_->text,
|
||||
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
||||
@ -1283,14 +1283,14 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
}
|
||||
|
||||
case LFUN_ACCEPT_CHANGE: {
|
||||
bv_->getLyXText()->acceptChange(bv_);
|
||||
bv_->getLyXText()->acceptChange();
|
||||
update(bv_->text,
|
||||
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_REJECT_CHANGE: {
|
||||
bv_->getLyXText()->rejectChange(bv_);
|
||||
bv_->getLyXText()->rejectChange();
|
||||
update(bv_->text,
|
||||
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
||||
break;
|
||||
@ -1325,13 +1325,13 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
|
||||
beforeChange(bv_->text);
|
||||
if (!lout.empty()) {
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
bv_->text->breakParagraph(bv_, bv_->buffer()->paragraphs);
|
||||
bv_->text->breakParagraph(bv_->buffer()->paragraphs);
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
||||
if (!bv_->text->cursor.par()->empty()) {
|
||||
bv_->text->cursorLeft(bv_);
|
||||
|
||||
bv_->text->breakParagraph(bv_, bv_->buffer()->paragraphs);
|
||||
bv_->text->breakParagraph(bv_->buffer()->paragraphs);
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
|
||||
@ -1349,9 +1349,9 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
|
||||
lay = tclass.defaultLayoutName();
|
||||
}
|
||||
|
||||
bv_->text->setLayout(bv_, lay);
|
||||
bv_->text->setLayout(lay);
|
||||
|
||||
bv_->text->setParagraph(bv_, 0, 0,
|
||||
bv_->text->setParagraph(0, 0,
|
||||
0, 0,
|
||||
VSpace(VSpace::NONE), VSpace(VSpace::NONE),
|
||||
Spacing(),
|
||||
@ -1361,7 +1361,7 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
}
|
||||
|
||||
bv_->text->insertInset(bv_, inset);
|
||||
bv_->text->insertInset(inset);
|
||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
||||
unFreezeUndo();
|
||||
@ -1377,7 +1377,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
|
||||
// first check for locking insets
|
||||
if (bv_->theLockingInset()) {
|
||||
if (bv_->theLockingInset() == inset) {
|
||||
if (bv_->text->updateInset(bv_, inset)) {
|
||||
if (bv_->text->updateInset(inset)) {
|
||||
update();
|
||||
if (mark_dirty) {
|
||||
buffer_->markDirty();
|
||||
@ -1386,7 +1386,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
|
||||
return;
|
||||
}
|
||||
} else if (bv_->theLockingInset()->updateInsetInInset(bv_, inset)) {
|
||||
if (bv_->text->updateInset(bv_, bv_->theLockingInset())) {
|
||||
if (bv_->text->updateInset(bv_->theLockingInset())) {
|
||||
update();
|
||||
if (mark_dirty) {
|
||||
buffer_->markDirty();
|
||||
@ -1406,7 +1406,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
|
||||
hideCursor();
|
||||
if (tl_inset == inset) {
|
||||
update(bv_->text, BufferView::UPDATE);
|
||||
if (bv_->text->updateInset(bv_, inset)) {
|
||||
if (bv_->text->updateInset(inset)) {
|
||||
if (mark_dirty) {
|
||||
update(bv_->text,
|
||||
BufferView::SELECT
|
||||
@ -1420,7 +1420,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
|
||||
} else if (static_cast<UpdatableInset *>(tl_inset)
|
||||
->updateInsetInInset(bv_, inset))
|
||||
{
|
||||
if (bv_->text->updateInset(bv_, tl_inset)) {
|
||||
if (bv_->text->updateInset(tl_inset)) {
|
||||
update();
|
||||
updateScrollbar();
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
2003-03-17 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* lyxtext.h: remove BufferView* as first arg from almost all class
|
||||
functions.
|
||||
* other files: adjust.
|
||||
|
||||
2003-03-17 John Levon <levon@movementarian.org>
|
||||
|
||||
* lyxtext.h:
|
||||
|
@ -408,10 +408,10 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
|
||||
InsetError * new_inset = new InsetError(s);
|
||||
LyXText * txt = current_view->getLyXText();
|
||||
LyXCursor cur = txt->cursor;
|
||||
txt->setCursorIntern(current_view, par, 0);
|
||||
txt->insertInset(current_view, new_inset);
|
||||
txt->fullRebreak(current_view);
|
||||
txt->setCursorIntern(current_view, cur.par(), cur.pos());
|
||||
txt->setCursorIntern(par, 0);
|
||||
txt->insertInset(new_inset);
|
||||
txt->fullRebreak();
|
||||
txt->setCursorIntern(cur.par(), cur.pos());
|
||||
unFreezeUndo();
|
||||
}
|
||||
}
|
||||
|
@ -426,8 +426,7 @@ void setParagraphParams(BufferView & bv, string const & data)
|
||||
params.read(lex);
|
||||
|
||||
LyXText * text = bv.getLyXText();
|
||||
text->setParagraph(&bv,
|
||||
params.lineTop(),
|
||||
text->setParagraph(params.lineTop(),
|
||||
params.lineBottom(),
|
||||
params.pagebreakTop(),
|
||||
params.pagebreakBottom(),
|
||||
|
@ -337,7 +337,7 @@ bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit)
|
||||
}
|
||||
} else {
|
||||
// We are inserting into an existing document
|
||||
users->text->breakParagraph(users, paragraphs);
|
||||
users->text->breakParagraph(paragraphs);
|
||||
markDirty();
|
||||
|
||||
// We don't want to adopt the parameters from the
|
||||
|
@ -236,9 +236,9 @@ void changeDepth(BufferView * bv, LyXText * text, int decInc)
|
||||
bv->hideCursor();
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
|
||||
if (decInc >= 0)
|
||||
text->incDepth(bv);
|
||||
text->incDepth();
|
||||
else
|
||||
text->decDepth(bv);
|
||||
text->decDepth();
|
||||
if (text->inset_owner)
|
||||
bv->updateInset((Inset *)text->inset_owner, true);
|
||||
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
@ -398,7 +398,7 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
||||
|
||||
bv->hideCursor();
|
||||
bv->update(text, BufferView::SELECT | BufferView::FITCUR);
|
||||
text->toggleFree(bv, font, toggleall);
|
||||
text->toggleFree(font, toggleall);
|
||||
bv->update(text, BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
||||
|
||||
if (font.language() != ignore_language ||
|
||||
@ -408,7 +408,7 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
||||
if (cursor.boundary() !=
|
||||
text->isBoundary(bv->buffer(), cursor.par(), cursor.pos(),
|
||||
text->real_current_font))
|
||||
text->setCursor(bv, cursor.par(), cursor.pos(),
|
||||
text->setCursor(cursor.par(), cursor.pos(),
|
||||
false, !cursor.boundary());
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ Inset * createInset(FuncRequest const & cmd)
|
||||
// Try and generate a valid index entry.
|
||||
InsetCommandParams icp("index");
|
||||
string const contents = cmd.argument.empty() ?
|
||||
bv->getLyXText()->getStringToIndex(bv) :
|
||||
bv->getLyXText()->getStringToIndex() :
|
||||
cmd.argument;
|
||||
icp.setContents(contents);
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-03-17 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* adjust for BufferView* arg removal from lyxtext.
|
||||
|
||||
2003-03-17 John Levon <levon@movementarian.org>
|
||||
|
||||
* screen.h:
|
||||
|
@ -28,4 +28,3 @@ void ControlError::clearParams()
|
||||
{
|
||||
params_.erase();
|
||||
}
|
||||
|
||||
|
@ -434,24 +434,25 @@ void LyXScreen::drawFromTo(LyXText * text, BufferView * bv,
|
||||
RowPainter rp(*bv, *text, *row);
|
||||
|
||||
if (rp.paint(y + yo, xo, y + text->top_y()))
|
||||
text->markChangeInDraw(bv, row, prev);
|
||||
text->markChangeInDraw(row, prev);
|
||||
|
||||
internal = internal && (st != LyXText::CHANGED_IN_DRAW);
|
||||
while (internal && text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
text->fullRebreak(bv);
|
||||
text->setCursor(bv, text->cursor.par(), text->cursor.pos());
|
||||
text->postPaint(*bv, 0);
|
||||
text->fullRebreak();
|
||||
text->setCursor(text->cursor.par(),
|
||||
text->cursor.pos());
|
||||
text->postPaint(0);
|
||||
Row * prev = row->previous();
|
||||
RowPainter rp(*bv, *text, *row);
|
||||
if (rp.paint(y + yo, xo, y + text->top_y()))
|
||||
text->markChangeInDraw(bv, row, prev);
|
||||
text->markChangeInDraw(row, prev);
|
||||
}
|
||||
y += row->height();
|
||||
row = row->next();
|
||||
}
|
||||
|
||||
// maybe we have to clear the screen at the bottom
|
||||
if ((y < y2) && text->isTopLevel()) {
|
||||
if ((y < y2) && !text->isInInset()) {
|
||||
workarea().getPainter().fillRectangle(0, y,
|
||||
workarea().workWidth(), y2 - y,
|
||||
LColor::bottomarea);
|
||||
@ -469,6 +470,6 @@ void LyXScreen::drawOneRow(LyXText * text, BufferView * bv, Row * row,
|
||||
Row * prev = row->previous();
|
||||
RowPainter rp(*bv, *text, *row);
|
||||
if (rp.paint(y, xo, y + text->top_y()))
|
||||
text->markChangeInDraw(bv, row, prev);
|
||||
text->markChangeInDraw(row, prev);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-03-17 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* adjust for BufferView* arg removal from lyxtext.
|
||||
|
||||
2003-03-17 John Levon <levon@movementarian.org>
|
||||
|
||||
* most files: remove the "cleared" parameter
|
||||
|
@ -1505,7 +1505,7 @@ void InsetTabular::resetPos(BufferView * bv) const
|
||||
} else if (the_locking_inset &&
|
||||
(tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20))
|
||||
{
|
||||
int xx = cursor_.x() - offset + bv->text->getRealCursorX(bv);
|
||||
int xx = cursor_.x() - offset + bv->text->getRealCursorX();
|
||||
if (xx > (bv->workWidth()-20)) {
|
||||
scroll(bv, -(xx - bv->workWidth() + 60));
|
||||
updateLocal(bv, FULL, false);
|
||||
|
@ -106,7 +106,7 @@ void InsetText::saveLyXTextState(LyXText * t) const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
|
||||
void InsetText::restoreLyXTextState(LyXText * t) const
|
||||
{
|
||||
if (!sstate.lpar)
|
||||
return;
|
||||
@ -115,15 +115,15 @@ void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
|
||||
/* at this point just to avoid the DEPM when setting the cursor */
|
||||
t->selection.mark(sstate.mark_set);
|
||||
if (sstate.selection) {
|
||||
t->setCursor(bv, sstate.selstartpar, sstate.selstartpos,
|
||||
t->setCursor(sstate.selstartpar, sstate.selstartpos,
|
||||
true, sstate.selstartboundary);
|
||||
t->selection.cursor = t->cursor;
|
||||
t->setCursor(bv, sstate.selendpar, sstate.selendpos,
|
||||
t->setCursor(sstate.selendpar, sstate.selendpos,
|
||||
true, sstate.selendboundary);
|
||||
t->setSelection(bv);
|
||||
t->setCursor(bv, sstate.lpar, sstate.pos);
|
||||
t->setSelection();
|
||||
t->setCursor(sstate.lpar, sstate.pos);
|
||||
} else {
|
||||
t->setCursor(bv, sstate.lpar, sstate.pos, true, sstate.boundary);
|
||||
t->setCursor(sstate.lpar, sstate.pos, true, sstate.boundary);
|
||||
t->selection.cursor = t->cursor;
|
||||
t->selection.set(false);
|
||||
}
|
||||
@ -434,17 +434,17 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
Row * prev = row->previous();
|
||||
RowPainter rp(*bv, *lt, *row);
|
||||
if (rp.paint(y + y_offset + first, int(x), y + lt->top_y()))
|
||||
lt->markChangeInDraw(bv, row, prev);
|
||||
lt->markChangeInDraw(row, prev);
|
||||
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||
lt->need_break_row = row;
|
||||
lt->fullRebreak(bv);
|
||||
lt->setCursor(bv, lt->cursor.par(),
|
||||
lt->fullRebreak();
|
||||
lt->setCursor(lt->cursor.par(),
|
||||
lt->cursor.pos());
|
||||
if (lt->selection.set()) {
|
||||
lt->setCursor(bv, lt->selection.start,
|
||||
lt->setCursor(lt->selection.start,
|
||||
lt->selection.start.par(),
|
||||
lt->selection.start.pos());
|
||||
lt->setCursor(bv, lt->selection.end,
|
||||
lt->setCursor(lt->selection.end,
|
||||
lt->selection.end.par(),
|
||||
lt->selection.end.pos());
|
||||
}
|
||||
@ -522,7 +522,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
if ((need_update & CURSOR_PAR) && (lt->status() == LyXText::UNCHANGED) &&
|
||||
the_locking_inset)
|
||||
{
|
||||
lt->updateInset(bv, the_locking_inset);
|
||||
lt->updateInset(the_locking_inset);
|
||||
}
|
||||
if (lt->status() == LyXText::NEED_MORE_REFRESH)
|
||||
need_update |= FULL;
|
||||
@ -567,7 +567,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
lt->fullRebreak(bv);
|
||||
lt->fullRebreak();
|
||||
setUpdateStatus(bv, what);
|
||||
bool flag = mark_dirty ||
|
||||
(((need_update != CURSOR) && (need_update != NONE)) ||
|
||||
@ -631,7 +631,7 @@ void InsetText::edit(BufferView * bv, int x, int y, mouse_button::state button)
|
||||
// cycle hopefully (Jug 20020509)
|
||||
// FIXME: GUII I've changed this to none: probably WRONG
|
||||
if (!checkAndActivateInset(bv, x, tmp_y, mouse_button::none)) {
|
||||
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
|
||||
lt->setCursorFromCoordinates(x - drawTextXOffset,
|
||||
y + insetAscent);
|
||||
lt->cursor.x_fix(lt->cursor.x());
|
||||
}
|
||||
@ -680,14 +680,14 @@ void InsetText::edit(BufferView * bv, bool front)
|
||||
clear = true;
|
||||
}
|
||||
if (front)
|
||||
lt->setCursor(bv, &*(paragraphs.begin()), 0);
|
||||
lt->setCursor(&*(paragraphs.begin()), 0);
|
||||
else {
|
||||
ParagraphList::iterator it = paragraphs.begin();
|
||||
ParagraphList::iterator end = paragraphs.end();
|
||||
while (boost::next(it) != end)
|
||||
++it;
|
||||
// int const pos = (p->size() ? p->size()-1 : p->size());
|
||||
lt->setCursor(bv, &*it, it->size());
|
||||
lt->setCursor(&*it, it->size());
|
||||
}
|
||||
lt->clearSelection();
|
||||
finishUndo();
|
||||
@ -736,9 +736,9 @@ void InsetText::insetUnlock(BufferView * bv)
|
||||
bv->owner()->setLayout(bv->text->cursor.par()->layout()->name());
|
||||
// hack for deleteEmptyParMech
|
||||
if (!paragraphs.begin()->empty()) {
|
||||
lt->setCursor(bv, &*(paragraphs.begin()), 0);
|
||||
lt->setCursor(&*(paragraphs.begin()), 0);
|
||||
} else if (paragraphs.begin()->next()) {
|
||||
lt->setCursor(bv, paragraphs.begin()->next(), 0);
|
||||
lt->setCursor(paragraphs.begin()->next(), 0);
|
||||
}
|
||||
if (clear)
|
||||
lt = 0;
|
||||
@ -764,7 +764,7 @@ void InsetText::lockInset(BufferView * bv)
|
||||
lt = getLyXText(bv);
|
||||
clear = true;
|
||||
}
|
||||
lt->setCursor(bv, &*(paragraphs.begin()), 0);
|
||||
lt->setCursor(&*(paragraphs.begin()), 0);
|
||||
lt->clearSelection();
|
||||
finishUndo();
|
||||
// If the inset is empty set the language of the current font to the
|
||||
@ -812,12 +812,12 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
||||
p->insetlist.end();
|
||||
for (; it != end; ++it) {
|
||||
if (it.getInset() == inset) {
|
||||
getLyXText(bv)->setCursorIntern(bv, p, it.getPos());
|
||||
getLyXText(bv)->setCursorIntern(p, it.getPos());
|
||||
lockInset(bv, inset);
|
||||
return true;
|
||||
}
|
||||
if (it.getInset()->getInsetFromID(id)) {
|
||||
getLyXText(bv)->setCursorIntern(bv, p, it.getPos());
|
||||
getLyXText(bv)->setCursorIntern(p, it.getPos());
|
||||
it.getInset()->edit(bv);
|
||||
return the_locking_inset->lockInsetInInset(bv, inset);
|
||||
}
|
||||
@ -854,7 +854,7 @@ bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
||||
return false;
|
||||
if (the_locking_inset == inset) {
|
||||
the_locking_inset->insetUnlock(bv);
|
||||
getLyXText(bv)->updateInset(bv, inset);
|
||||
getLyXText(bv)->updateInset(inset);
|
||||
the_locking_inset = 0;
|
||||
if (lr)
|
||||
moveRightIntern(bv, true, false);
|
||||
@ -896,14 +896,14 @@ bool InsetText::updateInsetInInset(BufferView * bv, Inset * inset)
|
||||
ustat = FULL;
|
||||
}
|
||||
if (found)
|
||||
lt->updateInset(bv, tl_inset);
|
||||
lt->updateInset(tl_inset);
|
||||
if (clear)
|
||||
lt = 0;
|
||||
if (found)
|
||||
setUpdateStatus(bv, ustat);
|
||||
return found;
|
||||
}
|
||||
bool found = lt->updateInset(bv, inset);
|
||||
bool found = lt->updateInset(inset);
|
||||
if (clear)
|
||||
lt = 0;
|
||||
if (found) {
|
||||
@ -936,7 +936,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
|
||||
int tmp_x = cmd.x - drawTextXOffset;
|
||||
int tmp_y = cmd.y + insetAscent - getLyXText(bv)->top_y();
|
||||
Inset * inset = getLyXText(bv)->checkInsetHit(bv, tmp_x, tmp_y);
|
||||
Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
|
||||
|
||||
hideInsetCursor(bv);
|
||||
if (the_locking_inset) {
|
||||
@ -992,7 +992,7 @@ void InsetText::lfunMousePress(FuncRequest const & cmd)
|
||||
}
|
||||
int old_top_y = lt->top_y();
|
||||
|
||||
lt->setCursorFromCoordinates(bv, cmd.x - drawTextXOffset,
|
||||
lt->setCursorFromCoordinates(cmd.x - drawTextXOffset,
|
||||
cmd.y + insetAscent);
|
||||
// set the selection cursor!
|
||||
lt->selection.cursor = lt->cursor;
|
||||
@ -1045,7 +1045,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
|
||||
|
||||
int tmp_x = cmd.x - drawTextXOffset;
|
||||
int tmp_y = cmd.y + insetAscent - getLyXText(bv)->top_y();
|
||||
Inset * inset = getLyXText(bv)->checkInsetHit(bv, tmp_x, tmp_y);
|
||||
Inset * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
|
||||
bool ret = false;
|
||||
if (inset) {
|
||||
if (isHighlyEditableInset(inset))
|
||||
@ -1089,14 +1089,14 @@ void InsetText::lfunMouseMotion(FuncRequest const & cmd)
|
||||
hideInsetCursor(bv);
|
||||
LyXCursor cur = lt->cursor;
|
||||
lt->setCursorFromCoordinates
|
||||
(bv, cmd.x - drawTextXOffset, cmd.y + insetAscent);
|
||||
(cmd.x - drawTextXOffset, cmd.y + insetAscent);
|
||||
lt->cursor.x_fix(lt->cursor.x());
|
||||
if (cur == lt->cursor) {
|
||||
if (clear)
|
||||
lt = 0;
|
||||
return;
|
||||
}
|
||||
lt->setSelection(bv);
|
||||
lt->setSelection();
|
||||
bool flag = (lt->toggle_cursor.par() != lt->toggle_end_cursor.par() ||
|
||||
lt->toggle_cursor.pos() != lt->toggle_end_cursor.pos());
|
||||
if (clear)
|
||||
@ -1198,7 +1198,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
bv->switchKeyMap();
|
||||
if (lyxrc.auto_region_delete) {
|
||||
if (lt->selection.set()) {
|
||||
lt->cutSelection(bv, false, false);
|
||||
lt->cutSelection(false, false);
|
||||
}
|
||||
}
|
||||
lt->clearSelection();
|
||||
@ -1216,7 +1216,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
case LFUN_RIGHTSEL:
|
||||
finishUndo();
|
||||
moveRight(bv, false, true);
|
||||
lt->setSelection(bv);
|
||||
lt->setSelection();
|
||||
updwhat = SELECTION;
|
||||
break;
|
||||
case LFUN_RIGHT:
|
||||
@ -1227,7 +1227,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
case LFUN_LEFTSEL:
|
||||
finishUndo();
|
||||
moveLeft(bv, false, true);
|
||||
lt->setSelection(bv);
|
||||
lt->setSelection();
|
||||
updwhat = SELECTION;
|
||||
break;
|
||||
case LFUN_LEFT:
|
||||
@ -1238,7 +1238,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
case LFUN_DOWNSEL:
|
||||
finishUndo();
|
||||
moveDown(bv);
|
||||
lt->setSelection(bv);
|
||||
lt->setSelection();
|
||||
updwhat = SELECTION;
|
||||
break;
|
||||
case LFUN_DOWN:
|
||||
@ -1249,7 +1249,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
case LFUN_UPSEL:
|
||||
finishUndo();
|
||||
moveUp(bv);
|
||||
lt->setSelection(bv);
|
||||
lt->setSelection();
|
||||
updwhat = SELECTION;
|
||||
break;
|
||||
case LFUN_UP:
|
||||
@ -1259,18 +1259,18 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
break;
|
||||
case LFUN_HOME:
|
||||
finishUndo();
|
||||
lt->cursorHome(bv);
|
||||
lt->cursorHome();
|
||||
updwhat = CURSOR;
|
||||
break;
|
||||
case LFUN_END:
|
||||
lt->cursorEnd(bv);
|
||||
lt->cursorEnd();
|
||||
updwhat = CURSOR;
|
||||
break;
|
||||
case LFUN_PRIOR:
|
||||
if (!crow(bv)->previous())
|
||||
result = FINISHED_UP;
|
||||
else {
|
||||
lt->cursorPrevious(bv);
|
||||
lt->cursorPrevious();
|
||||
result = DISPATCHED_NOUPDATE;
|
||||
}
|
||||
updwhat = CURSOR;
|
||||
@ -1279,16 +1279,16 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
if (!crow(bv)->next())
|
||||
result = FINISHED_DOWN;
|
||||
else {
|
||||
lt->cursorNext(bv);
|
||||
lt->cursorNext();
|
||||
result = DISPATCHED_NOUPDATE;
|
||||
}
|
||||
updwhat = CURSOR;
|
||||
break;
|
||||
case LFUN_BACKSPACE: {
|
||||
if (lt->selection.set())
|
||||
lt->cutSelection(bv, true, false);
|
||||
lt->cutSelection(true, false);
|
||||
else
|
||||
lt->backspace(bv);
|
||||
lt->backspace();
|
||||
updwhat = CURSOR_PAR;
|
||||
updflag = true;
|
||||
}
|
||||
@ -1296,9 +1296,9 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
|
||||
case LFUN_DELETE: {
|
||||
if (lt->selection.set()) {
|
||||
lt->cutSelection(bv, true, false);
|
||||
lt->cutSelection(true, false);
|
||||
} else {
|
||||
lt->Delete(bv);
|
||||
lt->Delete();
|
||||
}
|
||||
updwhat = CURSOR_PAR;
|
||||
updflag = true;
|
||||
@ -1314,7 +1314,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
|
||||
case LFUN_COPY:
|
||||
finishUndo();
|
||||
lt->copySelection(bv);
|
||||
lt->copySelection();
|
||||
updwhat = CURSOR_PAR;
|
||||
break;
|
||||
case LFUN_PASTESELECTION:
|
||||
@ -1324,9 +1324,9 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
if (clip.empty())
|
||||
break;
|
||||
if (ev.argument == "paragraph") {
|
||||
lt->insertStringAsParagraphs(bv, clip);
|
||||
lt->insertStringAsParagraphs(clip);
|
||||
} else {
|
||||
lt->insertStringAsLines(bv, clip);
|
||||
lt->insertStringAsLines(clip);
|
||||
}
|
||||
// bug 393
|
||||
lt->clearSelection();
|
||||
@ -1350,7 +1350,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
setUndo(bv, Undo::INSERT,
|
||||
lt->cursor.par(), lt->cursor.par()->next());
|
||||
#endif
|
||||
lt->pasteSelection(bv);
|
||||
lt->pasteSelection();
|
||||
// bug 393
|
||||
lt->clearSelection();
|
||||
updwhat = CURSOR_PAR;
|
||||
@ -1363,7 +1363,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
}
|
||||
lt->breakParagraph(bv, paragraphs, 0);
|
||||
lt->breakParagraph(paragraphs, 0);
|
||||
updwhat = CURSOR | FULL;
|
||||
updflag = true;
|
||||
break;
|
||||
@ -1372,7 +1372,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
}
|
||||
lt->breakParagraph(bv, paragraphs, 1);
|
||||
lt->breakParagraph(paragraphs, 1);
|
||||
updwhat = CURSOR | FULL;
|
||||
updflag = true;
|
||||
break;
|
||||
@ -1387,7 +1387,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
setUndo(bv, Undo::INSERT,
|
||||
lt->cursor.par(), lt->cursor.par()->next());
|
||||
#endif
|
||||
lt->insertInset(bv, new InsetNewline);
|
||||
lt->insertInset(new InsetNewline);
|
||||
updwhat = CURSOR | CURSOR_PAR;
|
||||
updflag = true;
|
||||
}
|
||||
@ -1422,7 +1422,7 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
|
||||
if (cur_layout != layout) {
|
||||
cur_layout = layout;
|
||||
lt->setLayout(bv, layout);
|
||||
lt->setLayout(layout);
|
||||
bv->owner()->setLayout(cpar(bv)->layout()->name());
|
||||
updwhat = CURSOR_PAR;
|
||||
updflag = true;
|
||||
@ -1859,7 +1859,7 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset)
|
||||
}
|
||||
inset->setOwner(this);
|
||||
hideInsetCursor(bv);
|
||||
getLyXText(bv)->insertInset(bv, inset);
|
||||
getLyXText(bv)->insertInset(inset);
|
||||
bv->fitCursor();
|
||||
updateLocal(bv, CURSOR_PAR|CURSOR, true);
|
||||
return true;
|
||||
@ -1936,7 +1936,7 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
||||
return;
|
||||
}
|
||||
if ((!paragraphs.begin()->next() && paragraphs.begin()->empty()) || cpar(bv)->empty()) {
|
||||
getLyXText(bv)->setFont(bv, font, toggleall);
|
||||
getLyXText(bv)->setFont(font, toggleall);
|
||||
return;
|
||||
}
|
||||
bool clear = false;
|
||||
@ -1949,7 +1949,7 @@ void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
||||
}
|
||||
if (selectall)
|
||||
selectAll(bv);
|
||||
lt->toggleFree(bv, font, toggleall);
|
||||
lt->toggleFree(font, toggleall);
|
||||
if (selectall)
|
||||
lt->clearSelection();
|
||||
bv->fitCursor();
|
||||
@ -1986,7 +1986,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
|
||||
x -= drawTextXOffset;
|
||||
int dummyx = x;
|
||||
int dummyy = y + insetAscent;
|
||||
Inset * inset = getLyXText(bv)->checkInsetHit(bv, dummyx, dummyy);
|
||||
Inset * inset = getLyXText(bv)->checkInsetHit(dummyx, dummyy);
|
||||
// we only do the edit() call if the inset was hit by the mouse
|
||||
// or if it is a highly editable inset. So we should call this
|
||||
// function from our own edit with button < 0.
|
||||
@ -2215,7 +2215,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
|
||||
// when we have to reinit the existing LyXText!
|
||||
//
|
||||
it->second.text->init(bv);
|
||||
restoreLyXTextState(bv, it->second.text.get());
|
||||
restoreLyXTextState(it->second.text.get());
|
||||
it->second.remove = false;
|
||||
}
|
||||
cached_text = it->second.text;
|
||||
@ -2227,9 +2227,9 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
|
||||
///
|
||||
// we are here only if we don't have a BufferView * in the cache!!!
|
||||
///
|
||||
cached_text.reset(new LyXText(const_cast<InsetText *>(this)));
|
||||
cached_text.reset(new LyXText(bv, const_cast<InsetText *>(this)));
|
||||
cached_text->init(bv);
|
||||
restoreLyXTextState(bv, cached_text.get());
|
||||
restoreLyXTextState(cached_text.get());
|
||||
|
||||
cache.insert(make_pair(bv, cached_text));
|
||||
|
||||
@ -2276,7 +2276,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
||||
LyXText * t = getLyXText(bv);
|
||||
saveLyXTextState(t);
|
||||
t->init(bv, true);
|
||||
restoreLyXTextState(bv, t);
|
||||
restoreLyXTextState(t);
|
||||
return;
|
||||
}
|
||||
// one endless line, resize normally not necessary
|
||||
@ -2296,7 +2296,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
||||
boost::bind(&Paragraph::resizeInsetsLyXText, _1, bv));
|
||||
|
||||
t->init(bv, true);
|
||||
restoreLyXTextState(bv, t);
|
||||
restoreLyXTextState(t);
|
||||
if (the_locking_inset) {
|
||||
inset_x = cix(bv) - top_x + drawTextXOffset;
|
||||
inset_y = ciy(bv) + drawTextYOffset;
|
||||
@ -2336,7 +2336,7 @@ void InsetText::reinitLyXText() const
|
||||
boost::bind(&Paragraph::resizeInsetsLyXText, _1, bv));
|
||||
|
||||
t->init(bv, true);
|
||||
restoreLyXTextState(bv, t);
|
||||
restoreLyXTextState(t);
|
||||
if (the_locking_inset) {
|
||||
inset_x = cix(bv) - top_x + drawTextXOffset;
|
||||
inset_y = ciy(bv) + drawTextYOffset;
|
||||
@ -2393,10 +2393,10 @@ int InsetText::scroll(bool recursive) const
|
||||
|
||||
void InsetText::selectAll(BufferView * bv)
|
||||
{
|
||||
getLyXText(bv)->cursorTop(bv);
|
||||
getLyXText(bv)->cursorTop();
|
||||
getLyXText(bv)->selection.cursor = getLyXText(bv)->cursor;
|
||||
getLyXText(bv)->cursorBottom(bv);
|
||||
getLyXText(bv)->setSelection(bv);
|
||||
getLyXText(bv)->cursorBottom();
|
||||
getLyXText(bv)->setSelection();
|
||||
}
|
||||
|
||||
|
||||
@ -2519,7 +2519,7 @@ InsetText::selectNextWordToSpellcheck(BufferView * bv,
|
||||
// we have to go on checking so move cursor to the next char
|
||||
lt->cursor.pos(lt->cursor.pos() + 1);
|
||||
}
|
||||
word = lt->selectNextWordToSpellcheck(bv, value);
|
||||
word = lt->selectNextWordToSpellcheck(value);
|
||||
if (word.word().empty())
|
||||
bv->unlockInset(const_cast<InsetText *>(this));
|
||||
else
|
||||
@ -2536,7 +2536,7 @@ void InsetText::selectSelectedWord(BufferView * bv)
|
||||
the_locking_inset->selectSelectedWord(bv);
|
||||
return;
|
||||
}
|
||||
getLyXText(bv)->selectSelectedWord(bv);
|
||||
getLyXText(bv)->selectSelectedWord();
|
||||
updateLocal(bv, SELECTION, false);
|
||||
}
|
||||
|
||||
@ -2582,7 +2582,7 @@ bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length)
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset->nextChange(bv, length))
|
||||
return true;
|
||||
lt->cursorRight(bv, true);
|
||||
lt->cursorRight(true);
|
||||
}
|
||||
lyxfind::SearchResult result =
|
||||
lyxfind::findNextChange(bv, lt, length);
|
||||
@ -2593,7 +2593,7 @@ bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length)
|
||||
if (bv->lockInset(this))
|
||||
locked = true;
|
||||
lt->cursor = cur;
|
||||
lt->setSelectionRange(bv, length);
|
||||
lt->setSelectionRange(length);
|
||||
updateLocal(bv, SELECTION, false);
|
||||
}
|
||||
if (clear)
|
||||
@ -2613,7 +2613,7 @@ bool InsetText::searchForward(BufferView * bv, string const & str,
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset->searchForward(bv, str, cs, mw))
|
||||
return true;
|
||||
lt->cursorRight(bv, true);
|
||||
lt->cursorRight(true);
|
||||
}
|
||||
lyxfind::SearchResult result =
|
||||
lyxfind::LyXFind(bv, lt, str, true, cs, mw);
|
||||
@ -2624,7 +2624,7 @@ bool InsetText::searchForward(BufferView * bv, string const & str,
|
||||
if (bv->lockInset(this))
|
||||
locked = true;
|
||||
lt->cursor = cur;
|
||||
lt->setSelectionRange(bv, str.length());
|
||||
lt->setSelectionRange(str.length());
|
||||
updateLocal(bv, SELECTION, false);
|
||||
}
|
||||
if (clear)
|
||||
@ -2648,7 +2648,7 @@ bool InsetText::searchBackward(BufferView * bv, string const & str,
|
||||
Paragraph * p = &*(paragraphs.begin());
|
||||
while (p->next())
|
||||
p = p->next();
|
||||
lt->setCursor(bv, p, p->size());
|
||||
lt->setCursor(p, p->size());
|
||||
}
|
||||
lyxfind::SearchResult result =
|
||||
lyxfind::LyXFind(bv, lt, str, false, cs, mw);
|
||||
@ -2659,7 +2659,7 @@ bool InsetText::searchBackward(BufferView * bv, string const & str,
|
||||
if (bv->lockInset(this))
|
||||
locked = true;
|
||||
lt->cursor = cur;
|
||||
lt->setSelectionRange(bv, str.length());
|
||||
lt->setSelectionRange(str.length());
|
||||
updateLocal(bv, SELECTION, false);
|
||||
}
|
||||
if (clear)
|
||||
|
@ -348,7 +348,7 @@ private:
|
||||
///
|
||||
void saveLyXTextState(LyXText *) const;
|
||||
///
|
||||
void restoreLyXTextState(BufferView *, LyXText *) const;
|
||||
void restoreLyXTextState(LyXText *) const;
|
||||
///
|
||||
void reinitLyXText() const;
|
||||
///
|
||||
|
@ -167,7 +167,7 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
|
||||
w = static_cast<UpdatableInset*>
|
||||
(owner())->getMaxWidth(bv, this);
|
||||
} else {
|
||||
w = bv->text->workWidth(*bv, const_cast<UpdatableInset *>(this));
|
||||
w = bv->text->workWidth(const_cast<UpdatableInset *>(this));
|
||||
}
|
||||
if (w < 0) {
|
||||
return -1;
|
||||
|
@ -404,9 +404,9 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
|
||||
if (flag)
|
||||
bv->beforeChange(bv->text);
|
||||
if (!asParagraph)
|
||||
bv->getLyXText()->insertStringAsLines(bv, tmpstr);
|
||||
bv->getLyXText()->insertStringAsLines(tmpstr);
|
||||
else
|
||||
bv->getLyXText()->insertStringAsParagraphs(bv, tmpstr);
|
||||
bv->getLyXText()->insertStringAsParagraphs(tmpstr);
|
||||
if (flag)
|
||||
bv->update(bv->text,
|
||||
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
|
@ -57,7 +57,7 @@ int LyXReplace(BufferView * bv,
|
||||
text->clearSelection();
|
||||
bv->unlockInset(bv->theLockingInset());
|
||||
text = bv->text;
|
||||
text->cursorTop(bv);
|
||||
text->cursorTop();
|
||||
// override search direction because we search top to bottom
|
||||
fw = true;
|
||||
}
|
||||
@ -94,8 +94,8 @@ int LyXReplace(BufferView * bv,
|
||||
bv->hideCursor();
|
||||
bv->update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
bv->toggleSelection(false);
|
||||
text->replaceSelectionWithString(bv, replacestr);
|
||||
text->setSelectionRange(bv, replacestr.length());
|
||||
text->replaceSelectionWithString(replacestr);
|
||||
text->setSelectionRange(replacestr.length());
|
||||
bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||
++replace_count;
|
||||
}
|
||||
@ -128,7 +128,7 @@ bool LyXFind(BufferView * bv,
|
||||
// We now are in the main text but if we did a forward
|
||||
// search we have to put the cursor behind the inset.
|
||||
if (forward) {
|
||||
bv->text->cursorRight(bv, true);
|
||||
bv->text->cursorRight(true);
|
||||
}
|
||||
}
|
||||
// If we arrive here we are in the main text again so we
|
||||
@ -154,7 +154,7 @@ bool LyXFind(BufferView * bv,
|
||||
if (result == SR_FOUND) {
|
||||
bv->unlockInset(bv->theLockingInset());
|
||||
bv->update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
text->setSelectionRange(bv, searchstr.length());
|
||||
text->setSelectionRange(searchstr.length());
|
||||
bv->toggleSelection(false);
|
||||
bv->update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
} else if (result == SR_NOT_FOUND) {
|
||||
@ -251,12 +251,12 @@ SearchResult SearchForward(BufferView * bv, LyXText * text, string const & str,
|
||||
}
|
||||
|
||||
if (par) {
|
||||
text->setCursor(bv, par, pos);
|
||||
text->setCursor(par, pos);
|
||||
return SR_FOUND;
|
||||
} else {
|
||||
// make sure we end up at the end of the text,
|
||||
// not the start point of the last search
|
||||
text->setCursor(bv, prev_par, prev_par->size());
|
||||
text->setCursor(prev_par, prev_par->size());
|
||||
return SR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
@ -301,11 +301,11 @@ SearchResult SearchBackward(BufferView * bv, LyXText * text,
|
||||
} while (par && !IsStringInText(par, pos, str, cs, mw));
|
||||
|
||||
if (par) {
|
||||
text->setCursor(bv, par, pos);
|
||||
text->setCursor(par, pos);
|
||||
return SR_FOUND;
|
||||
} else {
|
||||
// go to the last part of the unsuccessful search
|
||||
text->setCursor(bv, prev_par, 0);
|
||||
text->setCursor(prev_par, 0);
|
||||
return SR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,7 @@ SearchResult nextChange(BufferView * bv, LyXText * text, pos_type & length)
|
||||
}
|
||||
|
||||
if (par) {
|
||||
text->setCursor(bv, par, pos);
|
||||
text->setCursor(par, pos);
|
||||
Change orig_change = par->lookupChangeFull(pos);
|
||||
pos_type end = pos;
|
||||
|
||||
@ -359,7 +359,7 @@ SearchResult nextChange(BufferView * bv, LyXText * text, pos_type & length)
|
||||
} else {
|
||||
// make sure we end up at the end of the text,
|
||||
// not the start point of the last search
|
||||
text->setCursor(bv, prev_par, prev_par->size());
|
||||
text->setCursor(prev_par, prev_par->size());
|
||||
return SR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
@ -397,7 +397,7 @@ bool findNextChange(BufferView * bv)
|
||||
|
||||
// We now are in the main text but if we did a forward
|
||||
// search we have to put the cursor behind the inset.
|
||||
bv->text->cursorRight(bv, true);
|
||||
bv->text->cursorRight(true);
|
||||
}
|
||||
// If we arrive here we are in the main text again so we
|
||||
// just start searching from the root LyXText at the position
|
||||
@ -422,7 +422,7 @@ bool findNextChange(BufferView * bv)
|
||||
if (result == SR_FOUND) {
|
||||
bv->unlockInset(bv->theLockingInset());
|
||||
bv->update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
text->setSelectionRange(bv, length);
|
||||
text->setSelectionRange(length);
|
||||
bv->toggleSelection(false);
|
||||
bv->update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
} else if (result == SR_NOT_FOUND) {
|
||||
|
@ -121,8 +121,8 @@ inline
|
||||
void LyXFunc::moveCursorUpdate(bool flag, bool selecting)
|
||||
{
|
||||
if (selecting || TEXT(flag)->selection.mark()) {
|
||||
TEXT(flag)->setSelection(view());
|
||||
if (TEXT(flag)->isTopLevel())
|
||||
TEXT(flag)->setSelection();
|
||||
if (!TEXT(flag)->isInInset())
|
||||
view()->toggleToggle();
|
||||
}
|
||||
view()->update(TEXT(flag), BufferView::SELECT|BufferView::FITCUR);
|
||||
@ -825,7 +825,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
if (TEXT()->cursor.irow()->previous()) {
|
||||
#if 1
|
||||
TEXT()->setCursorFromCoordinates(
|
||||
view(), TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.iy() -
|
||||
TEXT()->cursor.irow()->baseline() - 1);
|
||||
TEXT()->cursor.x_fix(TEXT()->cursor.x());
|
||||
@ -842,7 +842,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
if (TEXT()->cursor.irow()->next()) {
|
||||
#if 1
|
||||
TEXT()->setCursorFromCoordinates(
|
||||
view(), TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.ix() + inset_x,
|
||||
TEXT()->cursor.iy() -
|
||||
TEXT()->cursor.irow()->baseline() +
|
||||
TEXT()->cursor.irow()->height() + 1);
|
||||
@ -1336,7 +1336,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
par->inInset()->edit(view());
|
||||
}
|
||||
// Set the cursor
|
||||
view()->getLyXText()->setCursor(view(), par, 0);
|
||||
view()->getLyXText()->setCursor(par, 0);
|
||||
view()->switchKeyMap();
|
||||
owner->view_state_changed();
|
||||
|
||||
|
204
src/lyxtext.h
204
src/lyxtext.h
@ -69,7 +69,7 @@ public:
|
||||
/// Constructor
|
||||
LyXText(BufferView *);
|
||||
/// sets inset as owner
|
||||
LyXText(InsetText *);
|
||||
LyXText(BufferView *, InsetText *);
|
||||
|
||||
/// Destructor
|
||||
~LyXText();
|
||||
@ -103,7 +103,7 @@ public:
|
||||
UpdatableInset * the_locking_inset;
|
||||
|
||||
///
|
||||
int getRealCursorX(BufferView *) const;
|
||||
int getRealCursorX() const;
|
||||
///
|
||||
LyXFont const getFont(Buffer const *, Paragraph * par,
|
||||
lyx::pos_type pos) const;
|
||||
@ -114,35 +114,34 @@ public:
|
||||
///
|
||||
void setCharFont(Buffer const *, Paragraph * par,
|
||||
lyx::pos_type pos, LyXFont const & font);
|
||||
void setCharFont(BufferView *, Paragraph * par,
|
||||
void setCharFont(Paragraph * par,
|
||||
lyx::pos_type pos, LyXFont const & font, bool toggleall);
|
||||
|
||||
/// return true if the row changed
|
||||
void markChangeInDraw(BufferView * bv, Row * row, Row * next);
|
||||
void markChangeInDraw(Row * row, Row * next);
|
||||
///
|
||||
void breakAgainOneRow(BufferView *, Row * row);
|
||||
void breakAgainOneRow(Row * row);
|
||||
/// what you expect when pressing <enter> at cursor position
|
||||
void breakParagraph(BufferView *,
|
||||
ParagraphList & paragraphs, char keep_layout = 0);
|
||||
void breakParagraph(ParagraphList & paragraphs, char keep_layout = 0);
|
||||
|
||||
/** set layout over selection and make a total rebreak of
|
||||
those paragraphs
|
||||
*/
|
||||
Paragraph * setLayout(BufferView *, LyXCursor & actual_cursor,
|
||||
Paragraph * setLayout(LyXCursor & actual_cursor,
|
||||
LyXCursor & selection_start,
|
||||
LyXCursor & selection_end,
|
||||
string const & layout);
|
||||
///
|
||||
void setLayout(BufferView *, string const & layout);
|
||||
void setLayout(string const & layout);
|
||||
|
||||
/** increment depth over selection and make a total rebreak of those
|
||||
paragraphs
|
||||
*/
|
||||
void incDepth(BufferView *);
|
||||
void incDepth();
|
||||
|
||||
/** decrement depth over selection and make a total rebreak of those
|
||||
paragraphs */
|
||||
void decDepth(BufferView *);
|
||||
void decDepth();
|
||||
|
||||
/// get the depth at current cursor position
|
||||
int getDepth() const;
|
||||
@ -151,39 +150,39 @@ public:
|
||||
paragraphs.
|
||||
toggleall defaults to false.
|
||||
*/
|
||||
void setFont(BufferView *, LyXFont const &, bool toggleall = false);
|
||||
void setFont(LyXFont const &, bool toggleall = false);
|
||||
|
||||
/** deletes and inserts again all paragaphs between the cursor
|
||||
and the specified par. The Cursor is needed to set the refreshing
|
||||
parameters.
|
||||
This function is needed after SetLayout and SetFont etc.
|
||||
*/
|
||||
void redoParagraphs(BufferView *, LyXCursor const & cursor,
|
||||
void redoParagraphs(LyXCursor const & cursor,
|
||||
Paragraph const * end_par) const;
|
||||
///
|
||||
void redoParagraph(BufferView *) const;
|
||||
void redoParagraph() const;
|
||||
|
||||
///
|
||||
void toggleFree(BufferView *, LyXFont const &, bool toggleall = false);
|
||||
void toggleFree(LyXFont const &, bool toggleall = false);
|
||||
|
||||
///
|
||||
string getStringToIndex(BufferView *);
|
||||
string getStringToIndex();
|
||||
|
||||
/** recalculates the heights of all previous rows of the
|
||||
specified paragraph. needed, if the last characters font
|
||||
has changed.
|
||||
*/
|
||||
void redoHeightOfParagraph(BufferView *);
|
||||
void redoHeightOfParagraph();
|
||||
|
||||
/** insert a character, moves all the following breaks in the
|
||||
same Paragraph one to the right and make a little rebreak
|
||||
*/
|
||||
void insertChar(BufferView *, char c);
|
||||
void insertChar(char c);
|
||||
///
|
||||
void insertInset(BufferView *, Inset * inset);
|
||||
void insertInset(Inset * inset);
|
||||
|
||||
/// Completes the insertion with a full rebreak
|
||||
void fullRebreak(BufferView *);
|
||||
void fullRebreak();
|
||||
|
||||
///
|
||||
mutable Row * need_break_row;
|
||||
@ -197,16 +196,20 @@ public:
|
||||
/**
|
||||
* Mark position y as the starting point for a repaint
|
||||
*/
|
||||
void postPaint(BufferView & bv, int start_y);
|
||||
void postPaint(int start_y);
|
||||
|
||||
/**
|
||||
* Mark the given row at position y as needing a repaint.
|
||||
*/
|
||||
void postRowPaint(BufferView & bv, Row * row, int start_y);
|
||||
void postRowPaint(Row * row, int start_y);
|
||||
|
||||
///
|
||||
Inset::RESULT dispatch(FuncRequest const & cmd);
|
||||
|
||||
BufferView * bv();
|
||||
|
||||
BufferView * bv() const;
|
||||
|
||||
friend class LyXScreen;
|
||||
|
||||
/**
|
||||
@ -247,7 +250,7 @@ public:
|
||||
/** returns the column near the specified x-coordinate of the row
|
||||
x is set to the real beginning of this column
|
||||
*/
|
||||
lyx::pos_type getColumnNearX(BufferView *, Row * row,
|
||||
lyx::pos_type getColumnNearX(Row * row,
|
||||
int & x, bool & boundary) const;
|
||||
|
||||
/** returns a pointer to a specified row. y is set to the beginning
|
||||
@ -309,7 +312,7 @@ public:
|
||||
mutable LyXCursor toggle_end_cursor;
|
||||
|
||||
/// need the selection cursor:
|
||||
void setSelection(BufferView *);
|
||||
void setSelection();
|
||||
///
|
||||
void clearSelection() const;
|
||||
///
|
||||
@ -319,40 +322,40 @@ public:
|
||||
void getWord(LyXCursor & from, LyXCursor & to,
|
||||
word_location const) const;
|
||||
/// just selects the word the cursor is in
|
||||
void selectWord(BufferView *, word_location const);
|
||||
void selectWord(word_location const);
|
||||
/// returns the inset at cursor (if it exists), 0 otherwise
|
||||
Inset * getInset() const;
|
||||
|
||||
/// accept selected change
|
||||
void acceptChange(BufferView * bv);
|
||||
void acceptChange();
|
||||
|
||||
/// reject selected change
|
||||
void rejectChange(BufferView * bv);
|
||||
void rejectChange();
|
||||
|
||||
/** 'selects" the next word, where the cursor is not in
|
||||
and returns this word as string. THe cursor will be moved
|
||||
to the beginning of this word.
|
||||
With SelectSelectedWord can this be highlighted really
|
||||
*/
|
||||
WordLangTuple const selectNextWordToSpellcheck(BufferView *, float & value) const;
|
||||
WordLangTuple const selectNextWordToSpellcheck(float & value) const;
|
||||
///
|
||||
void selectSelectedWord(BufferView *);
|
||||
void selectSelectedWord();
|
||||
/// returns true if par was empty and was removed
|
||||
bool setCursor(BufferView *, Paragraph * par,
|
||||
bool setCursor(Paragraph * par,
|
||||
lyx::pos_type pos,
|
||||
bool setfont = true,
|
||||
bool boundary = false) const;
|
||||
///
|
||||
void setCursor(BufferView *, LyXCursor &, Paragraph * par,
|
||||
void setCursor(LyXCursor &, Paragraph * par,
|
||||
lyx::pos_type pos,
|
||||
bool boundary = false) const;
|
||||
///
|
||||
void setCursorIntern(BufferView *, Paragraph * par,
|
||||
void setCursorIntern(Paragraph * par,
|
||||
lyx::pos_type pos,
|
||||
bool setfont = true,
|
||||
bool boundary = false) const;
|
||||
///
|
||||
void setCurrentFont(BufferView *) const;
|
||||
void setCurrentFont() const;
|
||||
|
||||
///
|
||||
bool isBoundary(Buffer const *, Paragraph * par,
|
||||
@ -363,47 +366,46 @@ public:
|
||||
LyXFont const & font) const;
|
||||
|
||||
///
|
||||
void setCursorFromCoordinates(BufferView *, int x, int y) const;
|
||||
void setCursorFromCoordinates(int x, int y) const;
|
||||
///
|
||||
void setCursorFromCoordinates(BufferView *, LyXCursor &,
|
||||
void setCursorFromCoordinates(LyXCursor &,
|
||||
int x, int y) const;
|
||||
///
|
||||
void cursorUp(BufferView *, bool selecting = false) const;
|
||||
void cursorUp(bool selecting = false) const;
|
||||
///
|
||||
void cursorDown(BufferView *, bool selecting = false) const;
|
||||
void cursorDown(bool selecting = false) const;
|
||||
///
|
||||
void cursorLeft(BufferView *, bool internal = true) const;
|
||||
void cursorLeft(bool internal = true) const;
|
||||
///
|
||||
void cursorRight(BufferView *, bool internal = true) const;
|
||||
void cursorRight(bool internal = true) const;
|
||||
///
|
||||
void cursorLeftOneWord(BufferView *) const;
|
||||
void cursorLeftOneWord() const;
|
||||
///
|
||||
void cursorRightOneWord(BufferView *) const;
|
||||
void cursorRightOneWord() const;
|
||||
///
|
||||
void cursorUpParagraph(BufferView *) const;
|
||||
void cursorUpParagraph() const;
|
||||
///
|
||||
void cursorDownParagraph(BufferView *) const;
|
||||
void cursorDownParagraph() const;
|
||||
///
|
||||
void cursorHome(BufferView *) const;
|
||||
void cursorHome() const;
|
||||
///
|
||||
void cursorEnd(BufferView *) const;
|
||||
void cursorEnd() const;
|
||||
///
|
||||
void cursorPrevious(BufferView * bv);
|
||||
void cursorPrevious();
|
||||
///
|
||||
void cursorNext(BufferView * bv);
|
||||
void cursorNext();
|
||||
///
|
||||
void cursorTab(BufferView *) const;
|
||||
void cursorTab() const;
|
||||
///
|
||||
void cursorTop(BufferView *) const;
|
||||
void cursorTop() const;
|
||||
///
|
||||
void cursorBottom(BufferView *) const;
|
||||
void cursorBottom() const;
|
||||
///
|
||||
void Delete(BufferView *);
|
||||
void Delete();
|
||||
///
|
||||
void backspace(BufferView *);
|
||||
void backspace();
|
||||
///
|
||||
bool selectWordWhenUnderCursor(BufferView *,
|
||||
word_location const);
|
||||
bool selectWordWhenUnderCursor(word_location);
|
||||
///
|
||||
enum TextCase {
|
||||
///
|
||||
@ -414,22 +416,22 @@ public:
|
||||
text_uppercase = 2
|
||||
};
|
||||
/// Change the case of the word at cursor position.
|
||||
void changeCase(BufferView &, TextCase action);
|
||||
void changeCase(TextCase action);
|
||||
///
|
||||
void transposeChars(BufferView &);
|
||||
void transposeChars();
|
||||
|
||||
///
|
||||
void toggleInset(BufferView *);
|
||||
void toggleInset();
|
||||
///
|
||||
void cutSelection(BufferView *, bool doclear = true, bool realcut = true);
|
||||
void cutSelection(bool doclear = true, bool realcut = true);
|
||||
///
|
||||
void copySelection(BufferView *);
|
||||
void copySelection();
|
||||
///
|
||||
void pasteSelection(BufferView *);
|
||||
void pasteSelection();
|
||||
///
|
||||
void copyEnvironmentType();
|
||||
///
|
||||
void pasteEnvironmentType(BufferView *);
|
||||
void pasteEnvironmentType();
|
||||
|
||||
/** the DTP switches for paragraphs. LyX will store the top settings
|
||||
always in the first physical paragraph, the bottom settings in the
|
||||
@ -437,14 +439,13 @@ public:
|
||||
settings are given to the new one. So I can make shure, they do not
|
||||
duplicate themself (and you cannnot make dirty things with them! )
|
||||
*/
|
||||
void setParagraph(BufferView *,
|
||||
bool line_top, bool line_bottom,
|
||||
void setParagraph(bool line_top, bool line_bottom,
|
||||
bool pagebreak_top, bool pagebreak_bottom,
|
||||
VSpace const & space_top,
|
||||
VSpace const & space_bottom,
|
||||
Spacing const & spacing,
|
||||
LyXAlignment align,
|
||||
string labelwidthstring,
|
||||
string const & labelwidthstring,
|
||||
bool noindent);
|
||||
|
||||
/* these things are for search and replace */
|
||||
@ -453,38 +454,38 @@ public:
|
||||
* Sets the selection from the current cursor position to length
|
||||
* characters to the right. No safety checks.
|
||||
*/
|
||||
void setSelectionRange(BufferView *, lyx::pos_type length);
|
||||
void setSelectionRange(lyx::pos_type length);
|
||||
|
||||
/** simple replacing. The font of the first selected character
|
||||
is used
|
||||
*/
|
||||
void replaceSelectionWithString(BufferView *, string const & str);
|
||||
void replaceSelectionWithString(string const & str);
|
||||
|
||||
/// needed to insert the selection
|
||||
void insertStringAsLines(BufferView *, string const & str);
|
||||
void insertStringAsLines(string const & str);
|
||||
/// needed to insert the selection
|
||||
void insertStringAsParagraphs(BufferView *, string const & str);
|
||||
void insertStringAsParagraphs(string const & str);
|
||||
|
||||
/// Find next inset of some specified type.
|
||||
bool gotoNextInset(BufferView *, std::vector<Inset::Code> const & codes,
|
||||
bool gotoNextInset(std::vector<Inset::Code> const & codes,
|
||||
string const & contents = string()) const;
|
||||
///
|
||||
void gotoInset(BufferView * bv, std::vector<Inset::Code> const & codes,
|
||||
void gotoInset(std::vector<Inset::Code> const & codes,
|
||||
bool same_content);
|
||||
///
|
||||
void gotoInset(BufferView * bv, Inset::Code code, bool same_content);
|
||||
void gotoInset(Inset::Code code, bool same_content);
|
||||
///
|
||||
|
||||
/* for the greater insets */
|
||||
|
||||
/// returns false if inset wasn't found
|
||||
bool updateInset(BufferView *, Inset *);
|
||||
bool updateInset(Inset *);
|
||||
///
|
||||
void checkParagraph(BufferView *, Paragraph * par, lyx::pos_type pos);
|
||||
void checkParagraph(Paragraph * par, lyx::pos_type pos);
|
||||
///
|
||||
int workWidth(BufferView &) const;
|
||||
int workWidth() const;
|
||||
///
|
||||
int workWidth(BufferView &, Inset * inset) const;
|
||||
int workWidth(Inset * inset) const;
|
||||
///
|
||||
void computeBidiTables(Buffer const *, Row * row) const;
|
||||
|
||||
@ -529,7 +530,7 @@ private:
|
||||
void cursorLeftOneWord(LyXCursor &) const;
|
||||
|
||||
///
|
||||
float getCursorX(BufferView *, Row *, lyx::pos_type pos,
|
||||
float getCursorX(Row *, lyx::pos_type pos,
|
||||
lyx::pos_type last, bool boundary) const;
|
||||
/// used in setlayout
|
||||
void makeFontEntriesLayoutSpecific(Buffer const &, Paragraph & par);
|
||||
@ -537,7 +538,7 @@ private:
|
||||
/** forces the redrawing of a paragraph. Needed when manipulating a
|
||||
right address box
|
||||
*/
|
||||
void redoDrawingOfParagraph(BufferView *, LyXCursor const & cursor);
|
||||
void redoDrawingOfParagraph(LyXCursor const & cursor);
|
||||
|
||||
/** Copybuffer for copy environment type.
|
||||
Asger has learned that this should be a buffer-property instead
|
||||
@ -555,45 +556,42 @@ private:
|
||||
void removeParagraph(Row * row) const;
|
||||
|
||||
/// insert the specified paragraph behind the specified row
|
||||
void insertParagraph(BufferView *,
|
||||
Paragraph * par, Row * row) const;
|
||||
void insertParagraph(Paragraph * par, Row * row) const;
|
||||
|
||||
/** appends the implizit specified paragraph behind the specified row,
|
||||
* start at the implizit given position */
|
||||
void appendParagraph(BufferView *, Row * row) const;
|
||||
void appendParagraph(Row * row) const;
|
||||
|
||||
///
|
||||
void breakAgain(BufferView *, Row * row) const;
|
||||
void breakAgain(Row * row) const;
|
||||
/// Calculate and set the height of the row
|
||||
void setHeightOfRow(BufferView *, Row * row_ptr) const;
|
||||
void setHeightOfRow(Row * row_ptr) const;
|
||||
|
||||
// fix the cursor `cur' after a characters has been deleted at `where'
|
||||
// position. Called by deleteEmptyParagraphMechanism
|
||||
void fixCursorAfterDelete(BufferView * bv,
|
||||
LyXCursor & cur,
|
||||
void fixCursorAfterDelete(LyXCursor & cur,
|
||||
LyXCursor const & where) const;
|
||||
|
||||
/// delete double space (false) or empty paragraphs (true) around old_cursor
|
||||
bool deleteEmptyParagraphMechanism(BufferView *,
|
||||
LyXCursor const & old_cursor) const;
|
||||
bool deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const;
|
||||
|
||||
public:
|
||||
/** Updates all counters starting BEHIND the row. Changed paragraphs
|
||||
* with a dynamic left margin will be rebroken. */
|
||||
void updateCounters(BufferView *) const;
|
||||
void updateCounters() const;
|
||||
///
|
||||
void update(BufferView * bv, bool changed = true);
|
||||
void update(bool changed = true);
|
||||
/**
|
||||
* Returns an inset if inset was hit, or 0 if not.
|
||||
* If hit, the coordinates are changed relative to the inset.
|
||||
*/
|
||||
Inset * checkInsetHit(BufferView * bv, int & x, int & y) const;
|
||||
Inset * checkInsetHit(int & x, int & y) const;
|
||||
|
||||
///
|
||||
int singleWidth(BufferView *, Paragraph * par,
|
||||
int singleWidth(Paragraph * par,
|
||||
lyx::pos_type pos) const;
|
||||
///
|
||||
int singleWidth(BufferView *, Paragraph * par,
|
||||
int singleWidth(Paragraph * par,
|
||||
lyx::pos_type pos, char c) const;
|
||||
|
||||
/// return the color of the canvas
|
||||
@ -611,13 +609,13 @@ public:
|
||||
* in LaTeX the beginning of the text fits in some cases
|
||||
* (for example sections) exactly the label-width.
|
||||
*/
|
||||
int leftMargin(BufferView *, Row const * row) const;
|
||||
int leftMargin(Row const * row) const;
|
||||
///
|
||||
int rightMargin(Buffer const &, Row const & row) const;
|
||||
|
||||
/** this calculates the specified parameters. needed when setting
|
||||
* the cursor and when creating a visible row */
|
||||
void prepareToPrint(BufferView *, Row * row, float & x,
|
||||
void prepareToPrint(Row * row, float & x,
|
||||
float & fill_separator,
|
||||
float & fill_hfill,
|
||||
float & fill_label_hfill,
|
||||
@ -627,11 +625,11 @@ private:
|
||||
///
|
||||
void setCounter(Buffer const *, Paragraph * par) const;
|
||||
///
|
||||
void deleteWordForward(BufferView *);
|
||||
void deleteWordForward();
|
||||
///
|
||||
void deleteWordBackward(BufferView *);
|
||||
void deleteWordBackward();
|
||||
///
|
||||
void deleteLineForward(BufferView *);
|
||||
void deleteLineForward();
|
||||
|
||||
/*
|
||||
* some low level functions
|
||||
@ -640,19 +638,19 @@ private:
|
||||
|
||||
/// return the pos value *before* which a row should break.
|
||||
/// for example, the pos at which IsNewLine(pos) == true
|
||||
lyx::pos_type rowBreakPoint(BufferView &, Row const & row) const;
|
||||
lyx::pos_type rowBreakPoint(Row const & row) const;
|
||||
|
||||
/// returns the minimum space a row needs on the screen in pixel
|
||||
int fill(BufferView &, Row & row, int workwidth) const;
|
||||
int fill(Row & row, int workwidth) const;
|
||||
|
||||
/**
|
||||
* returns the minimum space a manual label needs on the
|
||||
* screen in pixels
|
||||
*/
|
||||
int labelFill(BufferView &, Row const & row) const;
|
||||
int labelFill(Row const & row) const;
|
||||
|
||||
/// FIXME
|
||||
int labelEnd(BufferView &, Row const & row) const;
|
||||
int labelEnd(Row const & row) const;
|
||||
|
||||
///
|
||||
mutable std::vector<lyx::pos_type> log2vis_list;
|
||||
@ -681,11 +679,7 @@ public:
|
||||
// set it searching first for the right owner using the paragraph id
|
||||
void ownerParagraph(int id, Paragraph *) const;
|
||||
|
||||
/// return true if this is the outer-most lyxtext
|
||||
bool isTopLevel() const;
|
||||
|
||||
/// return true if this is owned by an inset. FIXME: why the difference
|
||||
/// with isTopLevel() ??
|
||||
/// return true if this is owned by an inset.
|
||||
bool isInInset() const;
|
||||
};
|
||||
|
||||
|
@ -69,17 +69,15 @@ LyXFont const RowPainter::getFont(pos_type pos) const
|
||||
|
||||
int RowPainter::singleWidth(lyx::pos_type pos) const
|
||||
{
|
||||
BufferView * bv(perv(bv_));
|
||||
Paragraph * par(const_cast<Paragraph*>(&par_));
|
||||
return text_.singleWidth(bv, par, pos);
|
||||
return text_.singleWidth(par, pos);
|
||||
}
|
||||
|
||||
|
||||
int RowPainter::singleWidth(lyx::pos_type pos, char c) const
|
||||
{
|
||||
BufferView * bv(perv(bv_));
|
||||
Paragraph * par(const_cast<Paragraph*>(&par_));
|
||||
return text_.singleWidth(bv, par, pos, c);
|
||||
return text_.singleWidth(par, pos, c);
|
||||
}
|
||||
|
||||
|
||||
@ -99,9 +97,8 @@ char const RowPainter::transformChar(char c, lyx::pos_type pos) const
|
||||
|
||||
int RowPainter::leftMargin() const
|
||||
{
|
||||
BufferView * bv(perv(bv_));
|
||||
Row * row(const_cast<Row *>(&row_));
|
||||
return text_.leftMargin(bv, row);
|
||||
return text_.leftMargin(row);
|
||||
}
|
||||
|
||||
|
||||
@ -631,7 +628,7 @@ void RowPainter::paintFirst()
|
||||
}
|
||||
|
||||
// the top margin
|
||||
if (!row_.previous() && text_.isTopLevel())
|
||||
if (!row_.previous() && !text_.isInInset())
|
||||
y_top += PAPER_MARGIN;
|
||||
|
||||
// draw a top pagebreak
|
||||
@ -778,7 +775,7 @@ void RowPainter::paintLast()
|
||||
int y_bottom = row_.height() - 1;
|
||||
|
||||
// the bottom margin
|
||||
if (!row_.next() && text_.isTopLevel())
|
||||
if (!row_.next() && !text_.isInInset())
|
||||
y_bottom -= PAPER_MARGIN;
|
||||
|
||||
int const ww = bv_.workWidth();
|
||||
@ -980,9 +977,8 @@ bool RowPainter::paint(int y_offset, int x_offset, int y)
|
||||
|
||||
// FIXME: must be a cleaner way here. Aren't these calculations
|
||||
// belonging to row metrics ?
|
||||
BufferView * bv(const_cast<BufferView *>(&bv_));
|
||||
Row * row(const_cast<Row *>(&row_));
|
||||
text_.prepareToPrint(bv, row, x_, separator_, hfill_, label_hfill_);
|
||||
text_.prepareToPrint(row, x_, separator_, hfill_, label_hfill_);
|
||||
|
||||
// FIXME: what is this fixing ?
|
||||
if (text_.isInInset() && (x_ < 0))
|
||||
|
@ -46,19 +46,20 @@ void parse(Parser & p, ostream & os, unsigned flags, const mode_type mode);
|
||||
char const OPEN = '<';
|
||||
char const CLOSE = '>';
|
||||
|
||||
// rather brutish way to code table structure in a string:
|
||||
//
|
||||
// \begin{tabular}{ccc}
|
||||
// 1 & 2 & 3\\ \hline
|
||||
// \multicolumn{2}{c}{4} & 5\\
|
||||
// 6 & 7 \\
|
||||
// \end{tabular}
|
||||
//
|
||||
// gets "translated" to:
|
||||
//
|
||||
// 1 TAB 2 TAB 3 LINE
|
||||
// HLINE 2 MULT c MULT 4 TAB 5 LINE
|
||||
// 5 TAB 7 LINE
|
||||
/* rather brutish way to code table structure in a string:
|
||||
|
||||
\begin{tabular}{ccc}
|
||||
1 & 2 & 3\\ \hline
|
||||
\multicolumn{2}{c}{4} & 5 //
|
||||
6 & 7 \\
|
||||
\end{tabular}
|
||||
|
||||
gets "translated" to:
|
||||
|
||||
1 TAB 2 TAB 3 LINE
|
||||
HLINE 2 MULT c MULT 4 TAB 5 LINE
|
||||
5 TAB 7 LINE
|
||||
*/
|
||||
|
||||
char const TAB = '\001';
|
||||
char const LINE = '\002';
|
||||
|
521
src/text.C
521
src/text.C
File diff suppressed because it is too large
Load Diff
562
src/text2.C
562
src/text2.C
File diff suppressed because it is too large
Load Diff
400
src/text3.C
400
src/text3.C
File diff suppressed because it is too large
Load Diff
@ -255,7 +255,7 @@ void TransManager::insertVerbatim(string const & str, LyXText * text)
|
||||
string::size_type const l = str.length();
|
||||
|
||||
for (string::size_type i = 0; i < l; ++i) {
|
||||
text->insertChar(current_view, str[i]);
|
||||
text->insertChar(str[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ void TransManager::insert(string const & str, LyXText * text)
|
||||
// Could not find an encoding
|
||||
InsetLatexAccent ins(str);
|
||||
if (ins.canDisplay()) {
|
||||
text->insertInset(current_view,
|
||||
text->insertInset(
|
||||
new InsetLatexAccent(ins));
|
||||
} else {
|
||||
insertVerbatim(str, text);
|
||||
|
@ -66,7 +66,7 @@ void finishNoUndo(BufferView * bv)
|
||||
freezeUndo();
|
||||
bv->unlockInset(bv->theLockingInset());
|
||||
finishUndo();
|
||||
bv->text->postPaint(*bv, 0);
|
||||
bv->text->postPaint(0);
|
||||
unFreezeUndo();
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
num = -1;
|
||||
}
|
||||
}
|
||||
t->setCursorIntern(bv, firstUndoParagraph(bv, num), 0);
|
||||
t->setCursorIntern(firstUndoParagraph(bv, num), 0);
|
||||
}
|
||||
|
||||
// replace the paragraphs with the undo informations
|
||||
@ -186,9 +186,9 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
if (before) { // if we have a par before the undopar
|
||||
Inset * it = before->inInset();
|
||||
if (it)
|
||||
it->getLyXText(bv)->setCursorIntern(bv, before, 0);
|
||||
it->getLyXText(bv)->setCursorIntern(before, 0);
|
||||
else
|
||||
bv->text->setCursorIntern(bv, before, 0);
|
||||
bv->text->setCursorIntern(before, 0);
|
||||
}
|
||||
// we are not ready for this we cannot set the cursor for a paragraph
|
||||
// which is not already in a row of LyXText!!!
|
||||
@ -212,7 +212,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
if (undopar)
|
||||
it = static_cast<UpdatableInset*>(undopar->inInset());
|
||||
if (it) {
|
||||
it->getLyXText(bv)->redoParagraphs(bv,
|
||||
it->getLyXText(bv)->redoParagraphs(
|
||||
it->getLyXText(bv)->cursor,
|
||||
endpar);
|
||||
if (tmppar) {
|
||||
@ -224,19 +224,19 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
} else {
|
||||
t = bv->text;
|
||||
}
|
||||
t->setCursorIntern(bv, tmppar, undo.cursor_pos);
|
||||
t->setCursorIntern(tmppar, undo.cursor_pos);
|
||||
// clear any selection and set the selection cursor
|
||||
// for an evt. new selection.
|
||||
t->clearSelection();
|
||||
t->selection.cursor = t->cursor;
|
||||
t->updateCounters(bv);
|
||||
t->updateCounters();
|
||||
bv->fitCursor();
|
||||
}
|
||||
bv->updateInset(it, false);
|
||||
bv->text->setCursorIntern(bv, bv->text->cursor.par(),
|
||||
bv->text->setCursorIntern(bv->text->cursor.par(),
|
||||
bv->text->cursor.pos());
|
||||
} else {
|
||||
bv->text->redoParagraphs(bv, bv->text->cursor, endpar);
|
||||
bv->text->redoParagraphs(bv->text->cursor, endpar);
|
||||
if (tmppar) {
|
||||
LyXText * t;
|
||||
Inset * it = tmppar->inInset();
|
||||
@ -246,12 +246,12 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
} else {
|
||||
t = bv->text;
|
||||
}
|
||||
t->setCursorIntern(bv, tmppar, undo.cursor_pos);
|
||||
t->setCursorIntern(tmppar, undo.cursor_pos);
|
||||
// clear any selection and set the selection cursor
|
||||
// for an evt. new selection.
|
||||
t->clearSelection();
|
||||
t->selection.cursor = t->cursor;
|
||||
t->updateCounters(bv);
|
||||
t->updateCounters();
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
}
|
||||
|
||||
finishUndo();
|
||||
bv->text->postPaint(*bv, 0);
|
||||
bv->text->postPaint(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user