mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Fix bug #11030.
Factor out the code that connects to a newly created dialog and then use that also in GuiGraphics. There must be many other dialogs that need this same treatment....
This commit is contained in:
parent
e438c0f90b
commit
9446aa3640
@ -275,5 +275,30 @@ void Dialog::restoreSession()
|
|||||||
settings.value(sessionKey() + "/geometry").toByteArray());
|
settings.value(sessionKey() + "/geometry").toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If we have just created an inset, then we want to attach the
|
||||||
|
// dialog to it. This (i) allows further modification of that inset and
|
||||||
|
// (ii) prevents an additional click on Apply or OK from unexpectedly
|
||||||
|
// creating another inset. (See #3964 and #11030.)
|
||||||
|
void Dialog::connectToNewInset()
|
||||||
|
{
|
||||||
|
GuiView & view = const_cast<GuiView &>(lyxview());
|
||||||
|
BufferView * bv = view.currentBufferView();
|
||||||
|
// should have one, but just to be safe...
|
||||||
|
if (!bv)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// are we attached to an inset already?
|
||||||
|
Inset * ins = bv->editedInset(fromqstr(name_));
|
||||||
|
if (ins)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// no, so we just inserted one, and now we are behind it.
|
||||||
|
Cursor const & cur = bv->cursor();
|
||||||
|
ins = cur.prevInset();
|
||||||
|
if (ins)
|
||||||
|
bv->editInset(fromqstr(name_), ins);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -266,6 +266,8 @@ protected:
|
|||||||
virtual void apply();
|
virtual void apply();
|
||||||
/// To be called when the buffer view has changed
|
/// To be called when the buffer view has changed
|
||||||
virtual void onBufferViewChanged() = 0;
|
virtual void onBufferViewChanged() = 0;
|
||||||
|
///
|
||||||
|
void connectToNewInset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The Dialog's name is the means by which a dialog identifies
|
/** The Dialog's name is the means by which a dialog identifies
|
||||||
|
@ -198,25 +198,7 @@ void GuiCitation::applyView()
|
|||||||
QString const after = textAfterED->text();
|
QString const after = textAfterED->text();
|
||||||
|
|
||||||
applyParams(choice, full, force, before, after);
|
applyParams(choice, full, force, before, after);
|
||||||
|
connectToNewInset();
|
||||||
// If we have just created a citation inset, then we want to attach the
|
|
||||||
// dialog to it. This (i) allows further modification of that inset and
|
|
||||||
// (ii) prevents an additional click on Apply or OK from unexpectedly
|
|
||||||
// creating another inset. (See #3964.)
|
|
||||||
GuiView & view = const_cast<GuiView &>(lyxview());
|
|
||||||
BufferView * bv = view.currentBufferView();
|
|
||||||
// should have one, but just to be safe...
|
|
||||||
if (bv) {
|
|
||||||
// are we attached to an inset already?
|
|
||||||
Inset * ins = bv->editedInset("citation");
|
|
||||||
if (!ins) {
|
|
||||||
// no, so we just inserted one, and now we are behind it.
|
|
||||||
Cursor const & cur = bv->cursor();
|
|
||||||
ins = cur.prevInset();
|
|
||||||
if (ins)
|
|
||||||
bv->editInset("citation", ins);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -770,6 +770,7 @@ void GuiGraphics::dispatchParams()
|
|||||||
InsetGraphicsParams tmp_params(params_);
|
InsetGraphicsParams tmp_params(params_);
|
||||||
string const lfun = InsetGraphics::params2string(tmp_params, buffer());
|
string const lfun = InsetGraphics::params2string(tmp_params, buffer());
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
|
connectToNewInset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user