mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
More InsetText/InsetTabular fixes!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1599 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9715b1d974
commit
ff67bee117
@ -558,7 +558,7 @@ void BufferView::copyEnvironment()
|
||||
text->copyEnvironmentType();
|
||||
// clear the selection, even if mark_set
|
||||
toggleSelection();
|
||||
text->ClearSelection();
|
||||
text->ClearSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
|
||||
}
|
||||
@ -581,7 +581,7 @@ void BufferView::copy()
|
||||
text->CopySelection(this);
|
||||
// clear the selection, even if mark_set
|
||||
toggleSelection();
|
||||
text->ClearSelection();
|
||||
text->ClearSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
owner()->getMiniBuffer()->Set(_("Copy"));
|
||||
}
|
||||
@ -607,7 +607,7 @@ void BufferView::paste()
|
||||
hideCursor();
|
||||
// clear the selection
|
||||
toggleSelection();
|
||||
text->ClearSelection();
|
||||
text->ClearSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
|
||||
// paste
|
||||
@ -616,7 +616,7 @@ void BufferView::paste()
|
||||
|
||||
// clear the selection
|
||||
toggleSelection();
|
||||
text->ClearSelection();
|
||||
text->ClearSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
}
|
||||
|
||||
@ -709,7 +709,7 @@ void BufferView::endOfSpellCheck()
|
||||
hideCursor();
|
||||
beforeChange(text);
|
||||
text->SelectSelectedWord(this);
|
||||
text->ClearSelection();
|
||||
text->ClearSelection(this);
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
}
|
||||
|
||||
@ -973,7 +973,7 @@ void BufferView::theLockingInset(UpdatableInset * inset)
|
||||
LyXText * BufferView::getLyXText() const
|
||||
{
|
||||
if (theLockingInset()) {
|
||||
LyXText * txt = theLockingInset()->getLyXText(this);
|
||||
LyXText * txt = theLockingInset()->getLyXText(this, true);
|
||||
if (txt)
|
||||
return txt;
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
|
||||
|
||||
// Clear the selection
|
||||
screen_->ToggleSelection(bv_->text, bv_);
|
||||
bv_->text->ClearSelection();
|
||||
bv_->text->ClearSelection(bv_);
|
||||
bv_->text->FullRebreak(bv_);
|
||||
screen_->Update(bv_->text, bv_);
|
||||
updateScrollbar();
|
||||
@ -647,10 +647,14 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
|
||||
return;
|
||||
|
||||
if (screen_ && button == 1) {
|
||||
if (text->bv_owner) {
|
||||
screen_->HideCursor();
|
||||
screen_->ToggleSelection(text, bv_);
|
||||
text->SelectWord(bv_);
|
||||
screen_->ToggleSelection(text, bv_, false);
|
||||
} else {
|
||||
text->SelectWord(bv_);
|
||||
}
|
||||
/* This will fit the cursor on the screen
|
||||
* if necessary */
|
||||
update(text, BufferView::SELECT|BufferView::FITCUR);
|
||||
@ -1031,7 +1035,7 @@ void BufferView::Pimpl::update(LyXText * text, BufferView::UpdateCodes f)
|
||||
text->FullRebreak(bv_);
|
||||
|
||||
if (text->inset_owner) {
|
||||
text->inset_owner->SetUpdateStatus(bv_, InsetText::CURSOR_PAR);
|
||||
// text->inset_owner->SetUpdateStatus(bv_, InsetText::CURSOR_PAR);
|
||||
bv_->updateInset(text->inset_owner, true);
|
||||
} else
|
||||
update();
|
||||
@ -1146,7 +1150,7 @@ bool BufferView::Pimpl::available() const
|
||||
void BufferView::Pimpl::beforeChange(LyXText * text)
|
||||
{
|
||||
toggleSelection();
|
||||
text->ClearSelection();
|
||||
text->ClearSelection(bv_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
2001-02-20 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* text2.C (ClearSelection): added BufferView param for inset_owner call
|
||||
|
||||
* lyxfunc.C (TEXT): added this function and use it instead of
|
||||
directly owner->view()-text of getLyXText().
|
||||
|
||||
2001-02-20 Edwin Leuven <leuven@fee.uva.nl>
|
||||
|
||||
* src/layout_forms.C: out preamble
|
||||
|
@ -1,3 +1,16 @@
|
||||
2001-02-22 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettext.C (getLyXText): honor the recursive parameter.
|
||||
|
||||
* inset.C (getLyXText): added bool recursive parameter.
|
||||
|
||||
* insettext.C (SetUpdateStatus): or the update codes.
|
||||
(draw): check need_update with &.
|
||||
(InsetButtonPress): set no_selection to not put a selection when
|
||||
entering an inset and it is redraws in another spot.
|
||||
|
||||
* insettext.h: made need_update an int.
|
||||
|
||||
2001-02-20 Baruch Even <baruch@ev-en.org>
|
||||
|
||||
* insetgraphics.h:
|
||||
|
@ -72,10 +72,10 @@ string const Inset::EditMessage() const
|
||||
}
|
||||
|
||||
|
||||
LyXText * Inset::getLyXText(BufferView const * bv) const
|
||||
LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
|
||||
{
|
||||
if (owner())
|
||||
return owner()->getLyXText(bv);
|
||||
return owner()->getLyXText(bv, false);
|
||||
else
|
||||
return bv->text;
|
||||
}
|
||||
|
@ -441,9 +441,9 @@ bool InsetCollapsable::doClearArea() const
|
||||
}
|
||||
|
||||
|
||||
LyXText * InsetCollapsable::getLyXText(BufferView const * bv) const
|
||||
LyXText * InsetCollapsable::getLyXText(BufferView const * bv, bool recursive) const
|
||||
{
|
||||
return inset->getLyXText(bv);
|
||||
return inset->getLyXText(bv, recursive);
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
///
|
||||
int getMaxWidth(Painter & pain, UpdatableInset const *) const;
|
||||
///
|
||||
LyXText * getLyXText(BufferView const *) const;
|
||||
LyXText * getLyXText(BufferView const *, bool const recursive) const;
|
||||
///
|
||||
void deleteLyXText(BufferView *, bool recursive=true) const;
|
||||
///
|
||||
|
@ -1241,7 +1241,6 @@ void InsetTabular::resetPos(BufferView * bv) const
|
||||
(tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20))
|
||||
{
|
||||
int xx = cursor.x() - offset + bv->text->GetRealCursorX(bv);
|
||||
printf("%d\n", xx);
|
||||
if (xx > (bv->workWidth()-20))
|
||||
scroll(bv, -(xx - bv->workWidth() + 60));
|
||||
else if (xx < 20) {
|
||||
@ -1828,11 +1827,11 @@ void InsetTabular::resizeLyXText(BufferView *) const
|
||||
}
|
||||
|
||||
|
||||
LyXText * InsetTabular::getLyXText(BufferView const * bv) const
|
||||
LyXText * InsetTabular::getLyXText(BufferView const * bv, bool const recursive) const
|
||||
{
|
||||
if (the_locking_inset)
|
||||
return the_locking_inset->getLyXText(bv);
|
||||
return Inset::getLyXText(bv);
|
||||
return the_locking_inset->getLyXText(bv, recursive);
|
||||
return Inset::getLyXText(bv, recursive);
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
///
|
||||
Buffer * BufferOwner() const { return const_cast<Buffer *>(buffer); }
|
||||
///
|
||||
LyXText * getLyXText(BufferView const *) const;
|
||||
LyXText * getLyXText(BufferView const *, bool const recursive = false) const;
|
||||
///
|
||||
void resizeLyXText(BufferView *) const;
|
||||
///
|
||||
|
@ -313,7 +313,6 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
return;
|
||||
|
||||
if (top_x != int(x)) {
|
||||
// printf("InsetText::draw1 -> INIT(%d)\n",insetWidth);
|
||||
need_update = INIT;
|
||||
top_x = int(x);
|
||||
bv->text->status = LyXText::CHANGED_IN_DRAW;
|
||||
@ -350,7 +349,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
if (y_offset < 0)
|
||||
y_offset = y;
|
||||
TEXT(bv)->first = first;
|
||||
if (cleared || !locked || (need_update==FULL) || (need_update==INIT)) {
|
||||
if (cleared || !locked || (need_update&FULL) || (need_update&INIT)) {
|
||||
int yf = y_offset;
|
||||
y = 0;
|
||||
while ((row != 0) && (yf < ph)) {
|
||||
@ -360,13 +359,13 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
yf += row->height();
|
||||
row = row->next();
|
||||
}
|
||||
} else if (need_update == SELECTION) {
|
||||
bv->screen()->ToggleToggle(TEXT(bv), bv, y_offset, int(x));
|
||||
} else {
|
||||
locked = false;
|
||||
if (need_update == CURSOR) {
|
||||
if (need_update & SELECTION)
|
||||
bv->screen()->ToggleToggle(TEXT(bv), bv, y_offset, int(x));
|
||||
else if (need_update & CURSOR) {
|
||||
bv->screen()->ToggleSelection(TEXT(bv), bv, true, y_offset,int(x));
|
||||
TEXT(bv)->ClearSelection();
|
||||
TEXT(bv)->ClearSelection(bv);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
}
|
||||
bv->screen()->Update(TEXT(bv), bv, y_offset, int(x));
|
||||
@ -381,18 +380,15 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||
pain.rectangle(top_x + 1, baseline - insetAscent + 1,
|
||||
width(bv, f) - 1, insetAscent + insetDescent - 1,
|
||||
frame_color);
|
||||
} else if (need_update == CLEAR_FRAME) {
|
||||
} else if (need_update & CLEAR_FRAME) {
|
||||
pain.rectangle(top_x + 1, baseline - insetAscent + 1,
|
||||
width(bv, f) - 1, insetAscent + insetDescent - 1,
|
||||
LColor::background);
|
||||
}
|
||||
x += width(bv, f) - TEXT_TO_INSET_OFFSET;
|
||||
if (bv->text->status==LyXText::CHANGED_IN_DRAW)
|
||||
{
|
||||
if (bv->text->status==LyXText::CHANGED_IN_DRAW) {
|
||||
need_update = INIT;
|
||||
// printf("InsetText::draw2 -> INIT(%d)\n",insetWidth);
|
||||
}
|
||||
else if (need_update != INIT)
|
||||
} else if (need_update != INIT)
|
||||
need_update = NONE;
|
||||
}
|
||||
|
||||
@ -450,25 +446,20 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
|
||||
TEXT_TO_INSET_OFFSET;
|
||||
}
|
||||
|
||||
void InsetText::SetUpdateStatus(BufferView * bv, UpdateCodes what)
|
||||
void InsetText::SetUpdateStatus(BufferView * bv, int what)
|
||||
{
|
||||
need_update |= what;
|
||||
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
|
||||
need_update = FULL;
|
||||
if (what > need_update)
|
||||
need_update = what;
|
||||
need_update |= FULL;
|
||||
// this to not draw a selection when we redraw all of it!
|
||||
if ((need_update & (INIT|FULL)) && (need_update & CURSOR))
|
||||
TEXT(bv)->ClearSelection(bv);
|
||||
}
|
||||
|
||||
void InsetText::UpdateLocal(BufferView * bv, UpdateCodes what, bool mark_dirty)
|
||||
void InsetText::UpdateLocal(BufferView * bv, int what, bool mark_dirty)
|
||||
{
|
||||
// if (what == INIT)
|
||||
// printf("InsetText::UpdateLocal -> INIT(%d)\n",insetWidth);
|
||||
TEXT(bv)->FullRebreak(bv);
|
||||
if (need_update != INIT) {
|
||||
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
|
||||
need_update = FULL;
|
||||
else if (!the_locking_inset || (what != CURSOR))
|
||||
need_update = what;
|
||||
}
|
||||
SetUpdateStatus(bv, what);
|
||||
if ((need_update != CURSOR) || (TEXT(bv)->status != LyXText::UNCHANGED) ||
|
||||
TEXT(bv)->selection)
|
||||
bv->updateInset(this, mark_dirty);
|
||||
@ -528,8 +519,7 @@ void InsetText::InsetUnlock(BufferView * bv)
|
||||
HideInsetCursor(bv);
|
||||
no_selection = false;
|
||||
locked = false;
|
||||
TEXT(bv)->selection = 0;
|
||||
UpdateLocal(bv, CLEAR_FRAME, false);
|
||||
UpdateLocal(bv, CLEAR_FRAME|CURSOR, false);
|
||||
if (owner())
|
||||
bv->owner()->setLayout(owner()->getLyXText(bv)
|
||||
->cursor.par()->GetLayout());
|
||||
@ -551,7 +541,13 @@ bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
||||
inset_pos = cpos(bv);
|
||||
inset_par = cpar(bv);
|
||||
inset_boundary = cboundary(bv);
|
||||
#if 0
|
||||
TEXT(bv)->ClearSelection(bv);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
TEXT(bv)->UpdateInset(bv, the_locking_inset);
|
||||
#else
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
#endif
|
||||
return true;
|
||||
} else if (the_locking_inset && (the_locking_inset == inset)) {
|
||||
if (cpar(bv) == inset_par && cpos(bv) == inset_pos) {
|
||||
@ -595,7 +591,7 @@ bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
|
||||
return false;
|
||||
if (the_locking_inset != inset) {
|
||||
TEXT(bv)->UpdateInset(bv, the_locking_inset);
|
||||
need_update = CURSOR_PAR;
|
||||
SetUpdateStatus(bv, CURSOR_PAR);
|
||||
return the_locking_inset->UpdateInsetInInset(bv, inset);
|
||||
}
|
||||
// UpdateLocal(bv, FULL, false);
|
||||
@ -611,7 +607,7 @@ bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
|
||||
|
||||
void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
{
|
||||
no_selection = false;
|
||||
no_selection = true;
|
||||
|
||||
int tmp_x = x - drawTextXOffset;
|
||||
int tmp_y = y + insetAscent - TEXT(bv)->first;
|
||||
@ -621,6 +617,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
if (the_locking_inset) {
|
||||
if (the_locking_inset == inset) {
|
||||
the_locking_inset->InsetButtonPress(bv,x-inset_x,y-inset_y,button);
|
||||
no_selection = false;
|
||||
return;
|
||||
} else if (inset) {
|
||||
// otherwise unlock the_locking_inset and lock the new inset
|
||||
@ -630,9 +627,9 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
the_locking_inset = static_cast<UpdatableInset*>(inset);
|
||||
inset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
|
||||
inset->Edit(bv, x - inset_x, y - inset_y, button);
|
||||
if (the_locking_inset) {
|
||||
UpdateLocal(bv, CURSOR_PAR, false);
|
||||
}
|
||||
if (the_locking_inset)
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
no_selection = false;
|
||||
return;
|
||||
}
|
||||
// otherwise only unlock the_locking_inset
|
||||
@ -650,10 +647,9 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
the_locking_inset = uinset;
|
||||
uinset->InsetButtonPress(bv, x - inset_x, y - inset_y, button);
|
||||
uinset->Edit(bv, x - inset_x, y - inset_y, 0);
|
||||
// TEXT(bv)->ClearSelection();
|
||||
if (the_locking_inset) {
|
||||
UpdateLocal(bv, CURSOR_PAR, false);
|
||||
}
|
||||
if (the_locking_inset)
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
no_selection = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -680,6 +676,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
}
|
||||
}
|
||||
ShowInsetCursor(bv);
|
||||
no_selection = false;
|
||||
}
|
||||
|
||||
|
||||
@ -711,12 +708,13 @@ void InsetText::InsetButtonRelease(BufferView * bv, int x, int y, int button)
|
||||
|
||||
void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int state)
|
||||
{
|
||||
if (no_selection)
|
||||
return;
|
||||
if (the_locking_inset) {
|
||||
the_locking_inset->InsetMotionNotify(bv, x - inset_x,
|
||||
y - inset_y,state);
|
||||
return;
|
||||
}
|
||||
if (!no_selection) {
|
||||
HideInsetCursor(bv);
|
||||
TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
|
||||
y+insetAscent);
|
||||
@ -726,8 +724,6 @@ void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int state)
|
||||
UpdateLocal(bv, SELECTION, false);
|
||||
ShowInsetCursor(bv);
|
||||
}
|
||||
no_selection = false;
|
||||
}
|
||||
|
||||
|
||||
void InsetText::InsetKeyPress(XKeyEvent * xke)
|
||||
@ -815,7 +811,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
TEXT(bv)->CutSelection(bv, false);
|
||||
}
|
||||
}
|
||||
TEXT(bv)->ClearSelection();
|
||||
TEXT(bv)->ClearSelection(bv);
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
for (string::size_type i = 0; i < arg.length(); ++i) {
|
||||
if (greek_kb_flag) {
|
||||
if (!math_insert_greek(bv, arg[i])) {
|
||||
@ -841,7 +838,6 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
case LFUN_RIGHT:
|
||||
result = moveRight(bv);
|
||||
bv->text->FinishUndo();
|
||||
TEXT(bv)->ClearSelection();
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
break;
|
||||
case LFUN_LEFTSEL:
|
||||
@ -853,7 +849,6 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
case LFUN_LEFT:
|
||||
bv->text->FinishUndo();
|
||||
result = moveLeft(bv);
|
||||
TEXT(bv)->ClearSelection();
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
break;
|
||||
case LFUN_DOWNSEL:
|
||||
@ -865,8 +860,6 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
case LFUN_DOWN:
|
||||
bv->text->FinishUndo();
|
||||
result = moveDown(bv);
|
||||
TEXT(bv)->ClearSelection();
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
break;
|
||||
case LFUN_UPSEL:
|
||||
@ -878,21 +871,15 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
case LFUN_UP:
|
||||
bv->text->FinishUndo();
|
||||
result = moveUp(bv);
|
||||
TEXT(bv)->ClearSelection();
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
break;
|
||||
case LFUN_HOME:
|
||||
bv->text->FinishUndo();
|
||||
TEXT(bv)->CursorHome(bv);
|
||||
TEXT(bv)->ClearSelection();
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
break;
|
||||
case LFUN_END:
|
||||
TEXT(bv)->CursorEnd(bv);
|
||||
TEXT(bv)->ClearSelection();
|
||||
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
|
||||
UpdateLocal(bv, CURSOR, false);
|
||||
break;
|
||||
case LFUN_BACKSPACE:
|
||||
@ -1338,9 +1325,8 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
|
||||
(cpar(bv)->GetInset(cpos(bv)) != inset))
|
||||
TEXT(bv)->CursorLeft(bv);
|
||||
#endif
|
||||
TEXT(bv)->selection = 0;
|
||||
bv->fitCursor(TEXT(bv));
|
||||
UpdateLocal(bv, CURSOR_PAR, true);
|
||||
UpdateLocal(bv, CURSOR_PAR|CURSOR, true);
|
||||
ShowInsetCursor(bv);
|
||||
return true;
|
||||
}
|
||||
@ -1573,18 +1559,23 @@ Row * InsetText::crow(BufferView * bv) const
|
||||
}
|
||||
|
||||
|
||||
LyXText * InsetText::getLyXText(BufferView const * lbv) const
|
||||
LyXText * InsetText::getLyXText(BufferView const * lbv, bool const recursive) const
|
||||
{
|
||||
// Super UGLY! (Lgb)
|
||||
BufferView * bv = const_cast<BufferView *>(lbv);
|
||||
|
||||
if ((cache.find(bv) != cache.end()) && cache[bv])
|
||||
if ((cache.find(bv) != cache.end()) && cache[bv]) {
|
||||
if (recursive && the_locking_inset)
|
||||
return the_locking_inset->getLyXText(bv);
|
||||
return cache[bv];
|
||||
}
|
||||
LyXText * lt = new LyXText(const_cast<InsetText *>(this));
|
||||
lt->init(bv);
|
||||
cache[bv] = lt;
|
||||
if (the_locking_inset) {
|
||||
lt->SetCursor(bv, inset_par, inset_pos, true, inset_boundary);
|
||||
if (recursive)
|
||||
return the_locking_inset->getLyXText(bv);
|
||||
}
|
||||
return lt;
|
||||
}
|
||||
|
@ -50,15 +50,15 @@ public:
|
||||
///
|
||||
CLEAR_FRAME = 2,
|
||||
///
|
||||
DRAW_FRAME = 3,
|
||||
DRAW_FRAME = 4,
|
||||
///
|
||||
SELECTION = 4,
|
||||
SELECTION = 8,
|
||||
///
|
||||
CURSOR_PAR = 5,
|
||||
CURSOR_PAR = 16,
|
||||
///
|
||||
FULL = 6,
|
||||
FULL = 32,
|
||||
///
|
||||
INIT = 7
|
||||
INIT = 64
|
||||
};
|
||||
///
|
||||
enum DrawFrame {
|
||||
@ -99,7 +99,7 @@ public:
|
||||
///
|
||||
void update(BufferView *, LyXFont const &, bool =false);
|
||||
///
|
||||
void SetUpdateStatus(BufferView *, UpdateCodes);
|
||||
void SetUpdateStatus(BufferView *, int what);
|
||||
///
|
||||
string const EditMessage() const;
|
||||
///
|
||||
@ -170,7 +170,7 @@ public:
|
||||
///
|
||||
void SetFrameColor(BufferView *, LColor::color);
|
||||
///
|
||||
LyXText * getLyXText(BufferView const *) const;
|
||||
LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
|
||||
///
|
||||
void deleteLyXText(BufferView *, bool recursive=true) const;
|
||||
///
|
||||
@ -178,11 +178,11 @@ public:
|
||||
///
|
||||
LyXParagraph * par;
|
||||
///
|
||||
mutable UpdateCodes need_update;
|
||||
mutable int need_update;
|
||||
|
||||
protected:
|
||||
///
|
||||
void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty);
|
||||
void UpdateLocal(BufferView *, int what, bool mark_dirty);
|
||||
///
|
||||
mutable int drawTextXOffset;
|
||||
///
|
||||
|
@ -227,7 +227,7 @@ public:
|
||||
// because we could have fake text insets and have to call this
|
||||
// inside them without cast!!!
|
||||
///
|
||||
virtual LyXText * getLyXText(BufferView const *) const;
|
||||
virtual LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
|
||||
///
|
||||
virtual void deleteLyXText(BufferView *, bool = true) const {}
|
||||
///
|
||||
|
@ -168,7 +168,7 @@ void LyXFindReplace::SearchReplaceAllCB()
|
||||
bv->hideCursor();
|
||||
|
||||
// start at top
|
||||
bv->text->ClearSelection();
|
||||
bv->text->ClearSelection(bv);
|
||||
bv->text->CursorTop(bv);
|
||||
|
||||
int replace_count = 0;
|
||||
@ -226,7 +226,7 @@ bool LyXFindReplace::SearchCB(bool fForward)
|
||||
|
||||
// clear the selection (if there is any)
|
||||
bv->toggleSelection();
|
||||
bv->text->ClearSelection();
|
||||
bv->text->ClearSelection(bv);
|
||||
|
||||
// set the new selection
|
||||
SetSelectionOverLenChars(bv, iLenSelected);
|
||||
|
779
src/lyxfunc.C
779
src/lyxfunc.C
File diff suppressed because it is too large
Load Diff
@ -94,7 +94,7 @@ private:
|
||||
///
|
||||
unsigned meta_fake_bit;
|
||||
///
|
||||
void moveCursorUpdate(LyXText *, bool selecting = false);
|
||||
void moveCursorUpdate(bool flag = true, bool selecting = false);
|
||||
///
|
||||
void setupLocalKeymap();
|
||||
///
|
||||
@ -128,7 +128,12 @@ private:
|
||||
void CloseBuffer();
|
||||
///
|
||||
void reloadBuffer();
|
||||
/// This is the same for all lyxfunc objects
|
||||
///
|
||||
// This return or directly text (default) of getLyXText()
|
||||
///
|
||||
LyXText * TEXT(bool) const;
|
||||
///
|
||||
// This is the same for all lyxfunc objects
|
||||
static bool show_sc;
|
||||
};
|
||||
|
||||
|
@ -235,7 +235,7 @@ public:
|
||||
/// need the selection cursor:
|
||||
void SetSelection(BufferView *);
|
||||
///
|
||||
void ClearSelection() const;
|
||||
void ClearSelection(BufferView *) const;
|
||||
///
|
||||
string const selectionAsString(Buffer const *) const;
|
||||
|
||||
|
@ -1895,7 +1895,7 @@ void LyXText::OpenFootnote(BufferView * bview)
|
||||
// Just a macro to make some thing easier.
|
||||
void LyXText::RedoParagraph(BufferView * bview) const
|
||||
{
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
RedoParagraphs(bview, cursor, cursor.par()->Next());
|
||||
SetCursorIntern(bview, cursor.par(), cursor.pos());
|
||||
}
|
||||
@ -4091,7 +4091,7 @@ void LyXText::InsertFootnoteEnvironment(BufferView * bview,
|
||||
|
||||
SetCursor(bview, sel_start_cursor.par()->Next(), 0);
|
||||
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
28
src/text2.C
28
src/text2.C
@ -657,7 +657,7 @@ void LyXText::SetLayout(BufferView * bview, LyXTextClass::size_type layout)
|
||||
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos(),
|
||||
false);
|
||||
UpdateCounters(bview, cursor.row());
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
SetSelection(bview);
|
||||
SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
|
||||
}
|
||||
@ -775,7 +775,7 @@ void LyXText::IncDepth(BufferView * bview)
|
||||
sel_cursor = cursor;
|
||||
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
|
||||
UpdateCounters(bview, cursor.row());
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
SetSelection(bview);
|
||||
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
|
||||
}
|
||||
@ -852,7 +852,7 @@ void LyXText::DecDepth(BufferView * bview)
|
||||
sel_cursor = cursor;
|
||||
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
|
||||
UpdateCounters(bview, cursor.row());
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
SetSelection(bview);
|
||||
SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
|
||||
}
|
||||
@ -934,7 +934,7 @@ void LyXText::SetFont(BufferView * bview, LyXFont const & font, bool toggleall)
|
||||
SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
|
||||
sel_cursor = cursor;
|
||||
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
SetSelection(bview);
|
||||
SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true,
|
||||
tmpcursor.boundary());
|
||||
@ -1208,10 +1208,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
|
||||
}
|
||||
|
||||
|
||||
void LyXText::ClearSelection() const
|
||||
void LyXText::ClearSelection(BufferView * bview) const
|
||||
{
|
||||
if (selection)
|
||||
status = LyXText::NEED_MORE_REFRESH;
|
||||
selection = false;
|
||||
mark_set = false;
|
||||
}
|
||||
@ -1298,7 +1296,7 @@ void LyXText::ToggleFree(BufferView * bview,
|
||||
/* Implicit selections are cleared afterwards and cursor is set to the
|
||||
original position. */
|
||||
if (implicitSelection) {
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
cursor = resetCursor;
|
||||
SetCursor(bview, cursor.par(), cursor.pos());
|
||||
sel_cursor = cursor;
|
||||
@ -1327,7 +1325,7 @@ void LyXText::MeltFootnoteEnvironment(BufferView * bview)
|
||||
{
|
||||
LyXParagraph * tmppar, * firsttmppar;
|
||||
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
|
||||
/* is is only allowed, if the cursor is IN an open footnote.
|
||||
* Otherwise it is too dangerous */
|
||||
@ -1413,7 +1411,7 @@ void LyXText::MeltFootnoteEnvironment(BufferView * bview)
|
||||
UpdateCounters(bview, row);
|
||||
|
||||
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1520,7 +1518,7 @@ void LyXText::SetParagraph(BufferView * bview,
|
||||
|
||||
RedoParagraphs(bview, sel_start_cursor, endpar);
|
||||
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
|
||||
sel_cursor = cursor;
|
||||
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
|
||||
@ -1610,7 +1608,7 @@ void LyXText::SetParagraphExtraOpt(BufferView * bview, int type,
|
||||
#endif
|
||||
}
|
||||
RedoParagraphs(bview, sel_start_cursor, endpar);
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
|
||||
sel_cursor = cursor;
|
||||
SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
|
||||
@ -2281,7 +2279,7 @@ void LyXText::CutSelection(BufferView * bview, bool doclear)
|
||||
|
||||
RedoParagraphs(bview, sel_start_cursor, endpar);
|
||||
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
cursor = sel_start_cursor;
|
||||
SetCursor(bview, cursor.par(), cursor.pos());
|
||||
sel_cursor = cursor;
|
||||
@ -2369,7 +2367,7 @@ void LyXText::PasteSelection(BufferView * bview)
|
||||
RedoParagraphs(bview, cursor, endpar);
|
||||
|
||||
SetCursor(bview, cursor.par(), cursor.pos());
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
|
||||
sel_cursor = cursor;
|
||||
SetCursor(bview, actpar, pos);
|
||||
@ -2509,7 +2507,7 @@ void LyXText::InsertStringA(BufferView * bview, string const & str)
|
||||
textclasslist.Style(bview->buffer()->params.textclass,
|
||||
cursor.par()->GetLayout()).isEnvironment();
|
||||
// only to be sure, should not be neccessary
|
||||
ClearSelection();
|
||||
ClearSelection(bview);
|
||||
|
||||
// insert the string, don't insert doublespace
|
||||
string::size_type i = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user