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