#include "support/lyxfunctional.h" //equal_1st_in_pair
#include "language.h"
#include "gettext.h"
+#include "undo_funcs.h"
+#include "debug.h"
extern BufferList bufferlist;
bool res = true;
if (c == '#') {
- lyxerr.debug() << "Will insert file with header" << endl;
+ lyxerr[Debug::INFO] << "Will insert file with header" << endl;
res = buffer()->readFile(lex, text->cursor.par());
} else {
- lyxerr.debug() << "Will insert file without header" << endl;
+ lyxerr[Debug::INFO] << "Will insert file without header"
+ << endl;
res = buffer()->readLyXformat2(lex, text->cursor.par());
}
for (TeXErrors::Errors::const_iterator cit = terr.begin();
cit != terr.end();
++cit) {
- string const desctext((*cit).error_desc);
- string const errortext((*cit).error_text);
+ string const desctext(cit->error_desc);
+ string const errortext(cit->error_text);
string const msgtxt = desctext + '\n' + errortext;
- int const errorrow = (*cit).error_in_line;
+ int const errorrow = cit->error_in_line;
// Insert error string for row number
int tmpid = -1;
texrowpar = text->firstParagraph();
tmppos = 0;
} else {
- texrowpar = text->getParFromID(tmpid);
+ texrowpar = buffer()->getParFromID(tmpid);
}
if (texrowpar == 0)
texrowpar = text->firstParagraph();
tmppos = 0;
} else {
- texrowpar = text->getParFromID(tmpid);
+ texrowpar = buffer()->getParFromID(tmpid);
}
text->setCursor(this, texrowpar, tmppos);
}
hideCursor();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
- if (!text->textUndo(this))
+ if (!textUndo(this))
owner()->message(_("No forther undo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
hideCursor();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
- if (!text->textRedo(this))
+ if (!textRedo(this))
owner()->message(_("No further redo information"));
else
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
text->copyEnvironmentType();
// clear the selection, even if mark_set
toggleSelection();
- text->clearSelection(this);
+ text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);
owner()->message(_("Paragraph environment type copied"));
}
text->copySelection(this);
// clear the selection, even if mark_set
toggleSelection();
- text->clearSelection(this);
+ text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);
owner()->message(_("Copy"));
}
}
-void BufferView::cut()
+void BufferView::cut(bool realcut)
{
if (available()) {
hideCursor();
update(text, BufferView::SELECT|BufferView::FITCUR);
- text->cutSelection(this);
+ text->cutSelection(this, true, realcut);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner()->message(_("Cut"));
}
hideCursor();
// clear the selection
toggleSelection();
- text->clearSelection(this);
+ text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);
// paste
// clear the selection
toggleSelection();
- text->clearSelection(this);
+ text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);
}
-
-
-void BufferView::insertCorrectQuote()
-{
- char c;
-
- if (text->cursor.pos())
- c = text->cursor.par()->getChar(text->cursor.pos() - 1);
- else
- c = ' ';
-
- insertInset(new InsetQuotes(c, buffer()->params));
-}
-
-
/* these functions are for the spellchecker */
string const BufferView::nextWord(float & value)
{
{
if (!available()) return;
+ LyXCursor cur = text->selection.cursor;
hideCursor();
beforeChange(text);
+ text->selection.cursor = cur;
text->selectSelectedWord(this);
toggleSelection(false);
update(text, BufferView::SELECT|BufferView::FITCUR);
hideCursor();
beforeChange(text);
text->selectSelectedWord(this);
- text->clearSelection(this);
+ text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);
}
{
if (!available()) return;
+ LyXText * tt = getLyXText();
hideCursor();
- update(text, BufferView::SELECT|BufferView::FITCUR);
+ update(tt, BufferView::SELECT|BufferView::FITCUR);
/* clear the selection (if there is any) */
toggleSelection(false);
- update(text, BufferView::SELECT|BufferView::FITCUR);
+ update(tt, BufferView::SELECT|BufferView::FITCUR);
/* clear the selection (if there is any) */
toggleSelection(false);
- text->replaceSelectionWithString(this, replacestring);
+ tt->replaceSelectionWithString(this, replacestring);
- text->setSelectionOverString(this, replacestring);
+ tt->setSelectionOverString(this, replacestring);
// Go back so that replacement string is also spellchecked
for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
- text->cursorLeft(this);
+ tt->cursorLeft(this);
}
- update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
+ update(tt, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
// End of spellchecker stuff
theLockingInset(inset);
return true;
} else if (inset) {
- return theLockingInset()->LockInsetInInset(this, inset);
+ return theLockingInset()->lockInsetInInset(this, inset);
}
return false;
}
void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
{
- if (theLockingInset() && available()) {
+ if (available() && theLockingInset()) {
LyXCursor cursor = text->cursor;
+ Inset * locking_inset = theLockingInset()->getLockingInset();
+
if ((cursor.pos() - 1 >= 0) &&
(cursor.par()->getChar(cursor.pos() - 1) ==
Paragraph::META_INSET) &&
(cursor.par()->getInset(cursor.pos() - 1) ==
- theLockingInset()->GetLockingInset()))
+ locking_inset))
text->setCursor(this, cursor,
- cursor.par(), cursor.pos() - 1);
+ cursor.par(), cursor.pos() - 1);
LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE;
LyXText * txt = getLyXText();
- if (theLockingInset()->GetLockingInset()->LyxCode() ==
- Inset::TEXT_CODE &&
+ if (locking_inset->isTextInset() &&
+ locking_inset->lyxCode() != Inset::ERT_CODE &&
(txt->real_current_font.language() !=
buffer()->params.language
|| txt->real_current_font.isVisibleRightToLeft()
shape = (txt->real_current_font.isVisibleRightToLeft())
? LyXScreen::REVERSED_L_SHAPE
: LyXScreen::L_SHAPE;
- y += cursor.y() + theLockingInset()->InsetInInsetY();
- pimpl_->screen_->ShowManualCursor(text, x, y, asc, desc,
+ y += cursor.y() + theLockingInset()->insetInInsetY();
+ pimpl_->screen_->showManualCursor(text, x, y, asc, desc,
shape);
}
}
void BufferView::hideLockedInsetCursor()
{
if (theLockingInset() && available()) {
- pimpl_->screen_->HideCursor();
+ pimpl_->screen_->hideCursor();
}
}
void BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
{
if (theLockingInset() && available()) {
- y += text->cursor.y() + theLockingInset()->InsetInInsetY();
- if (pimpl_->screen_->FitManualCursor(text, this, x, y, asc, desc))
+ y += text->cursor.y() + theLockingInset()->insetInInsetY();
+ if (pimpl_->screen_->fitManualCursor(text, this, x, y, asc, desc))
updateScrollbar();
}
}
int BufferView::unlockInset(UpdatableInset * inset)
{
if (inset && theLockingInset() == inset) {
- inset->InsetUnlock(this);
+ inset->insetUnlock(this);
theLockingInset(0);
- text->finishUndo();
+ finishUndo();
return 0;
} else if (inset && theLockingInset() &&
- theLockingInset()->UnlockInsetInInset(this, inset)) {
- text->finishUndo();
+ theLockingInset()->unlockInsetInInset(this, inset)) {
+ finishUndo();
return 0;
}
return bufferlist.unlockInset(inset);
return; // shouldn't happen
if (kind == Undo::EDIT) // in this case insets would not be stored!
kind = Undo::FINISH;
- text->setUndo(buffer(), kind,
- text->cursor.par()->previous(),
- text->cursor.par()->next());
+ setUndo(this, kind,
+ text->cursor.par(),
+ text->cursor.par()->next());
}
bool flag2 = false;
for (Paragraph::inset_iterator it = par->inset_iterator_begin();
it != par->inset_iterator_end(); ++it) {
- if ((*it)->LyxCode() == code) {
+ if ((*it)->lyxCode() == code) {
InsetCommand * inset = static_cast<InsetCommand *>(*it);
if (inset->getContents() == from) {
inset->setContents(to);