#include "frontends/alert.h"
#include "frontends/Application.h"
+#include "frontends/Dialogs.h"
#include "frontends/Gui.h"
#include "frontends/LyXView.h"
}
+void LyX::hideDialogs(std::string const & name, Inset * inset) const
+{
+ vector<int> const & view_ids = pimpl_->application_->gui().viewIds();
+ vector<int>::const_iterator it = view_ids.begin();
+ vector<int>::const_iterator const end = view_ids.end();
+ for (; it != end; ++it)
+ pimpl_->application_->gui().view(*it).getDialogs().
+ hide(name, inset);
+}
+
+
int LyX::exec(int & argc, char * argv[])
{
// Here we need to parse the command line. At least
*/
Buffer const * const updateInset(Inset const *) const;
+ void hideDialogs(std::string const & name, Inset * inset) const;
+
/// Execute batch commands if available.
void execBatchCommands();
}
case LFUN_DIALOG_HIDE:
- Dialogs::hide(argument, 0);
+ LyX::cref().hideDialogs(argument, 0);
break;
case LFUN_DIALOG_TOGGLE: {
}
}
}
- if (!quitting) {
+ if (!quitting && lyx_view_) {
lyx_view_->updateMenubar();
lyx_view_->updateToolbars();
// Some messages may already be translated, so we cannot use _()
#include <boost/signal.hpp>
#include <boost/bind.hpp>
+using std::string;
namespace lyx {
-
-using std::string;
using lyx::frontend::Dialog;
-// Note that static boost signals break some compilers, so this wrapper
-// initialises the signal dynamically when it is first invoked.
-template<typename Signal>
-class BugfixSignal {
-public:
- Signal & operator()() { return thesignal(); }
- Signal const & operator()() const { return thesignal(); }
-
-private:
- Signal & thesignal() const
- {
- if (!signal_.get())
- signal_.reset(new Signal);
- return *signal_;
- }
-
- mutable boost::scoped_ptr<Signal> signal_;
-};
-
-
-namespace {
-
-BugfixSignal<boost::signal<void(string const &, Inset*)> > hideSignal;
-
-}
-
-
-void Dialogs::hide(string const & name, Inset* inset)
-{
- // Don't send the signal if we are quitting, because on MSVC it is
- // destructed before the cut stack in CutAndPaste.cpp, and this method
- // is called from some inset destructor if the cut stack is not empty
- // on exit.
- if (!quitting)
- hideSignal()(name, inset);
-}
-
-
Dialogs::Dialogs(LyXView & lyxview)
: lyxview_(lyxview), in_show_(false)
{
- // Connect signals
- connection_ = hideSignal().connect(boost::bind(&Dialogs::hideSlot, this, _1, _2));
}
-Dialogs::~Dialogs()
-{
- connection_.disconnect();
-}
Dialog * Dialogs::find_or_build(string const & name)
{
}
-void Dialogs::hideSlot(string const & name, Inset * inset)
+void Dialogs::hide(string const & name, Inset* inset)
{
+ // Don't send the signal if we are quitting, because on MSVC it is
+ // destructed before the cut stack in CutAndPaste.cpp, and this method
+ // is called from some inset destructor if the cut stack is not empty
+ // on exit.
+ if (quitting)
+ return;
+
std::map<string, DialogPtr>::const_iterator it =
dialogs_.find(name);
if (it == dialogs_.end())
public:
///
Dialogs(LyXView &);
- ///
- ~Dialogs();
/** Check the status of all visible dialogs and disable or reenable
* them as appropriate.
/** All Dialogs of the given \param name will be closed if they are
connected to the given \param inset.
*/
- static void hide(std::string const & name, Inset * inset);
+ void hide(std::string const & name, Inset * inset);
///
void disconnect(std::string const & name);
///
Inset * getOpenInset(std::string const & name) const;
private:
- ///
- void hideSlot(std::string const & name, Inset * inset);
///
void redraw() const;
///
#include "BufferView.h"
#include "debug.h"
+#include "LyX.h"
#include "frontends/Dialogs.h"
void MailInset::hideDialog() const
{
- Dialogs::hide(name(), &inset());
+ LyX::cref().hideDialogs(name(), &inset());
}