implement open-stuff + small things

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2219 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-07-11 12:10:46 +00:00
parent cf65aa62a6
commit b33a63e177
12 changed files with 77 additions and 20 deletions

View File

@ -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;

View File

@ -1,6 +1,25 @@
2001-07-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* 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 <Jean-Marc.Lasgouttes@inria.fr>
* ToolbarDefaults.C (add): add spaces in error message
2001-07-10 Lars Gullik Bjønnes <larsbj@birdstep.com>
* 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:

View File

@ -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);
}

View File

@ -1,3 +1,10 @@
2001-07-11 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* insetcollapsable.C (edit): always open collapsed insets (even if
they are not autocollapsable)
* insetcommand.C (operator=): simplify.
2001-07-10 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetert.C (latex): handle META_NEWLINE

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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);
///

View File

@ -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;
}

View File

@ -150,7 +150,7 @@ public:
proof environment */
int getEndLabel(BufferParams const &) const;
///
Inset * InInset() const;
Inset * inInset() const;
///
void setInsetOwner(Inset * i);
///

View File

@ -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<InsetFloat*>(par->InInset()->owner());
InsetFloat * tmp = static_cast<InsetFloat*>(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<InsetText *>(par->InInset());
InsetText * it = static_cast<InsetText *>(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<InsetText *>(op->InInset())->paragraph(p);
if (op && op->inInset()) {
static_cast<InsetText *>(op->inInset())->paragraph(p);
} else {
if (inset_owner) {
inset_owner->paragraph(p);

View File

@ -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<UpdatableInset*>(tmppar3->InInset());
UpdatableInset* it = static_cast<UpdatableInset*>(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)