]> git.lyx.org Git - features.git/commitdiff
remove InsetWrapMailer class
authorAndré Pönitz <poenitz@gmx.net>
Thu, 27 Mar 2008 00:07:54 +0000 (00:07 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 27 Mar 2008 00:07:54 +0000 (00:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23991 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXFunc.cpp
src/frontends/Application.h
src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiWrap.cpp
src/insets/InsetERT.cpp
src/insets/InsetWrap.cpp
src/insets/InsetWrap.h

index de958700e15870e8f07f978b3c6698d85f7d0db3..95ff1536aeec1c436d20b57b115b344190201d7f 100644 (file)
@@ -1248,7 +1248,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        } 
                        case WRAP_CODE: {
                                InsetWrapParams p;
-                               data = InsetWrapMailer::params2string(p);
+                               data = InsetWrap::params2string(p);
                                break;
                        }
                        default:
index ab08ace6189e0851aa2484f247353ca4e95ca6be..28a64a48d6df2fa4a110a827a174c39cb518fc28 100644 (file)
@@ -245,6 +245,7 @@ public:
 
 frontend::Application * theApp();
 frontend::Application * createApplication(int & argc, char * argv[]);
+void hideDialogs(std::string const & name, Inset * inset);
 
 } // namespace lyx
 
index b1ee77e2cf20a00948c88bebb2fe3f9bcbaa8856..c3079de9bd85cc3c738c4ea2103c4fce646a92ee 100644 (file)
@@ -756,8 +756,11 @@ void GuiApplication::onLastWindowClosed()
                global_menubar_->grabKeyboard();
 }
 
+
 ////////////////////////////////////////////////////////////////////////
+//
 // X11 specific stuff goes here...
+
 #ifdef Q_WS_X11
 bool GuiApplication::x11EventFilter(XEvent * xev)
 {
@@ -794,6 +797,13 @@ bool GuiApplication::x11EventFilter(XEvent * xev)
 } // namespace frontend
 
 
+void hideDialogs(std::string const & name, Inset * inset)
+{
+       if (theApp())
+               theApp()->hideDialogs(name, inset);
+}
+
+
 ////////////////////////////////////////////////////////////////////
 //
 // Font stuff
@@ -820,6 +830,12 @@ frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
 }
 
 
+////////////////////////////////////////////////////////////////////
+//
+// Misc stuff
+//
+////////////////////////////////////////////////////////////////////
+
 frontend::Clipboard & theClipboard()
 {
        BOOST_ASSERT(frontend::guiApp);
index 743235f39e741a9edff5f33c2a00f8cd6d562e59..6cc8b54f090a7b24b7518ffab8b38d5384cc0930 100644 (file)
@@ -189,7 +189,7 @@ void GuiWrap::updateContents()
 
 bool GuiWrap::initialiseParams(string const & data)
 {
-       InsetWrapMailer::string2params(data, params_);
+       InsetWrap::string2params(data, params_);
        return true;
 }
 
@@ -202,7 +202,7 @@ void GuiWrap::clearParams()
 
 void GuiWrap::dispatchParams()
 {
-       string const lfun = InsetWrapMailer::params2string(params_);
+       string const lfun = InsetWrap::params2string(params_);
        dispatch(FuncRequest(getLfun(), lfun));
 }
 
index 0653c02399ecb6f6607a376a2edac603a950c00c..e4f4d4188e1d4b4439f32b8e9fb94d6f84b254d9 100644 (file)
@@ -50,8 +50,7 @@ InsetERT::InsetERT(Buffer const & buf, CollapseStatus status)
 
 InsetERT::~InsetERT()
 {
-       if (theApp())
-               theApp()->hideDialogs("ert", this);
+       hideDialogs("ert", this);
 }
 
 
index 244467ac86aa6bb0542b393af62f01bbc5d994c2..31e58670a485bc4c3e26dd184976c30c855cd2f1 100644 (file)
@@ -34,6 +34,8 @@
 #include "support/debug.h"
 #include "support/gettext.h"
 
+#include "frontends/Application.h"
+
 using namespace std;
 
 namespace lyx {
@@ -53,7 +55,7 @@ InsetWrap::InsetWrap(Buffer const & buf, string const & type)
 
 InsetWrap::~InsetWrap()
 {
-       InsetWrapMailer(*this).hideDialog();
+       hideDialogs("ert", this);
 }
 
 
@@ -62,7 +64,7 @@ void InsetWrap::doDispatch(Cursor & cur, FuncRequest & cmd)
        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;
@@ -71,7 +73,7 @@ void InsetWrap::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
-               InsetWrapMailer(*this).updateDialog(&cur.bv());
+               cur.bv().updateDialog("wrap", params2string(params()));
                break;
 
        default:
@@ -252,25 +254,13 @@ bool InsetWrap::insetAllowed(InsetCode code) const
 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())
@@ -282,15 +272,21 @@ void InsetWrapMailer::string2params(string const & in, InsetWrapParams & params)
 
        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;
@@ -298,10 +294,10 @@ void InsetWrapMailer::string2params(string const & in, InsetWrapParams & params)
 }
 
 
-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();
 }
index 4bdafb65555f6b95d3eae9c6f660408fcabf2988..6078e53ec6a5191ba63d3815ae0e53b59c59bb80 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "InsetCollapsable.h"
 #include "Length.h"
-#include "MailInset.h"
 
 
 namespace lyx {
@@ -50,6 +49,10 @@ public:
        ~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;
@@ -88,29 +91,6 @@ private:
        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