Make LFUN_QUOTE work for InsetText.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1502 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-02-14 10:11:22 +00:00
parent a30e709a3b
commit 16a7d8015e
17 changed files with 108 additions and 93 deletions

View File

@ -211,9 +211,9 @@ bool BufferView::available() const
}
void BufferView::beforeChange()
void BufferView::beforeChange(LyXText * text)
{
pimpl_->beforeChange();
pimpl_->beforeChange(text);
}

View File

@ -92,7 +92,7 @@ public:
///
LyXView * owner() const;
///
void beforeChange();
void beforeChange(LyXText *);
///
void savePosition(unsigned int i);
///

View File

@ -67,7 +67,7 @@ bool BufferView::insertLyXFile(string const & filen)
return false;
}
beforeChange();
beforeChange(text);
ifstream ifs(fname.c_str());
if (!ifs) {
@ -217,7 +217,7 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
text->SetCursorParUndo(buffer());
text->FreezeUndo();
beforeChange();
beforeChange(text);
if (!lout.empty()) {
update(text, BufferView::SELECT|BufferView::FITCUR);
text->BreakParagraph(this);
@ -266,7 +266,7 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
// Open and lock an updatable inset
bool BufferView::open_new_inset(UpdatableInset * new_inset, bool behind)
{
beforeChange();
beforeChange(text);
text->FinishUndo();
if (!insertInset(new_inset)) {
delete new_inset;
@ -293,7 +293,7 @@ bool BufferView::gotoLabel(string const & label)
vector<string> labels = (*it)->getLabelList();
if (find(labels.begin(),labels.end(),label)
!= labels.end()) {
beforeChange();
beforeChange(text);
text->SetCursor(this, it.getPar(), it.getPos());
text->sel_cursor = text->cursor;
update(text, BufferView::SELECT|BufferView::FITCUR);
@ -325,7 +325,7 @@ void BufferView::allFloats(char flag, char figmar)
&& cursor.par()->footnotekind != LyXParagraph::ALGORITHM)))
toggleFloat();
else
beforeChange();
beforeChange(text);
LyXCursor tmpcursor = cursor;
cursor.par(tmpcursor.par()->ParFromPos(tmpcursor.pos()));
@ -408,7 +408,7 @@ void BufferView::openStuff()
if (available()) {
owner()->getMiniBuffer()->Set(_("Open/Close..."));
hideCursor();
beforeChange();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
text->OpenStuff(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
@ -422,7 +422,7 @@ void BufferView::toggleFloat()
if (available()) {
owner()->getMiniBuffer()->Set(_("Open/Close..."));
hideCursor();
beforeChange();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
text->ToggleFootnote(this);
update(text, BufferView::SELECT|BufferView::FITCUR);
@ -436,7 +436,7 @@ void BufferView::menuUndo()
if (available()) {
owner()->getMiniBuffer()->Set(_("Undo"));
hideCursor();
beforeChange();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!text->TextUndo(this))
owner()->getMiniBuffer()->Set(_("No further undo information"));
@ -457,7 +457,7 @@ void BufferView::menuRedo()
if (available()) {
owner()->getMiniBuffer()->Set(_("Redo"));
hideCursor();
beforeChange();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
if (!text->TextRedo(this))
owner()->getMiniBuffer()->Set(_("No further redo information"));
@ -627,7 +627,7 @@ void BufferView::gotoInset(std::vector<Inset::Code> const & codes,
if (!available()) return;
hideCursor();
beforeChange();
beforeChange(text);
update(text, BufferView::SELECT|BufferView::FITCUR);
string contents;
@ -695,7 +695,7 @@ void BufferView::selectLastWord()
if (!available()) return;
hideCursor();
beforeChange();
beforeChange(text);
text->SelectSelectedWord(this);
toggleSelection(false);
update(text, BufferView::SELECT|BufferView::FITCUR);
@ -707,7 +707,7 @@ void BufferView::endOfSpellCheck()
if (!available()) return;
hideCursor();
beforeChange();
beforeChange(text);
text->SelectSelectedWord(this);
text->ClearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);

View File

@ -295,7 +295,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
bv_->text->SetCursor(bv_, selstartpar, selstartpos);
bv_->text->sel_cursor = bv_->text->cursor;
bv_->text->SetCursor(bv_, selendpar, selendpos);
bv_->text->SetSelection();
bv_->text->SetSelection(bv_);
bv_->text->SetCursor(bv_, par, pos);
} else {
bv_->text->SetCursor(bv_, par, pos);
@ -522,7 +522,7 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
if (!bv_->text->selection)
update(bv_->text, BufferView::UPDATE); // Maybe an empty line was deleted
bv_->text->SetSelection();
bv_->text->SetSelection(bv_);
screen_->ToggleToggle(bv_->text, bv_);
fitCursor(bv_->text);
screen_->ShowCursor(bv_->text, bv_);
@ -674,7 +674,7 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
text->CursorHome(bv_);
text->sel_cursor = text->cursor;
text->CursorEnd(bv_);
text->SetSelection();
text->SetSelection(bv_);
screen_->ToggleSelection(text, bv_, false);
/* This will fit the cursor on the screen
* if necessary */
@ -1029,9 +1029,10 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
text->FullRebreak(bv_);
if (text->inset_owner)
if (text->inset_owner) {
text->inset_owner->SetUpdateStatus(bv_, InsetText::CURSOR_PAR);
bv_->updateInset(text->inset_owner, true);
else
} else
update();
if ((f & FITCUR)) {
@ -1141,10 +1142,10 @@ bool BufferView::Pimpl::available() const
}
void BufferView::Pimpl::beforeChange()
void BufferView::Pimpl::beforeChange(LyXText * text)
{
toggleSelection();
bv_->text->ClearSelection();
text->ClearSelection();
}
@ -1167,7 +1168,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
string fname = saved_positions[i].filename;
beforeChange();
beforeChange(bv_->text);
if (fname != buffer_->fileName()) {
Buffer * b = bufferlist.exists(fname) ?
@ -1299,7 +1300,7 @@ void BufferView::Pimpl::toggleToggle()
void BufferView::Pimpl::center()
{
beforeChange();
beforeChange(bv_->text);
if (bv_->text->cursor.y() > static_cast<int>((workarea_->height() / 2))) {
screen_->Draw(bv_->text, bv_, bv_->text->cursor.y() - workarea_->height() / 2);
} else {
@ -1315,7 +1316,7 @@ void BufferView::Pimpl::pasteClipboard(bool asPara)
if (!buffer_) return;
screen_->HideCursor();
bv_->beforeChange();
beforeChange(bv_->text);
string const clip(workarea_->getClipboard());

View File

@ -84,7 +84,7 @@ struct BufferView::Pimpl : public Object {
///
bool available() const;
///
void beforeChange();
void beforeChange(LyXText *);
///
void savePosition(unsigned int i);
///

View File

@ -1,3 +1,11 @@
2001-02-14 Juergen Vigna <jug@sad.it>
* lyxfunc.C (Dispatch): make LFUN_QUOTE work for InsetText.
* BufferView_pimpl.C (update): set updatestatus of inset if needed.
* text2.C (SetSelection): added a BufferView * parameter
2001-02-13 Juergen Vigna <jug@sad.it>
* lyxfunc.C (Dispatch): fixed protected blank problem.

View File

@ -108,7 +108,7 @@ void Melt(BufferView * bv)
bv->owner()->getMiniBuffer()->Set(_("Melt"));
bv->hideCursor();
bv->beforeChange();
bv->beforeChange(bv->text);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR);
bv->text->MeltFootnoteEnvironment(bv);
bv->update(bv->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);

View File

@ -1,3 +1,7 @@
2001-02-14 Juergen Vigna <jug@sad.it>
* insettext.C (SetUpdateStatus): added a BufferView * parameter.
2001-02-13 Juergen Vigna <jug@sad.it>
* insettext.C (InsertInset): don't move left (is this right?)

View File

@ -450,8 +450,10 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
TEXT_TO_INSET_OFFSET;
}
void InsetText::SetUpdateStatus(UpdateCodes what)
void InsetText::SetUpdateStatus(BufferView * bv, UpdateCodes what)
{
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
need_update = FULL;
if (what > need_update)
need_update = what;
}
@ -718,7 +720,7 @@ void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int state)
HideInsetCursor(bv);
TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
y+insetAscent);
TEXT(bv)->SetSelection();
TEXT(bv)->SetSelection(bv);
if (TEXT(bv)->toggle_cursor.par()!=TEXT(bv)->toggle_end_cursor.par() ||
TEXT(bv)->toggle_cursor.pos()!=TEXT(bv)->toggle_end_cursor.pos())
UpdateLocal(bv, SELECTION, false);
@ -841,7 +843,7 @@ InsetText::LocalDispatch(BufferView * bv,
case LFUN_RIGHTSEL:
bv->text->FinishUndo();
moveRight(bv, false, true);
TEXT(bv)->SetSelection();
TEXT(bv)->SetSelection(bv);
UpdateLocal(bv, SELECTION, false);
break;
case LFUN_RIGHT:
@ -853,7 +855,7 @@ InsetText::LocalDispatch(BufferView * bv,
case LFUN_LEFTSEL:
bv->text->FinishUndo();
moveLeft(bv, false, true);
TEXT(bv)->SetSelection();
TEXT(bv)->SetSelection(bv);
UpdateLocal(bv, SELECTION, false);
break;
case LFUN_LEFT:
@ -865,7 +867,7 @@ InsetText::LocalDispatch(BufferView * bv,
case LFUN_DOWNSEL:
bv->text->FinishUndo();
moveDown(bv);
TEXT(bv)->SetSelection();
TEXT(bv)->SetSelection(bv);
UpdateLocal(bv, SELECTION, false);
break;
case LFUN_DOWN:
@ -878,7 +880,7 @@ InsetText::LocalDispatch(BufferView * bv,
case LFUN_UPSEL:
bv->text->FinishUndo();
moveUp(bv);
TEXT(bv)->SetSelection();
TEXT(bv)->SetSelection(bv);
UpdateLocal(bv, SELECTION, false);
break;
case LFUN_UP:
@ -1658,7 +1660,7 @@ void InsetText::resizeLyXText(BufferView * bv) const
selstartboundary);
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
TEXT(bv)->SetCursor(bv, selendpar, selendpos, true, selendboundary);
TEXT(bv)->SetSelection();
TEXT(bv)->SetSelection(bv);
TEXT(bv)->SetCursor(bv, lpar, pos);
} else {
TEXT(bv)->SetCursor(bv, lpar, pos, true, boundary);

View File

@ -99,7 +99,7 @@ public:
///
void update(BufferView *, LyXFont const &, bool =false);
///
void SetUpdateStatus(UpdateCodes);
void SetUpdateStatus(BufferView *, UpdateCodes);
///
string const EditMessage() const;
///

View File

@ -505,7 +505,7 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
bv->hideCursor();
// clear the selection
bv->beforeChange();
bv->beforeChange(bv->text);
if (!asParagraph)
bv->text->InsertStringA(bv, tmpstr);
else
@ -879,7 +879,7 @@ void FigureApplyCB(FL_OBJECT *, long)
current_view->hideCursor();
current_view->update(current_view->text, BufferView::SELECT|BufferView::FITCUR);
current_view->beforeChange();
current_view->beforeChange(current_view->text);
current_view->text->SetCursorParUndo(current_view->buffer());
current_view->text->FreezeUndo();

View File

@ -82,7 +82,7 @@ void SetSelectionOverLenChars(BufferView * bv, int len)
bv->text->sel_cursor = bv->text->cursor;
for (int i = 0; i < len; ++i)
bv->text->CursorRight(bv);
bv->text->SetSelection();
bv->text->SetSelection(bv);
}

View File

@ -137,7 +137,7 @@ inline
void LyXFunc::moveCursorUpdate(LyXText * text, bool selecting)
{
if (selecting || text->mark_set) {
text->SetSelection();
text->SetSelection(owner->view());
if (text->bv_owner)
owner->view()->toggleToggle();
}
@ -1472,7 +1472,7 @@ string const LyXFunc::Dispatch(int ac,
LyXText * tmptext = owner->view()->text;
bool is_rtl = tmptext->cursor.par()->isRightToLeftPar(owner->buffer()->params);
if (!tmptext->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::SELECT|BufferView::FITCUR);
if (is_rtl)
tmptext->CursorLeft(owner->view(), false);
@ -1508,7 +1508,8 @@ string const LyXFunc::Dispatch(int ac,
// it simpler? (Lgb)
LyXText * txt = owner->view()->text;
bool is_rtl = txt->cursor.par()->isRightToLeftPar(owner->buffer()->params);
if (!txt->mark_set) owner->view()->beforeChange();
if (!txt->mark_set)
owner->view()->beforeChange(txt);
owner->view()->update(owner->view()->text, BufferView::SELECT|BufferView::FITCUR);
LyXCursor cur = txt->cursor;
if (!is_rtl)
@ -1545,7 +1546,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_UP:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::UPDATE);
owner->view()->text->CursorUp(owner->view());
owner->view()->text->FinishUndo();
@ -1555,7 +1556,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_DOWN:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::UPDATE);
owner->view()->text->CursorDown(owner->view());
owner->view()->text->FinishUndo();
@ -1565,7 +1566,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_UP_PARAGRAPH:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::UPDATE);
owner->view()->text->CursorUpParagraph(owner->view());
owner->view()->text->FinishUndo();
@ -1575,7 +1576,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_DOWN_PARAGRAPH:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::UPDATE);
owner->view()->text->CursorDownParagraph(owner->view());
owner->view()->text->FinishUndo();
@ -1585,7 +1586,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_PRIOR:
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::UPDATE);
owner->view()->cursorPrevious(text);
owner->view()->text->FinishUndo();
@ -1600,7 +1601,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_NEXT:
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::UPDATE);
owner->view()->cursorNext(text);
owner->view()->text->FinishUndo();
@ -1615,7 +1616,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_HOME:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text, BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorHome(owner->view());
owner->view()->text->FinishUndo();
@ -1625,7 +1626,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_END:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorEnd(owner->view());
@ -1637,7 +1638,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_SHIFT_TAB:
case LFUN_TAB:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorTab(owner->view());
@ -1648,7 +1649,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_WORDRIGHT:
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(text);
owner->view()->update(text, BufferView::SELECT|BufferView::FITCUR);
if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
text->CursorLeftOneWord(owner->view());
@ -1665,7 +1666,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_WORDLEFT:
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(text);
owner->view()->update(text, BufferView::SELECT|BufferView::FITCUR);
if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
text->CursorRightOneWord(owner->view());
@ -1682,7 +1683,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_BEGINNINGBUF:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorTop(owner->view());
@ -1693,7 +1694,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_ENDBUF:
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorBottom(owner->view());
@ -1770,7 +1771,7 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->text->FinishUndo();
#if 0
if (text->inset_owner) {
text->SetSelection();
text->SetSelection(owner->view());
owner->view()->updateInset(text->inset_owner, false);
} else
#endif
@ -1797,7 +1798,7 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->text->FinishUndo();
#if 0
if (text->inset_owner) {
text->SetSelection();
text->SetSelection(owner->view());
owner->view()->updateInset(text->inset_owner, false);
} else
#endif
@ -1811,7 +1812,7 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->text->FinishUndo();
#if 0
if (text->inset_owner) {
text->SetSelection();
text->SetSelection(owner->view());
owner->view()->updateInset(text->inset_owner, false);
} else
#endif
@ -1828,7 +1829,7 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->text->FinishUndo();
#if 0
if (text->inset_owner) {
text->SetSelection();
text->SetSelection(owner->view());
owner->view()->updateInset(text->inset_owner, false);
} else
#endif
@ -1845,7 +1846,7 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->text->FinishUndo();
#if 0
if (text->inset_owner) {
text->SetSelection();
text->SetSelection(owner->view());
owner->view()->updateInset(text->inset_owner, false);
} else
#endif
@ -1876,7 +1877,7 @@ string const LyXFunc::Dispatch(int ac,
// --- text changing commands ------------------------
case LFUN_BREAKLINE:
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->text->InsertChar(owner->view(), LyXParagraph::META_NEWLINE);
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
@ -1901,11 +1902,11 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_SETMARK:
if (text->mark_set) {
owner->view()->beforeChange();
owner->view()->beforeChange(text);
owner->view()->update(text, BufferView::SELECT|BufferView::FITCUR);
setMessage(N_("Mark removed"));
} else {
owner->view()->beforeChange();
owner->view()->beforeChange(text);
text->mark_set = 1;
owner->view()->update(text, BufferView::SELECT|BufferView::FITCUR);
setMessage(N_("Mark set"));
@ -2022,7 +2023,7 @@ string const LyXFunc::Dispatch(int ac,
/* -------> Set mark off. */
case LFUN_MARK_OFF:
owner->view()->beforeChange();
owner->view()->beforeChange(text);
owner->view()->update(text, BufferView::SELECT|BufferView::FITCUR);
text->sel_cursor = text->cursor;
setMessage(N_("Mark off"));
@ -2034,7 +2035,7 @@ string const LyXFunc::Dispatch(int ac,
/* -------> Set mark on. */
case LFUN_MARK_ON:
owner->view()->beforeChange();
owner->view()->beforeChange(text);
text->mark_set = 1;
owner->view()->update(text, BufferView::SELECT|BufferView::FITCUR);
text->sel_cursor = text->cursor;
@ -2101,7 +2102,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_BREAKPARAGRAPH:
{
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->text->BreakParagraph(owner->view(), 0);
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
@ -2114,7 +2115,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
{
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
owner->view()->text->BreakParagraph(owner->view(), 1);
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
@ -2133,7 +2134,7 @@ string const LyXFunc::Dispatch(int ac,
LyXCursor cursor = owner->view()->text->cursor;
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
if (cursor.pos() == 0) {
if (cursor.par()->added_space_top == VSpace(VSpace::NONE)) {
owner->view()->text->SetParagraph
@ -2208,11 +2209,10 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_QUOTE:
owner->view()->beforeChange();
owner->view()->text->InsertChar(owner->view(), '\"'); // This " matches the single quote in the code
owner->view()->update(owner->view()->text,
BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(owner->view()->text, false);
owner->view()->beforeChange(text);
text->InsertChar(owner->view(), '\"'); // This " matches the single quote in the code
owner->view()->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(text, false);
break;
case LFUN_HTMLURL:
@ -3057,7 +3057,7 @@ string const LyXFunc::Dispatch(int ac,
}
}
owner->view()->beforeChange();
owner->view()->beforeChange(owner->view()->text);
LyXFont const old_font(owner->view()->text->real_current_font);
for (string::size_type i = 0;
i < argument.length(); ++i) {

View File

@ -231,7 +231,7 @@ public:
LyXCursor toggle_end_cursor;
/// need the selection cursor:
void SetSelection();
void SetSelection(BufferView *);
///
void ClearSelection() const;
///

View File

@ -340,7 +340,7 @@ bool math_insert_greek(BufferView * bv, char c)
if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) {
int greek_kb_flag_save = greek_kb_flag;
InsetFormula * new_inset = new InsetFormula();
bv->beforeChange();
bv->beforeChange(bv->text);
if (!bv->insertInset(new_inset)) {
delete new_inset;
return false;
@ -370,7 +370,7 @@ void math_insert_symbol(BufferView * bv, string const & s)
if (bv->available()) {
if (!bv->theLockingInset() || bv->theLockingInset()->IsTextInset()) {
InsetFormula * new_inset = new InsetFormula();
bv->beforeChange();
bv->beforeChange(bv->text);
if (!bv->insertInset(new_inset)) {
delete new_inset;
return;

View File

@ -2412,7 +2412,7 @@ void LyXText::SelectWord(BufferView * bview)
SetCursor(bview, cursor.par(), cursor.pos() );
// finally set the selection
SetSelection();
SetSelection(bview);
}
@ -2523,7 +2523,7 @@ void LyXText::SelectSelectedWord(BufferView * bview)
SetCursor(bview, cursor.par(), cursor.pos());
// finally set the selection
SetSelection();
SetSelection(bview);
}
@ -2540,7 +2540,7 @@ void LyXText::DeleteWordForward(BufferView * bview)
SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
SetSelection();
SetSelection(bview);
/* -----> Great, CutSelection() gets rid of multiple spaces. */
CutSelection(bview);
@ -2561,7 +2561,7 @@ void LyXText::DeleteWordBackward(BufferView * bview)
SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
SetSelection();
SetSelection(bview);
CutSelection(bview);
}
}
@ -2583,7 +2583,7 @@ void LyXText::DeleteLineForward(BufferView * bview)
SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
SetSelection();
SetSelection(bview);
// What is this test for ??? (JMarc)
if (!selection) {
DeleteWordForward(bview);

View File

@ -658,7 +658,7 @@ void LyXText::SetLayout(BufferView * bview, LyXTextClass::size_type layout)
false);
UpdateCounters(bview, cursor.row());
ClearSelection();
SetSelection();
SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
}
@ -776,7 +776,7 @@ void LyXText::IncDepth(BufferView * bview)
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
UpdateCounters(bview, cursor.row());
ClearSelection();
SetSelection();
SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
@ -853,7 +853,7 @@ void LyXText::DecDepth(BufferView * bview)
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
UpdateCounters(bview, cursor.row());
ClearSelection();
SetSelection();
SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
@ -935,7 +935,7 @@ void LyXText::SetFont(BufferView * bview, LyXFont const & font, bool toggleall)
sel_cursor = cursor;
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
ClearSelection();
SetSelection();
SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true,
tmpcursor.boundary());
}
@ -1117,7 +1117,7 @@ bool LyXText::FullRebreak(BufferView * bview)
* They also delete the corresponding row */
// need the selection cursor:
void LyXText::SetSelection()
void LyXText::SetSelection(BufferView * bview)
{
const bool lsel = selection;
@ -1168,7 +1168,7 @@ void LyXText::SetSelection()
selection = false;
if (inset_owner && (selection || lsel))
inset_owner->SetUpdateStatus(InsetText::SELECTION);
inset_owner->SetUpdateStatus(bview, InsetText::SELECTION);
}
@ -1304,7 +1304,7 @@ void LyXText::ToggleFree(BufferView * bview,
sel_cursor = cursor;
}
if (inset_owner)
inset_owner->SetUpdateStatus(InsetText::CURSOR_PAR);
inset_owner->SetUpdateStatus(bview, InsetText::CURSOR_PAR);
}
@ -1524,7 +1524,7 @@ void LyXText::SetParagraph(BufferView * bview,
SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
sel_cursor = cursor;
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
SetSelection();
SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
if (inset_owner)
bview->updateInset(inset_owner, true);
@ -1614,7 +1614,7 @@ void LyXText::SetParagraphExtraOpt(BufferView * bview, int type,
SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
sel_cursor = cursor;
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
SetSelection();
SetSelection(bview);
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
@ -2373,7 +2373,7 @@ void LyXText::PasteSelection(BufferView * bview)
sel_cursor = cursor;
SetCursor(bview, actpar, pos);
SetSelection();
SetSelection(bview);
UpdateCounters(bview, cursor.row());
}
@ -2411,7 +2411,7 @@ void LyXText::SetSelectionOverString(BufferView * bview, string const & str)
sel_cursor = cursor;
for (int i = 0; str[i]; ++i)
CursorRight(bview);
SetSelection();
SetSelection(bview);
}
@ -2572,7 +2572,7 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
SetCursor(bview, par, pos);
SetSelection();
SetSelection(bview);
}