}
-void BufferView::updateInset(InsetOld * inset)
+void BufferView::updateInset()
{
- pimpl_->updateInset(inset);
+ pimpl_->updateInset();
}
/// perform pending painting updates
void update();
/// update for a particular inset
- void updateInset(InsetOld * inset);
+ void updateInset();
/// reset the scrollbar to reflect current view position
void updateScrollbar();
/// FIXME
case LFUN_INSET_INSERT: {
InsetOld * inset = createInset(ev);
if (inset && insertInset(inset)) {
- updateInset(inset);
+ updateInset();
string const name = ev.getArg(0);
if (name == "bibitem") {
}
-void BufferView::Pimpl::updateInset(InsetOld * inset)
+void BufferView::Pimpl::updateInset()
{
- if (!inset || !available())
+ if (!available())
return;
- // first check for locking insets
- if (bv_->theLockingInset()) {
- if (bv_->theLockingInset() == inset) {
- if (bv_->text->updateInset(inset)) {
- update();
- updateScrollbar();
- return;
- }
- } else if (bv_->theLockingInset()->updateInsetInInset(bv_, inset)) {
- if (bv_->text->updateInset(bv_->theLockingInset())) {
- update();
- updateScrollbar();
- return;
- }
- }
- }
-
- // then check if the inset is a top_level inset (has no owner)
- // if yes do the update as always otherwise we have to update the
- // toplevel inset where this inset is inside
- InsetOld * tl_inset = inset;
- while (tl_inset->owner())
- tl_inset = tl_inset->owner();
- if (tl_inset == inset) {
- update();
- if (bv_->text->updateInset(inset)) {
- update();
- return;
- }
- } else if (static_cast<UpdatableInset *>(tl_inset)
- ->updateInsetInInset(bv_, inset))
- {
- if (bv_->text->updateInset(tl_inset)) {
- update();
- updateScrollbar();
- }
- }
+ // this should not be needed, but it is...
+ bv_->text->redoParagraph(bv_->text->cursor.par());
+ update();
+ updateScrollbar();
}
///
bool insertInset(InsetOld * inset, string const & lout = string());
///
- void updateInset(InsetOld * inset);
+ void updateInset();
/// a function should be executed from the workarea
bool workAreaDispatch(FuncRequest const & ev);
/// a function should be executed
+2003-08-05 André Pönitz <poenitz@gmx.net>
+
+ * BufferView.[Ch]:
+ * BufferView_pimpl.[Ch]:
+ * bufferview_funcs.C:
+ * text2.C:
+ * text3.C: rip out "deep update"
+
2003-08-04 André Pönitz <poenitz@gmx.net>
* BufferView.[Ch]:
void lang(BufferView * bv, string const & l)
{
- LyXFont font(LyXFont::ALL_IGNORE);
Language const * lang = languages.getLanguage(l);
if (!lang)
return;
+ LyXFont font(LyXFont::ALL_IGNORE);
font.setLanguage(lang);
toggleAndShow(bv, font);
}
bool changeDepth(BufferView * bv, LyXText * text, DEPTH_CHANGE type, bool test_only)
{
if (!bv->available() || !text)
- return false;
+ return false;
if (test_only)
return text->changeDepth(type, true);
bool const changed = text->changeDepth(type, false);
if (text->inset_owner)
- bv->updateInset((InsetOld *)text->inset_owner);
+ bv->updateInset();
bv->update();
return changed;
}
pimage_ = &pimage;
if (view())
- view()->updateInset(&inset_);
+ view()->updateInset();
}
} // namespace graphics
+2003-08-05 André Pönitz <poenitz@gmx.net>
+
+ * insetbibitem.C:
+ * insetcollapsable.[Ch]:
+ * insetcommand.C:
+ * insetert.C:
+ * insetexternal.C:
+ * insetfloat.C:
+ * insetgraphics.C:
+ * insetinclude.C:
+ * insetlabel.C:
+ * insetminipage.C:
+ * insetnote.C:
+ * insettabular.[Ch]:
+ * insettext.[Ch]:
+ * insetwrap.C:
+ * updatableinset.[Ch]: rip out "deep update"
+
2003-08-04 André Pönitz <poenitz@gmx.net>
* insettext.[Ch] (updateLocal): remove 'what' argument by assuimng it
InsetBibitem::~InsetBibitem()
{
- InsetCommandMailer mailer("bibitem", *this);
- mailer.hideDialog();
+ InsetCommandMailer("bibitem", *this).hideDialog();
}
if (p.getCmdName().empty())
return DISPATCHED;
setParams(p);
- cmd.view()->updateInset(this);
+ cmd.view()->updateInset();
cmd.view()->fitCursor();
return DISPATCHED;
}
inset.insetUnlock(bv);
if (scroll())
scroll(bv, 0.0F);
- bv->updateInset(this);
+ bv->updateInset();
}
if (collapsed_ && cmd.button() != mouse_button::button3) {
collapsed_ = false;
- bv->updateInset(this);
+ bv->updateInset();
bv->buffer()->markDirty();
return;
}
- if (cmd.button() != mouse_button::button3 && hitButton(cmd))
- {
+ if (cmd.button() != mouse_button::button3 && hitButton(cmd)) {
if (collapsed_) {
collapsed_ = false;
- bv->updateInset(this);
- bv->buffer()->markDirty();
} else {
collapsed_ = true;
bv->unlockInset(this);
- bv->updateInset(this);
- bv->buffer()->markDirty();
}
- } else if (!collapsed_ && (cmd.y > button_dim.y2)) {
- ret = (inset.localDispatch(adjustCommand(cmd)) == DISPATCHED);
+ bv->updateInset();
+ bv->buffer()->markDirty();
+ } else if (!collapsed_ && cmd.y > button_dim.y2) {
+ ret = inset.localDispatch(adjustCommand(cmd)) == DISPATCHED;
}
if (cmd.button() == mouse_button::button3 && !ret)
showInsetDialog(bv);
lyxerr << "branch collapsed_" << endl;
collapsed_ = false;
if (bv->lockInset(this)) {
- bv->updateInset(this);
+ bv->updateInset();
bv->buffer()->markDirty();
inset.localDispatch(cmd);
first_after_edit = true;
first_after_edit = true;
if (!bv->lockInset(this))
return DISPATCHED;
- bv->updateInset(this);
+ bv->updateInset();
bv->buffer()->markDirty();
inset.localDispatch(cmd);
} else {
}
-bool InsetCollapsable::updateInsetInInset(BufferView * bv, InsetOld *in)
-{
- if (in == this)
- return true;
- return inset.updateInsetInInset(bv, in);
-}
-
-
int InsetCollapsable::insetInInsetY() const
{
return inset.insetInInsetY() - (top_baseline - inset.y());
void InsetCollapsable::open(BufferView * bv)
{
- if (!collapsed_) return;
+ if (!collapsed_)
+ return;
collapsed_ = false;
- bv->updateInset(this);
+ bv->updateInset();
}
return;
collapsed_ = true;
- bv->updateInset(const_cast<InsetCollapsable *>(this));
+ bv->updateInset();
}
bool unlockInsetInInset(BufferView *, UpdatableInset *,
bool lr = false);
///
- bool updateInsetInInset(BufferView *, InsetOld *);
- ///
int insetInInsetY() const;
///
RESULT localDispatch(FuncRequest const &);
return UNDISPATCHED;
setParams(p);
- cmd.view()->updateInset(this);
+ cmd.view()->updateInset();
return DISPATCHED;
}
* taken by the text).
*/
inset.getLyXText(cmd.view())->fullRebreak();
- bv->updateInset(this);
+ bv->updateInset();
result = DISPATCHED;
}
break;
break;
}
if (bv) {
- bv->updateInset(const_cast<InsetERT *>(this));
+ bv->updateInset();
bv->buffer()->markDirty();
}
}
{
BufferView * bv = renderer_->view();
if (bv)
- bv->updateInset(this);
+ bv->updateInset();
}
InsetExternal::Params p;
InsetExternalMailer::string2params(cmd.argument, *buffer, p);
setParams(p, buffer);
- cmd.view()->updateInset(this);
+ cmd.view()->updateInset();
return DISPATCHED;
}
dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
{
- InsetOld::RESULT result = UNDISPATCHED;
-
switch (cmd.action) {
+
case LFUN_INSET_MODIFY: {
InsetFloatParams params;
InsetFloatMailer::string2params(cmd.argument, params);
params_.wide = params.wide;
wide(params_.wide, cmd.view()->buffer()->params);
- cmd.view()->updateInset(this);
- result = DISPATCHED;
+ cmd.view()->updateInset();
+ return DISPATCHED;
}
- break;
case LFUN_INSET_DIALOG_UPDATE: {
- InsetFloatMailer mailer(*this);
- mailer.updateDialog(cmd.view());
+ InsetFloatMailer(*this).updateDialog(cmd.view());
+ return DISPATCHED;
}
- break;
default:
- result = InsetCollapsable::localDispatch(cmd);
+ return InsetCollapsable::localDispatch(cmd);
}
-
- return result;
}
os << "Float " // getInsetName()
<< type << '\n';
- if (!placement.empty()) {
+ if (!placement.empty())
os << "placement " << placement << "\n";
- }
- if (wide) {
+
+ if (wide)
os << "wide true\n";
- } else {
+ else
os << "wide false\n";
- }
}
{
BufferView * bv = graphic_->view();
if (bv)
- bv->updateInset(this);
+ bv->updateInset();
}
InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
if (!p.filename.empty()) {
setParams(p);
- cmd.view()->updateInset(this);
+ cmd.view()->updateInset();
}
return DISPATCHED;
}
if (!p.cparams.getCmdName().empty()) {
set(p);
params_.masterFilename_ = cmd.view()->buffer()->fileName();
- cmd.view()->updateInset(this);
+ cmd.view()->updateInset();
}
return DISPATCHED;
}
lyxerr << "restartLoading()" << std::endl;
removePreview();
if (view())
- view()->updateInset(&parent());
+ view()->updateInset();
generatePreview();
}
case LFUN_INSET_EDIT:
InsetCommandMailer("label", *this).showDialog(cmd.view());
- result = DISPATCHED;
+ return DISPATCHED;
break;
case LFUN_INSET_MODIFY: {
}
setParams(p);
- cmd.view()->updateInset(this);
- result = DISPATCHED;
+ cmd.view()->updateInset();
+ return DISPATCHED;
}
- break;
default:
- result = InsetCommand::localDispatch(cmd);
+ return InsetCommand::localDispatch(cmd);
}
-
- return result;
}
InsetMinipage::~InsetMinipage()
{
- InsetMinipageMailer mailer(*this);
- mailer.hideDialog();
+ InsetMinipageMailer(*this).hideDialog();
}
/* FIXME: I refuse to believe we have to live
* with ugliness like this ... */
inset.getLyXText(cmd.view())->fullRebreak();
- cmd.view()->updateInset(this);
+ cmd.view()->updateInset();
return DISPATCHED;
}
BufferView * bv = cmd.view();
switch (cmd.action) {
- case LFUN_INSET_MODIFY:
- {
+
+ case LFUN_INSET_MODIFY: {
InsetNoteParams params;
InsetNoteMailer::string2params(cmd.argument, params);
params_.type = params.type;
setButtonLabel();
- bv->updateInset(this);
+ bv->updateInset();
return DISPATCHED;
- }
+ }
+
case LFUN_INSET_EDIT:
- if (cmd.button() != mouse_button::button3)
- return InsetCollapsable::localDispatch(cmd);
- return UNDISPATCHED;
+ if (cmd.button() == mouse_button::button3)
+ return UNDISPATCHED;
+ return InsetCollapsable::localDispatch(cmd);
+
case LFUN_INSET_DIALOG_UPDATE:
InsetNoteMailer("note", *this).updateDialog(bv);
return DISPATCHED;
+
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetNoteMailer("note", *this).showDialog(bv);
return DISPATCHED;
}
// fallthrough:
+
default:
return InsetCollapsable::localDispatch(cmd);
}
need_update = what;
// Dirty Cast! (Lgb)
if (need_update != NONE) {
- bv->updateInset(const_cast<InsetTabular *>(this));
+ bv->updateInset();
if (locked)
resetPos(bv);
}
}
-bool InsetTabular::updateInsetInInset(BufferView * bv, InsetOld * inset)
-{
- InsetOld * tl_inset = inset;
- // look if this inset is really inside myself!
- while (tl_inset->owner() && tl_inset->owner() != this)
- tl_inset = tl_inset->owner();
- // if we enter here it's not ower inset
- if (!tl_inset->owner())
- return false;
- // we only have to do this if this is a subinset of our cells
- if (tl_inset != inset) {
- if (!static_cast<InsetText *>(tl_inset)->updateInsetInInset(bv, inset))
- return false;
- }
- updateLocal(bv, CELL);
- return true;
-}
-
-
int InsetTabular::insetInInsetY() const
{
if (!the_locking_inset)
if (actrow != orow)
updateLocal(bv, NONE);
clearSelection();
-#if 0
- if (cmd.button() == mouse_button::button3) {
- if ((ocell != actcell) && the_locking_inset) {
- the_locking_inset->insetUnlock(bv);
- updateLocal(bv, CELL);
- the_locking_inset = 0;
- }
- return;
- }
-#endif
bool const inset_hit = insetHit(bv, cmd.x, cmd.y);
bool unlockInsetInInset(BufferView *, UpdatableInset *,
bool lr = false);
///
- bool updateInsetInInset(BufferView *, InsetOld *);
- ///
int insetInInsetY() const;
///
UpdatableInset * getLockingInset() const;
frame_y = top_baseline - dim_.asc + ttoD2;
frame_w = dim_.wid - TEXT_TO_INSET_OFFSET;
frame_h = dim_.asc + dim_.des - TEXT_TO_INSET_OFFSET;
- pain.rectangle(frame_x, frame_y, frame_w, frame_h,
- frame_color);
+ pain.rectangle(frame_x, frame_y, frame_w, frame_h, frame_color);
}
bv->fitCursor();
if (flag)
- bv->updateInset(const_cast<InsetText *>(this));
+ bv->updateInset();
bv->owner()->view_state_changed();
bv->owner()->updateMenubar();
}
-bool InsetText::updateInsetInInset(BufferView * bv, InsetOld * inset)
-{
- if (!autoBreakRows && paragraphs.size() > 1)
- collapseParagraphs(bv);
-
- if (inset == this)
- return true;
-
- if (inset->owner() != this) {
- bool found = false;
- UpdatableInset * tl_inset = the_locking_inset;
- if (tl_inset)
- found = tl_inset->updateInsetInInset(bv, inset);
- if (!found) {
- tl_inset = static_cast<UpdatableInset *>(inset);
- while(tl_inset->owner() && tl_inset->owner() != this)
- tl_inset = static_cast<UpdatableInset *>(tl_inset->owner());
- if (!tl_inset->owner())
- return false;
- found = tl_inset->updateInsetInInset(bv, inset);
- } else {
- text_.updateInset(tl_inset);
- }
- return found;
- }
- bool found = text_.updateInset(inset);
- if (found) {
- if (the_locking_inset &&
- cpar() == inset_par && cpos() == inset_pos)
- {
- inset_x = cix() - top_x + drawTextXOffset;
- inset_y = ciy() + drawTextYOffset;
- }
- }
- return found;
-}
-
-
void InsetText::lfunMousePress(FuncRequest const & cmd)
{
no_selection = true;
bool unlockInsetInInset(BufferView *,
UpdatableInset *, bool lr = false);
///
- bool updateInsetInInset(BufferView *, InsetOld *);
- ///
RESULT localDispatch(FuncRequest const &);
///
int latex(Buffer const *, std::ostream &,
params_.placement = params.placement;
params_.width = params.width;
- cmd.view()->updateInset(this);
+ cmd.view()->updateInset();
return DISPATCHED;
}
void InsetWrapParams::write(ostream & os) const
{
- os << "Wrap " // getInsetName()
- << type << '\n';
+ os << "Wrap " << type << '\n';
- if (!placement.empty()) {
+ if (!placement.empty())
os << "placement " << placement << "\n";
- }
+
os << "width \"" << width.asString() << "\"\n";
}
int const xx = strToInt(ev.argument);
scroll(ev.view(), xx);
}
- ev.view()->updateInset(this);
+ ev.view()->updateInset();
return DISPATCHED;
}
///
virtual int insetInInsetY() const { return 0; }
///
- virtual bool updateInsetInInset(BufferView *, InsetOld *)
- { return false; }
- ///
virtual bool lockInsetInInset(BufferView *, UpdatableInset *)
{ return false; }
///
if (mathcursor) {
if (mathcursor->inMacroMode()) {
mathcursor->macroModeClose();
- bv->updateInset(this);
+ bv->updateInset();
}
releaseMathCursor(bv);
}
generatePreview();
- bv->updateInset(this);
+ bv->updateInset();
}
void InsetFormulaBase::toggleInsetSelection(BufferView * bv)
{
if (mathcursor)
- bv->updateInset(this);
+ bv->updateInset();
}
return UNDISPATCHED;
BufferView * bv = cmd.view();
- bv->updateInset(this);
+ bv->updateInset();
//lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button3) {
mathcursor->selClear();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->insert(ar);
- bv->updateInset(this);
+ bv->updateInset();
return DISPATCHED;
}
return DISPATCHED;
}
- bv->updateInset(this);
+ bv->updateInset();
return DISPATCHED;
}
BufferView * bv = cmd.view();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
- bv->updateInset(this);
+ bv->updateInset();
return DISPATCHED;
}
}
// if that is removed, we won't get the magenta box when entering an
// inset for the first time
- bv->updateInset(this);
+ bv->updateInset();
return DISPATCHED;
case LFUN_MOUSE_PRESS:
}
if (result == DISPATCHED)
- bv->updateInset(this);
+ bv->updateInset();
mathcursor->normalize();
mathcursor->touch();
mathcursor->setSelection(it, ar.size());
current = it;
it.jump(ar.size());
- bv->updateInset(this);
+ bv->updateInset();
return true;
}
}
if (!isHighlyEditableInset(inset))
recordUndo(bv(), Undo::ATOMIC);
- if (inset->isOpen()) {
+ if (inset->isOpen())
inset->close(bv());
- } else {
+ else
inset->open(bv());
- }
- bv()->updateInset(inset);
+ bv()->updateInset();
}
setSelection();
setCursor(tmpcursor.par(), tmpcursor.pos());
if (inset_owner)
- bv()->updateInset(inset_owner);
+ bv()->updateInset();
}
if (selecting || lt->selection.mark()) {
lt->setSelection();
if (lt->isInInset())
- bv->updateInset(lt->inset_owner);
+ bv->updateInset();
}
bv->update();
if (!bv->insertInset(new_inset))
delete new_inset;
else
- bv->updateInset(new_inset);
+ bv->updateInset();
}
update();
changeCase(LyXText::text_uppercase);
if (inset_owner)
- bv->updateInset(inset_owner);
+ bv->updateInset();
update();
break;
update();
changeCase(LyXText::text_lowercase);
if (inset_owner)
- bv->updateInset(inset_owner);
+ bv->updateInset();
update();
break;
update();
changeCase(LyXText::text_capitalization);
if (inset_owner)
- bv->updateInset(inset_owner);
+ bv->updateInset();
update();
break;
if (transposeChars(cursor))
checkParagraph(cursor.par(), cursor.pos());
if (inset_owner)
- bv->updateInset(inset_owner);
+ bv->updateInset();
update();
break;