mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Rewrite the MailInset as suggested to Andr��.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6438 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d7d950c16f
commit
7ac850e36d
@ -1,3 +1,8 @@
|
|||||||
|
2003-03-10 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* Dialogs.h (hide): make it a static method that returns a
|
||||||
|
boost::signal2<> & (takes 'name' and 'inset' args).
|
||||||
|
|
||||||
2003-03-09 Angus Leeming <leeming@lyx.org>
|
2003-03-09 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* Dialogs.h: remove showMergeChanges.
|
* Dialogs.h: remove showMergeChanges.
|
||||||
|
@ -43,11 +43,20 @@ boost::signal0<void> & Dialogs::redrawGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boost::signal2<void, string const &, InsetBase*> & Dialogs::hide()
|
||||||
|
{
|
||||||
|
static BugfixSignal<boost::signal2<void, string const &, InsetBase*> >
|
||||||
|
thesignal;
|
||||||
|
return thesignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Dialogs::Dialogs(LyXView & lyxview)
|
Dialogs::Dialogs(LyXView & lyxview)
|
||||||
: lyxview_(lyxview)
|
: lyxview_(lyxview)
|
||||||
{
|
{
|
||||||
// Connect signals
|
// Connect signals
|
||||||
redrawGUI().connect(boost::bind(&Dialogs::redraw, this));
|
redrawGUI().connect(boost::bind(&Dialogs::redraw, this));
|
||||||
|
hide().connect(boost::bind(&Dialogs::hideSlot, this, _1, _2));
|
||||||
|
|
||||||
// All this is slated to go
|
// All this is slated to go
|
||||||
init_pimpl();
|
init_pimpl();
|
||||||
@ -106,12 +115,15 @@ void Dialogs::update(string const & name, string const & data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Dialogs::hide(string const & name)
|
void Dialogs::hideSlot(string const & name, InsetBase * inset)
|
||||||
{
|
{
|
||||||
Dialog * dialog = find(name);
|
Dialog * dialog = find(name);
|
||||||
if (!dialog)
|
if (!dialog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (inset && inset != getOpenInset(name))
|
||||||
|
return;
|
||||||
|
|
||||||
if (dialog->isVisible())
|
if (dialog->isVisible())
|
||||||
dialog->hide();
|
dialog->hide();
|
||||||
open_insets_[name] = 0;
|
open_insets_[name] = 0;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <boost/signals/signal0.hpp>
|
#include <boost/signals/signal0.hpp>
|
||||||
#include <boost/signals/signal1.hpp>
|
#include <boost/signals/signal1.hpp>
|
||||||
|
#include <boost/signals/signal2.hpp>
|
||||||
|
|
||||||
class Dialog;
|
class Dialog;
|
||||||
class InsetBase;
|
class InsetBase;
|
||||||
@ -123,13 +124,17 @@ public:
|
|||||||
Update the contents of the dialog.
|
Update the contents of the dialog.
|
||||||
*/
|
*/
|
||||||
void update(string const & name, string const & data);
|
void update(string const & name, string const & data);
|
||||||
///
|
/** All Dialogs of the given 'name' will be closed if they are
|
||||||
void hide(string const & name);
|
connected to the given 'inset'.
|
||||||
|
*/
|
||||||
|
static boost::signal2<void, string const &, InsetBase*> & hide();
|
||||||
///
|
///
|
||||||
void disconnect(string const & name);
|
void disconnect(string const & name);
|
||||||
///
|
///
|
||||||
InsetBase * getOpenInset(string const & name) const;
|
InsetBase * getOpenInset(string const & name) const;
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
void hideSlot(string const & name, InsetBase * inset);
|
||||||
///
|
///
|
||||||
void redraw() const;
|
void redraw() const;
|
||||||
///
|
///
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "ControlChanges.h"
|
#include "ControlChanges.h"
|
||||||
#include "frontends/Dialogs.h"
|
|
||||||
#include "frontends/LyXView.h"
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "funcrequest.h"
|
#include "funcrequest.h"
|
||||||
|
@ -1,3 +1,31 @@
|
|||||||
|
2003-03-10 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
|
* mailinset.[Ch] (showDialog, updateDialog): now take a mandatory
|
||||||
|
BufferView * arg.
|
||||||
|
(hideDialog): calls the new static Dialogs::hide() method.
|
||||||
|
|
||||||
|
* insetbibitem.C (edit):
|
||||||
|
* insetbibtex.C (edit):
|
||||||
|
* insetcite.C (edit):
|
||||||
|
* insetcommand.C (localDispatch):
|
||||||
|
* inseterror.C (d-tor):
|
||||||
|
* insetert.C (showInsetDialog):
|
||||||
|
* insetexternal.C (localDispatch, edit):
|
||||||
|
* insetfloat.C (localDispatch, showInsetDialog):
|
||||||
|
* insetfloatlist.C (edit):
|
||||||
|
* insetgraphics.C (localDispatch, edit):
|
||||||
|
* insetinclude.C (localDispatch, edit):
|
||||||
|
* insetindex.C (edit):
|
||||||
|
* insetlabel.C (edit):
|
||||||
|
* insetminipage.C (localDispatch, showInsetDialog):
|
||||||
|
* insetref.C (edit):
|
||||||
|
* insettabular.C (unlockInsetInInset, lfunMouseRelease, localDispatch,
|
||||||
|
resetPos, showInsetDialog, openLayoutDialog):
|
||||||
|
* insettoc.C (edit):
|
||||||
|
* inseturl.C (edit):
|
||||||
|
* insetwrap.C (localDispatch, showInsetDialog):
|
||||||
|
changes due to the changed MailInset interface.
|
||||||
|
|
||||||
2003-03-10 Dekel Tsur <dekelts@tau.ac.il>
|
2003-03-10 Dekel Tsur <dekelts@tau.ac.il>
|
||||||
|
|
||||||
* insetfloat.h: Set default placement to an empty string.
|
* insetfloat.h: Set default placement to an empty string.
|
||||||
|
@ -126,10 +126,10 @@ string const InsetBibitem::getScreenLabel(Buffer const *) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetBibitem::edit(BufferView *, int, int, mouse_button::state)
|
void InsetBibitem::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("bibitem", *this);
|
InsetCommandMailer mailer("bibitem", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,10 +218,10 @@ void InsetBibtex::fillWithBibKeys
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetBibtex::edit(BufferView *, int, int, mouse_button::state)
|
void InsetBibtex::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("bibtex", *this);
|
InsetCommandMailer mailer("bibtex", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ void InsetCitation::edit(BufferView * bv, int, int, mouse_button::state)
|
|||||||
setLoadingBuffer(bv->buffer(), false);
|
setLoadingBuffer(bv->buffer(), false);
|
||||||
|
|
||||||
InsetCommandMailer mailer("citation", *this);
|
InsetCommandMailer mailer("citation", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetCommandMailer mailer(cmd.argument, *this);
|
InsetCommandMailer mailer(cmd.argument, *this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(cmd.view());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@ InsetError::InsetError(string const & str, bool)
|
|||||||
|
|
||||||
InsetError::~InsetError()
|
InsetError::~InsetError()
|
||||||
{
|
{
|
||||||
if (view())
|
Dialogs::hide()("error", this);
|
||||||
view()->owner()->getDialogs().hide("error");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -670,10 +670,10 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetERT::showInsetDialog(BufferView *) const
|
bool InsetERT::showInsetDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
InsetERTMailer mailer(const_cast<InsetERT &>(*this));
|
InsetERTMailer mailer(const_cast<InsetERT &>(*this));
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ dispatch_result InsetExternal::localDispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetExternalMailer mailer(*this);
|
InsetExternalMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(cmd.view());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -111,10 +111,10 @@ string const InsetExternal::editMessage() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetExternal::edit(BufferView *, int, int, mouse_button::state)
|
void InsetExternal::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetExternalMailer mailer(*this);
|
InsetExternalMailer mailer(*this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ dispatch_result InsetFloat::localDispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetFloatMailer mailer(*this);
|
InsetFloatMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(cmd.view());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ bool InsetFloat::showInsetDialog(BufferView * bv) const
|
|||||||
if (!inset.showInsetDialog(bv)) {
|
if (!inset.showInsetDialog(bv)) {
|
||||||
InsetFloat * tmp = const_cast<InsetFloat *>(this);
|
InsetFloat * tmp = const_cast<InsetFloat *>(this);
|
||||||
InsetFloatMailer mailer(*tmp);
|
InsetFloatMailer mailer(*tmp);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -96,10 +96,10 @@ void InsetFloatList::read(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFloatList::edit(BufferView *, int, int, mouse_button::state)
|
void InsetFloatList::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("toc", *this);
|
InsetCommandMailer mailer("toc", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ dispatch_result InsetGraphics::localDispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetGraphicsMailer mailer(*this);
|
InsetGraphicsMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(cmd.view());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -436,10 +436,10 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetGraphics::edit(BufferView *, int, int, mouse_button::state)
|
void InsetGraphics::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetGraphicsMailer mailer(*this);
|
InsetGraphicsMailer mailer(*this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ dispatch_result InsetInclude::localDispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetIncludeMailer mailer(*this);
|
InsetIncludeMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(cmd.view());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -212,10 +212,10 @@ Inset * InsetInclude::clone(Buffer const & buffer, bool) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInclude::edit(BufferView *, int, int, mouse_button::state)
|
void InsetInclude::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetIncludeMailer mailer(*this);
|
InsetIncludeMailer mailer(*this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ string const InsetIndex::getScreenLabel(Buffer const *) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetIndex::edit(BufferView *, int, int, mouse_button::state)
|
void InsetIndex::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("index", *this);
|
InsetCommandMailer mailer("index", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ vector<string> const InsetLabel::getLabelList() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLabel::edit(BufferView *, int, int, mouse_button::state)
|
void InsetLabel::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("label", *this);
|
InsetCommandMailer mailer("label", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ dispatch_result InsetMinipage::localDispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetMinipageMailer mailer(*this);
|
InsetMinipageMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(cmd.view());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const
|
|||||||
if (!inset.showInsetDialog(bv)) {
|
if (!inset.showInsetDialog(bv)) {
|
||||||
InsetMinipage * tmp = const_cast<InsetMinipage *>(this);
|
InsetMinipage * tmp = const_cast<InsetMinipage *>(this);
|
||||||
InsetMinipageMailer mailer(*tmp);
|
InsetMinipageMailer mailer(*tmp);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -42,7 +42,7 @@ void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button)
|
|||||||
bv->owner()->dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
|
bv->owner()->dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
|
||||||
else if (button == mouse_button::button1) {
|
else if (button == mouse_button::button1) {
|
||||||
InsetCommandMailer mailer("ref", *this);
|
InsetCommandMailer mailer("ref", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ bool InsetTabular::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
|||||||
if (inset->lyxCode() == TABULAR_CODE &&
|
if (inset->lyxCode() == TABULAR_CODE &&
|
||||||
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) {
|
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) {
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(bv);
|
||||||
oldcell = actcell;
|
oldcell = actcell;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -884,7 +884,7 @@ bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
|
|||||||
}
|
}
|
||||||
if (cmd.button() == mouse_button::button3 && !ret) {
|
if (cmd.button() == mouse_button::button3 && !ret) {
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer mailer(*this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(cmd.view());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -1170,12 +1170,12 @@ Inset::RESULT InsetTabular::localDispatch(FuncRequest const & cmd)
|
|||||||
break;
|
break;
|
||||||
case LFUN_LAYOUT_TABULAR: {
|
case LFUN_LAYOUT_TABULAR: {
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer mailer(*this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetTabularMailer mailer(*this);
|
InsetTabularMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(bv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LFUN_TABULAR_FEATURE:
|
case LFUN_TABULAR_FEATURE:
|
||||||
@ -1667,7 +1667,7 @@ void InsetTabular::resetPos(BufferView * bv) const
|
|||||||
actcell != oldcell) {
|
actcell != oldcell) {
|
||||||
InsetTabular * inset = const_cast<InsetTabular *>(this);
|
InsetTabular * inset = const_cast<InsetTabular *>(this);
|
||||||
InsetTabularMailer mailer(*inset);
|
InsetTabularMailer mailer(*inset);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(bv);
|
||||||
oldcell = actcell;
|
oldcell = actcell;
|
||||||
}
|
}
|
||||||
in_reset_pos = 0;
|
in_reset_pos = 0;
|
||||||
@ -2354,7 +2354,7 @@ bool InsetTabular::showInsetDialog(BufferView * bv) const
|
|||||||
if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv)) {
|
if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv)) {
|
||||||
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
||||||
InsetTabularMailer mailer(*tmp);
|
InsetTabularMailer mailer(*tmp);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2372,7 +2372,7 @@ void InsetTabular::openLayoutDialog(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
InsetTabular * tmp = const_cast<InsetTabular *>(this);
|
||||||
InsetTabularMailer mailer(*tmp);
|
InsetTabularMailer mailer(*tmp);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,10 +53,10 @@ Inset::Code InsetTOC::lyxCode() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTOC::edit(BufferView *, int, int, mouse_button::state)
|
void InsetTOC::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("toc", *this);
|
InsetCommandMailer mailer("toc", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ InsetUrl::~InsetUrl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetUrl::edit(BufferView *, int, int, mouse_button::state)
|
void InsetUrl::edit(BufferView * bv, int, int, mouse_button::state)
|
||||||
{
|
{
|
||||||
InsetCommandMailer mailer("url", *this);
|
InsetCommandMailer mailer("url", *this);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ dispatch_result InsetWrap::localDispatch(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_INSET_DIALOG_UPDATE: {
|
case LFUN_INSET_DIALOG_UPDATE: {
|
||||||
InsetWrapMailer mailer(*this);
|
InsetWrapMailer mailer(*this);
|
||||||
mailer.updateDialog();
|
mailer.updateDialog(cmd.view());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const
|
|||||||
if (!inset.showInsetDialog(bv)) {
|
if (!inset.showInsetDialog(bv)) {
|
||||||
InsetWrap * tmp = const_cast<InsetWrap *>(this);
|
InsetWrap * tmp = const_cast<InsetWrap *>(this);
|
||||||
InsetWrapMailer mailer(*tmp);
|
InsetWrapMailer mailer(*tmp);
|
||||||
mailer.showDialog();
|
mailer.showDialog(bv);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,55 +14,27 @@
|
|||||||
#include "mailinset.h"
|
#include "mailinset.h"
|
||||||
#include "inset.h"
|
#include "inset.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "debug.h"
|
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
|
#include "support/LAssert.h"
|
||||||
#include "Lsstream.h"
|
#include "Lsstream.h"
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
void MailInset::showDialog(BufferView * bv) const
|
||||||
|
|
||||||
BufferView * cachedBufferView(InsetBase & inset, string const & title)
|
|
||||||
{
|
{
|
||||||
BufferView * const bv = inset.view();
|
lyx::Assert(bv);
|
||||||
if (!bv) {
|
|
||||||
lyxerr << "MailInset::" << title << ":\n"
|
|
||||||
<< "The BufferView has not been cached!"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
return bv;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace anon
|
|
||||||
|
|
||||||
|
|
||||||
void MailInset::showDialog() const
|
|
||||||
{
|
|
||||||
BufferView * bv = cachedBufferView(inset(), "showDialog");
|
|
||||||
if (!bv)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bv->owner()->getDialogs().show(name(), inset2string(), &inset());
|
bv->owner()->getDialogs().show(name(), inset2string(), &inset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MailInset::updateDialog() const
|
void MailInset::updateDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
BufferView * bv = cachedBufferView(inset(), "updateDDialog");
|
lyx::Assert(bv);
|
||||||
if (!bv)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bv->owner()->getDialogs().update(name(), inset2string());
|
bv->owner()->getDialogs().update(name(), inset2string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MailInset::hideDialog() const
|
void MailInset::hideDialog() const
|
||||||
{
|
{
|
||||||
BufferView * bv = cachedBufferView(inset(), "hideDialog");
|
Dialogs::hide()(name(), &inset());
|
||||||
if (!bv)
|
|
||||||
return;
|
|
||||||
|
|
||||||
InsetBase * cmp = bv->owner()->getDialogs().getOpenInset(name());
|
|
||||||
if (cmp == &inset())
|
|
||||||
bv->owner()->getDialogs().hide(name());
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class InsetBase;
|
class InsetBase;
|
||||||
|
class BufferView;
|
||||||
|
|
||||||
|
|
||||||
class MailInset {
|
class MailInset {
|
||||||
@ -24,9 +25,9 @@ public:
|
|||||||
///
|
///
|
||||||
virtual ~MailInset() {};
|
virtual ~MailInset() {};
|
||||||
///
|
///
|
||||||
void showDialog() const;
|
void showDialog(BufferView *) const;
|
||||||
///
|
///
|
||||||
void updateDialog() const;
|
void updateDialog(BufferView *) const;
|
||||||
///
|
///
|
||||||
void hideDialog() const;
|
void hideDialog() const;
|
||||||
///
|
///
|
||||||
|
@ -1409,7 +1409,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DIALOG_HIDE:
|
case LFUN_DIALOG_HIDE:
|
||||||
owner ->getDialogs().hide(argument);
|
Dialogs::hide()(argument, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DIALOG_DISCONNECT_INSET:
|
case LFUN_DIALOG_DISCONNECT_INSET:
|
||||||
|
Loading…
Reference in New Issue
Block a user