diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index beae2eacb5..f42ae6f022 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -2634,6 +2634,18 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) } break; + case LFUN_OPENSTUFF: + { + LyXText * lt = bv_->getLyXText(); + hideCursor(); + beforeChange(lt); + update(lt, BufferView::SELECT|BufferView::FITCUR); + lt->openStuff(bv_); + update(lt, BufferView::SELECT|BufferView::FITCUR); + setState(); + } + break; + case LFUN_QUOTE: bv_->insertCorrectQuote(); break; diff --git a/src/ChangeLog b/src/ChangeLog index a9d3cccf24..70bb3a8ecd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,25 @@ +2001-07-10 Jean-Marc Lasgouttes + + * BufferView_pimpl.C (Dispatch): handle LFUN_OPENSTUFF. + + * text2.C (openStuff): reintroduce this method (which had been + nuked in NEW_INSETS frenzy). + + * lyxfunc.C (Dispatch): when an action has not been handled, use + its name in the error message, not its number. + + * paragraph.C (inInset): change method name to begin with lowercase. + + * undo_funcs.C: + * text2.C: updates because of this. + +2001-07-09 Jean-Marc Lasgouttes + + * ToolbarDefaults.C (add): add spaces in error message + 2001-07-10 Lars Gullik Bjønnes - * buffer.C (readLyXformat2): initailize the ert comp. variables. + * buffer.C (readLyXformat2): initialize the ert comp. variables. (readLyXformat2): rename return_par to first_par, use lyxlex's pushToken and remove the manual push handling. (parseSingleLyXformat2Token): add another ert comp. variable: diff --git a/src/ToolbarDefaults.C b/src/ToolbarDefaults.C index afca95d881..a51b9ff984 100644 --- a/src/ToolbarDefaults.C +++ b/src/ToolbarDefaults.C @@ -155,8 +155,8 @@ void ToolbarDefaults::add(string const & func) int const tf = lyxaction.LookupFunc(func); if (tf == -1) { - lyxerr << "Toolbar::add: no LyX command called`" - << func << "'exists!" << endl; + lyxerr << "Toolbar::add: no LyX command called `" + << func << "' exists!" << endl; } else { add(tf); } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index ddb944ed32..9d83f19d05 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,10 @@ +2001-07-11 Jean-Marc Lasgouttes + + * insetcollapsable.C (edit): always open collapsed insets (even if + they are not autocollapsable) + + * insetcommand.C (operator=): simplify. + 2001-07-10 Lars Gullik Bjønnes * insetert.C (latex): handle META_NEWLINE diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 96b4b29768..43d93e6918 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -229,13 +229,13 @@ void InsetCollapsable::edit(BufferView * bv, int xp, int yp, { UpdatableInset::edit(bv, xp, yp, button); - if (collapsed && autocollapse) { + if (collapsed) { collapsed = false; if (!bv->lockInset(this)) return; bv->updateInset(this, false); inset.edit(bv, 0, 0, button); - } else if (!collapsed) { + } else { if (!bv->lockInset(this)) return; inset.edit(bv, xp, yp + (top_baseline - inset.y()), button); diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 0c89324088..d48bbbdcb4 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -66,8 +66,8 @@ void InsetCommandParams::setFromString( string const & b ) bool InsetCommandParams::operator==(InsetCommandParams const & o) const { - if (cmdname == o.cmdname && contents == o.contents && options == o.options) return true; - return false; + return cmdname == o.cmdname && contents == o.contents + && options == o.options; } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 00feadb065..57b5ac205c 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1555,7 +1555,8 @@ string const LyXFunc::Dispatch(int ac, // Then if it was none of the above if (!owner->view()->Dispatch(action, argument)) lyxerr << "A truly unknown func [" - << action << "]!" << endl; + << lyxaction.getActionName(action) << "]!" + << endl; break; } // end of switch diff --git a/src/lyxtext.h b/src/lyxtext.h index e5f4275df9..9cf1d7859f 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -376,6 +376,8 @@ public: void getVisibleRow(BufferView *, int y_offset, int x_offset, Row * row_ptr, int y, bool cleared=false); + /// + void openStuff(BufferView *); /// void cutSelection(BufferView *, bool = true); /// diff --git a/src/paragraph.C b/src/paragraph.C index c6553fdc39..5ce8667b97 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -861,7 +861,7 @@ void Paragraph::breakParagraph(BufferParams const & bparams, // create a new paragraph Paragraph * tmp = new Paragraph(this); // remember to set the inset_owner - tmp->setInsetOwner(InInset()); + tmp->setInsetOwner(inInset()); // this is an idea for a more userfriendly layout handling, I will // see what the users say @@ -2018,7 +2018,7 @@ bool Paragraph::isFirstInSequence() const } -Inset * Paragraph::InInset() const +Inset * Paragraph::inInset() const { return pimpl_->inset_owner; } diff --git a/src/paragraph.h b/src/paragraph.h index 8d014b08b4..da4fb01894 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -150,7 +150,7 @@ public: proof environment */ int getEndLabel(BufferParams const &) const; /// - Inset * InInset() const; + Inset * inInset() const; /// void setInsetOwner(Inset * i); /// diff --git a/src/text2.C b/src/text2.C index 70d560cc6d..a33a829bac 100644 --- a/src/text2.C +++ b/src/text2.C @@ -360,6 +360,22 @@ void LyXText::insertParagraph(BufferView * bview, Paragraph * par, } } +void LyXText::openStuff(BufferView * bview) +{ + if (cursor.pos() == 0 && cursor.par()->bibkey){ + cursor.par()->bibkey->edit(bview, 0, 0, 0); + } else if (cursor.pos() < cursor.par()->size() + && cursor.par()->getChar(cursor.pos()) == Paragraph::META_INSET) { + Inset * inset = cursor.par()->getInset(cursor.pos()); + if (!inset->editable()) + return; + bview->owner()->message(inset->editMessage()); + if (inset->editable() != Inset::HIGHLY_EDITABLE) + setCursorParUndo(bview); + inset->edit(bview, 0, 0, 0); + } +} + /* used in setlayout */ // Asger is not sure we want to do this... @@ -1455,11 +1471,11 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const // the caption hack: if (layout.labeltype == LABEL_SENSITIVE) { - bool isOK (par->InInset() && par->InInset()->owner() && - (par->InInset()->owner()->lyxCode() == Inset::FLOAT_CODE)); + bool isOK (par->inInset() && par->inInset()->owner() && + (par->inInset()->owner()->lyxCode() == Inset::FLOAT_CODE)); if (isOK) { - InsetFloat * tmp = static_cast(par->InInset()->owner()); + InsetFloat * tmp = static_cast(par->inInset()->owner()); Floating const & fl = floatList.getType(tmp->type()); // We should get the correct number here too. @@ -2079,7 +2095,7 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, Paragraph::size_type pos, bool setfont, bool boundary) const { - InsetText * it = static_cast(par->InInset()); + InsetText * it = static_cast(par->inInset()); if (it && (it != inset_owner)) { it->getLyXText(bview)->setCursorIntern(bview, par, pos, setfont, boundary); @@ -2446,8 +2462,8 @@ Paragraph * LyXText::ownerParagraph(Paragraph * p) const Paragraph * LyXText::ownerParagraph(int id, Paragraph * p) const { Paragraph * op = bv_owner->buffer()->getParFromID(id); - if (op && op->InInset()) { - static_cast(op->InInset())->paragraph(p); + if (op && op->inInset()) { + static_cast(op->inInset())->paragraph(p); } else { if (inset_owner) { inset_owner->paragraph(p); diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 0288a053c5..70095c3424 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -159,7 +159,7 @@ bool textHandleUndo(BufferView * bv, Undo * undo) endpar = behind; tmppar = bv->buffer()->getParFromID(undo->number_of_cursor_par); - UpdatableInset* it = static_cast(tmppar3->InInset()); + UpdatableInset* it = static_cast(tmppar3->inInset()); if (it) { it->getLyXText(bv)->redoParagraphs(bv, it->getLyXText(bv)->cursor, endpar); @@ -239,8 +239,8 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind, before_number = first->previous()->id(); if (behind) behind_number = behind->id(); - if (first->InInset()) - inset_id = first->InInset()->id(); + if (first->inInset()) + inset_id = first->inInset()->id(); // Undo::EDIT and Undo::FINISH are // always finished. (no overlapping there)