global_menubar_->grabKeyboard();
}
+
////////////////////////////////////////////////////////////////////////
+//
// X11 specific stuff goes here...
+
#ifdef Q_WS_X11
bool GuiApplication::x11EventFilter(XEvent * xev)
{
} // namespace frontend
+void hideDialogs(std::string const & name, Inset * inset)
+{
+ if (theApp())
+ theApp()->hideDialogs(name, inset);
+}
+
+
////////////////////////////////////////////////////////////////////
//
// Font stuff
}
+////////////////////////////////////////////////////////////////////
+//
+// Misc stuff
+//
+////////////////////////////////////////////////////////////////////
+
frontend::Clipboard & theClipboard()
{
BOOST_ASSERT(frontend::guiApp);
#include "support/debug.h"
#include "support/gettext.h"
+#include "frontends/Application.h"
+
using namespace std;
namespace lyx {
InsetWrap::~InsetWrap()
{
- InsetWrapMailer(*this).hideDialog();
+ hideDialogs("ert", this);
}
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
InsetWrapParams params;
- InsetWrapMailer::string2params(to_utf8(cmd.argument()), params);
+ InsetWrap::string2params(to_utf8(cmd.argument()), params);
params_.lines = params.lines;
params_.placement = params.placement;
params_.overhang = params.overhang;
}
case LFUN_INSET_DIALOG_UPDATE:
- InsetWrapMailer(*this).updateDialog(&cur.bv());
+ cur.bv().updateDialog("wrap", params2string(params()));
break;
default:
bool InsetWrap::showInsetDialog(BufferView * bv) const
{
if (!InsetText::showInsetDialog(bv))
- InsetWrapMailer(const_cast<InsetWrap &>(*this)).showDialog(bv);
+ bv->showDialog("wrap", params2string(params()),
+ const_cast<InsetWrap *>(this));
return true;
}
-string const InsetWrapMailer::name_("wrap");
-
-InsetWrapMailer::InsetWrapMailer(InsetWrap & inset)
- : inset_(inset)
-{}
-
-
-string const InsetWrapMailer::inset2string(Buffer const &) const
-{
- return params2string(inset_.params());
-}
-
-
-void InsetWrapMailer::string2params(string const & in, InsetWrapParams & params)
+void InsetWrap::string2params(string const & in, InsetWrapParams & params)
{
params = InsetWrapParams();
if (in.empty())
string name;
lex >> name;
- if (!lex || name != name_)
- return print_mailer_error("InsetWrapMailer", in, 1, name_);
+ if (!lex || name != "wrap") {
+ LYXERR0("InsetWrap::string2params(" << in << ")\n"
+ "Expected arg 1 to be \"wrap\"\n");
+ return;
+ }
// This is part of the inset proper that is usually swallowed
// by Text::readInset
string id;
lex >> id;
- if (!lex || id != "Wrap")
- return print_mailer_error("InsetBoxMailer", in, 2, "Wrap");
+ if (!lex || id != "Wrap") {
+ LYXERR0("InsetWrap::string2params(" << in << ")\n"
+ "Expected arg 1 to be \"Wrap\"\n");
+ return;
+ }
// We have to read the type here!
lex >> params.type;
}
-string const InsetWrapMailer::params2string(InsetWrapParams const & params)
+string InsetWrap::params2string(InsetWrapParams const & params)
{
ostringstream data;
- data << name_ << ' ';
+ data << "wrap" << ' ';
params.write(data);
return data.str();
}
#include "InsetCollapsable.h"
#include "Length.h"
-#include "MailInset.h"
namespace lyx {
~InsetWrap();
///
InsetWrapParams const & params() const { return params_; }
+ ///
+ static void string2params(std::string const &, InsetWrapParams &);
+ ///
+ static std::string params2string(InsetWrapParams const &);
private:
///
void write(std::ostream & os) const;
docstring name_;
};
-
-class InsetWrapMailer : public MailInset {
-public:
- ///
- InsetWrapMailer(InsetWrap & inset);
- ///
- virtual Inset & inset() const { return inset_; }
- ///
- virtual std::string const & name() const { return name_; }
- ///
- virtual std::string const inset2string(Buffer const &) const;
- ///
- static void string2params(std::string const &, InsetWrapParams &);
- ///
- static std::string const params2string(InsetWrapParams const &);
-private:
- ///
- static std::string const name_;
- ///
- InsetWrap & inset_;
-};
-
-
} // namespace lyx
#endif