}
case WRAP_CODE: {
InsetWrapParams p;
}
case WRAP_CODE: {
InsetWrapParams p;
- data = InsetWrapMailer::params2string(p);
+ data = InsetWrap::params2string(p);
frontend::Application * theApp();
frontend::Application * createApplication(int & argc, char * argv[]);
frontend::Application * theApp();
frontend::Application * createApplication(int & argc, char * argv[]);
+void hideDialogs(std::string const & name, Inset * inset);
global_menubar_->grabKeyboard();
}
global_menubar_->grabKeyboard();
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// X11 specific stuff goes here...
// X11 specific stuff goes here...
#ifdef Q_WS_X11
bool GuiApplication::x11EventFilter(XEvent * xev)
{
#ifdef Q_WS_X11
bool GuiApplication::x11EventFilter(XEvent * xev)
{
+void hideDialogs(std::string const & name, Inset * inset)
+{
+ if (theApp())
+ theApp()->hideDialogs(name, inset);
+}
+
+
////////////////////////////////////////////////////////////////////
//
// Font stuff
////////////////////////////////////////////////////////////////////
//
// Font stuff
+////////////////////////////////////////////////////////////////////
+//
+// Misc stuff
+//
+////////////////////////////////////////////////////////////////////
+
frontend::Clipboard & theClipboard()
{
BOOST_ASSERT(frontend::guiApp);
frontend::Clipboard & theClipboard()
{
BOOST_ASSERT(frontend::guiApp);
bool GuiWrap::initialiseParams(string const & data)
{
bool GuiWrap::initialiseParams(string const & data)
{
- InsetWrapMailer::string2params(data, params_);
+ InsetWrap::string2params(data, params_);
void GuiWrap::dispatchParams()
{
void GuiWrap::dispatchParams()
{
- string const lfun = InsetWrapMailer::params2string(params_);
+ string const lfun = InsetWrap::params2string(params_);
dispatch(FuncRequest(getLfun(), lfun));
}
dispatch(FuncRequest(getLfun(), lfun));
}
- if (theApp())
- theApp()->hideDialogs("ert", this);
+ hideDialogs("ert", this);
#include "support/debug.h"
#include "support/gettext.h"
#include "support/debug.h"
#include "support/gettext.h"
+#include "frontends/Application.h"
+
using namespace std;
namespace lyx {
using namespace std;
namespace lyx {
InsetWrap::~InsetWrap()
{
InsetWrap::~InsetWrap()
{
- InsetWrapMailer(*this).hideDialog();
+ hideDialogs("ert", this);
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
InsetWrapParams params;
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;
params_.lines = params.lines;
params_.placement = params.placement;
params_.overhang = params.overhang;
}
case LFUN_INSET_DIALOG_UPDATE:
}
case LFUN_INSET_DIALOG_UPDATE:
- InsetWrapMailer(*this).updateDialog(&cur.bv());
+ cur.bv().updateDialog("wrap", params2string(params()));
bool InsetWrap::showInsetDialog(BufferView * bv) const
{
if (!InsetText::showInsetDialog(bv))
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));
-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())
{
params = InsetWrapParams();
if (in.empty())
string name;
lex >> name;
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;
// 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;
// We have to read the type here!
lex >> params.type;
-string const InsetWrapMailer::params2string(InsetWrapParams const & params)
+string InsetWrap::params2string(InsetWrapParams const & params)
params.write(data);
return data.str();
}
params.write(data);
return data.str();
}
#include "InsetCollapsable.h"
#include "Length.h"
#include "InsetCollapsable.h"
#include "Length.h"
~InsetWrap();
///
InsetWrapParams const & params() const { return params_; }
~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;
private:
///
void write(std::ostream & os) const;
-
-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
} // namespace lyx
#endif