Add In nsetOld * argument to updateInset to rebreak the correct par.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7615 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2003-08-27 13:51:18 +00:00
parent a12509db90
commit 7338f3b980
26 changed files with 62 additions and 54 deletions

View File

@ -543,9 +543,9 @@ int BufferView::unlockInset(UpdatableInset * inset)
}
void BufferView::updateInset()
void BufferView::updateInset(InsetOld const * inset)
{
pimpl_->updateInset();
pimpl_->updateInset(inset);
}

View File

@ -79,8 +79,11 @@ public:
bool fitCursor();
/// perform pending painting updates
void update();
/// update for a particular inset
void updateInset();
/** update for a particular inset. Gets a pointer and not a
* reference because we really need the pointer information
* to find it in the buffer.
*/
void updateInset(InsetOld const *);
/// reset the scrollbar to reflect current view position
void updateScrollbar();
/// FIXME

View File

@ -40,6 +40,7 @@
#include "lyxrc.h"
#include "lastfiles.h"
#include "paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
#include "TextCache.h"
#include "undo_funcs.h"
@ -1182,7 +1183,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
case LFUN_INSET_INSERT: {
InsetOld * inset = createInset(ev);
if (inset && insertInset(inset)) {
updateInset();
updateInset(inset);
string const name = ev.getArg(0);
if (name == "bibitem") {
@ -1371,14 +1372,16 @@ bool BufferView::Pimpl::insertInset(InsetOld * inset, string const & lout)
}
void BufferView::Pimpl::updateInset()
void BufferView::Pimpl::updateInset(InsetOld const * inset)
{
if (!available())
return;
bv_->text->redoParagraph(outerPar(*bv_->buffer(), inset));
// this should not be needed, but it is...
bv_->text->redoParagraph(bv_->text->cursor.par());
//bv_->text->fullRebreak();
// bv_->text->redoParagraph(bv_->text->cursor.par());
// bv_->text->fullRebreak();
update();
updateScrollbar();

View File

@ -101,7 +101,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
///
bool insertInset(InsetOld * inset, string const & lout = string());
///
void updateInset();
void updateInset(InsetOld const * inset);
/// a function should be executed from the workarea
bool workAreaDispatch(FuncRequest const & ev);
/// a function should be executed

View File

@ -1,4 +1,8 @@
2003-08-27 Alfredo Braunstein <abraunst@libero.it>
* BufferView.[Ch]:
* BufferView_pimpl.[Ch] (updateInset): add an InsetOld * argument
2003-08-26 André Pönitz <poenitz@gmx.net>
* paragraph_func.[Ch] (outerPar): new function

View File

@ -35,6 +35,7 @@
#include "Lsstream.h"
#include "insets/updatableinset.h"
#include "insets/insettext.h"
#include <boost/bind.hpp>
#include <algorithm>
@ -232,8 +233,7 @@ bool changeDepth(BufferView * bv, LyXText * text, DEPTH_CHANGE type, bool test_o
bool const changed = text->changeDepth(type, false);
if (text->inset_owner)
bv->updateInset();
bv->update();
bv->updateInset(text->inset_owner);
return changed;
}

View File

@ -124,7 +124,7 @@ void PreviewedInset::imageReady(PreviewImage const & pimage) const
pimage_ = &pimage;
if (view())
view()->updateInset();
view()->updateInset(inset());
}
} // namespace graphics

View File

@ -66,7 +66,7 @@ dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
if (p.getCmdName().empty())
return DISPATCHED;
setParams(p);
cmd.view()->updateInset();
cmd.view()->updateInset(this);
cmd.view()->fitCursor();
return DISPATCHED;
}

View File

@ -125,7 +125,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
InsetBranchMailer::string2params(cmd.argument, params);
params_.branch = params.branch;
setButtonLabel();
bv->updateInset();
bv->updateInset(this);
return DISPATCHED;
}
case LFUN_INSET_EDIT:

View File

@ -210,7 +210,7 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
inset.insetUnlock(bv);
if (scroll())
scroll(bv, 0.0F);
bv->updateInset();
bv->updateInset(this);
}
@ -229,7 +229,7 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
if (collapsed_ && cmd.button() != mouse_button::button3) {
collapsed_ = false;
bv->updateInset();
bv->updateInset(this);
bv->buffer()->markDirty();
return;
}
@ -241,7 +241,7 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
collapsed_ = true;
bv->unlockInset(this);
}
bv->updateInset();
bv->updateInset(this);
bv->buffer()->markDirty();
lyxerr << "InsetCollapsable::lfunMouseRelease\n";
} else if (!collapsed_ && cmd.y > button_dim.y2) {
@ -296,7 +296,7 @@ InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
lyxerr << "branch collapsed_" << endl;
collapsed_ = false;
if (bv->lockInset(this)) {
bv->updateInset();
bv->updateInset(this);
bv->buffer()->markDirty();
inset.localDispatch(cmd);
first_after_edit = true;
@ -324,7 +324,7 @@ InsetOld::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
first_after_edit = true;
if (!bv->lockInset(this))
return DISPATCHED;
bv->updateInset();
bv->updateInset(this);
bv->buffer()->markDirty();
inset.localDispatch(cmd);
} else {
@ -488,7 +488,7 @@ void InsetCollapsable::open(BufferView * bv)
return;
collapsed_ = false;
bv->updateInset();
bv->updateInset(this);
}
@ -498,7 +498,7 @@ void InsetCollapsable::close(BufferView * bv) const
return;
collapsed_ = true;
bv->updateInset();
bv->updateInset(this);
}

View File

@ -102,7 +102,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
return UNDISPATCHED;
setParams(p);
cmd.view()->updateInset();
cmd.view()->updateInset(this);
return DISPATCHED;
}

View File

@ -455,7 +455,7 @@ InsetOld::RESULT InsetERT::localDispatch(FuncRequest const & cmd)
* taken by the text).
*/
inset.getLyXText(cmd.view())->fullRebreak();
bv->updateInset();
bv->updateInset(this);
result = DISPATCHED;
}
break;
@ -603,7 +603,7 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
break;
}
if (bv) {
bv->updateInset();
bv->updateInset(this);
bv->buffer()->markDirty();
}
}

View File

@ -127,7 +127,7 @@ void InsetExternal::statusChanged()
{
BufferView * bv = renderer_->view();
if (bv)
bv->updateInset();
bv->updateInset(this);
}
@ -152,7 +152,7 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
InsetExternal::Params p;
InsetExternalMailer::string2params(cmd.argument, *buffer, p);
setParams(p, buffer);
cmd.view()->updateInset();
cmd.view()->updateInset(this);
return DISPATCHED;
}

View File

@ -172,7 +172,7 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
params_.wide = params.wide;
wide(params_.wide, cmd.view()->buffer()->params);
cmd.view()->updateInset();
cmd.view()->updateInset(this);
return DISPATCHED;
}

View File

@ -170,10 +170,8 @@ InsetGraphics::~InsetGraphics()
void InsetGraphics::statusChanged()
{
BufferView * bv = graphic_->view();
if (bv) {
bv->text->redoParagraph(outerPar(*bv->buffer(), this));
bv->updateInset();
}
if (bv)
bv->updateInset(this);
}
@ -186,7 +184,7 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
if (!p.filename.empty()) {
setParams(p);
cmd.view()->updateInset();
cmd.view()->updateInset(this);
}
return DISPATCHED;
}

View File

@ -138,7 +138,7 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
if (!p.cparams.getCmdName().empty()) {
set(p);
params_.masterFilename_ = cmd.view()->buffer()->fileName();
cmd.view()->updateInset();
cmd.view()->updateInset(this);
}
return DISPATCHED;
}
@ -600,7 +600,7 @@ void InsetInclude::PreviewImpl::restartLoading()
lyxerr << "restartLoading()" << std::endl;
removePreview();
if (view())
view()->updateInset();
view()->updateInset(&parent());
generatePreview();
}

View File

@ -68,7 +68,7 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
}
setParams(p);
cmd.view()->updateInset();
cmd.view()->updateInset(this);
return DISPATCHED;
}

View File

@ -111,7 +111,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
/* FIXME: I refuse to believe we have to live
* with ugliness like this ... */
inset.getLyXText(cmd.view())->fullRebreak();
cmd.view()->updateInset();
cmd.view()->updateInset(this);
return DISPATCHED;
}

View File

@ -141,7 +141,7 @@ dispatch_result InsetNote::localDispatch(FuncRequest const & cmd)
InsetNoteMailer::string2params(cmd.argument, params);
params_.type = params.type;
setButtonLabel();
bv->updateInset();
bv->updateInset(this);
return DISPATCHED;
}

View File

@ -422,7 +422,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
void InsetTabular::updateLocal(BufferView * bv) const
{
bv->updateInset();
bv->updateInset(this);
if (locked)
resetPos(bv);
}

View File

@ -317,7 +317,7 @@ void InsetText::updateLocal(BufferView * bv, bool /*mark_dirty*/)
text_.selection.cursor = text_.cursor;
bv->fitCursor();
bv->updateInset();
bv->updateInset(this);
bv->owner()->view_state_changed();
bv->owner()->updateMenubar();
bv->owner()->updateToolbar();

View File

@ -91,7 +91,7 @@ dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd)
params_.placement = params.placement;
params_.width = params.width;
cmd.view()->updateInset();
cmd.view()->updateInset(this);
return DISPATCHED;
}

View File

@ -125,7 +125,7 @@ InsetOld::RESULT UpdatableInset::localDispatch(FuncRequest const & ev)
int const xx = strToInt(ev.argument);
scroll(ev.view(), xx);
}
ev.view()->updateInset();
ev.view()->updateInset(this);
return DISPATCHED;
}

View File

@ -153,12 +153,12 @@ void InsetFormulaBase::insetUnlock(BufferView * bv)
if (mathcursor) {
if (mathcursor->inMacroMode()) {
mathcursor->macroModeClose();
bv->updateInset();
bv->updateInset(this);
}
releaseMathCursor(bv);
}
generatePreview();
bv->updateInset();
bv->updateInset(this);
}
@ -204,7 +204,7 @@ void InsetFormulaBase::fitInsetCursor(BufferView * bv) const
void InsetFormulaBase::toggleInsetSelection(BufferView * bv)
{
if (mathcursor)
bv->updateInset();
bv->updateInset(this);
}
@ -214,7 +214,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
return UNDISPATCHED;
BufferView * bv = cmd.view();
bv->updateInset();
bv->updateInset(this);
//lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button3) {
@ -233,7 +233,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
mathcursor->selClear();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->insert(ar);
bv->updateInset();
bv->updateInset(this);
return DISPATCHED;
}
@ -280,7 +280,7 @@ dispatch_result InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
return DISPATCHED;
}
bv->updateInset();
bv->updateInset(this);
return DISPATCHED;
}
@ -308,7 +308,7 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
BufferView * bv = cmd.view();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
bv->updateInset();
bv->updateInset(this);
return DISPATCHED;
}
@ -342,7 +342,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
}
// if that is removed, we won't get the magenta box when entering an
// inset for the first time
bv->updateInset();
bv->updateInset(this);
return DISPATCHED;
case LFUN_MOUSE_PRESS:
@ -720,7 +720,7 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
}
if (result == DISPATCHED)
bv->updateInset();
bv->updateInset(this);
mathcursor->normalize();
mathcursor->touch();
@ -850,7 +850,7 @@ bool InsetFormulaBase::searchForward(BufferView * bv, string const & str,
mathcursor->setSelection(it, ar.size());
current = it;
it.jump(ar.size());
bv->updateInset();
bv->updateInset(this);
return true;
}
}

View File

@ -282,7 +282,7 @@ void LyXText::toggleInset()
else
inset->open(bv());
bv()->updateInset();
bv()->updateInset(inset);
}
@ -848,7 +848,7 @@ void LyXText::setParagraph(bool line_top, bool line_bottom,
setSelection();
setCursor(tmpcursor.par(), tmpcursor.pos());
if (inset_owner)
bv()->updateInset();
bv()->updateInset(inset_owner);
}

View File

@ -355,7 +355,7 @@ void specialChar(LyXText * lt, BufferView * bv, InsetSpecialChar::Kind kind)
if (!bv->insertInset(new_inset))
delete new_inset;
else
bv->updateInset();
bv->updateInset(new_inset);
}