]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlERT.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ControlERT.C
index a237d2c0a296e5dc357d008fb5e9ad489b809e29..a809f7795e40b506872d1b2961f83c88f16dd1e5 100644 (file)
@@ -1,82 +1,48 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file ControlERT.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Jürgen Vigna
+ * \author Angus Leeming
  *
- *           Copyright 2001 The LyX Team.
- *
- * ======================================================
- *
- * \author Jürgen Vigna, jug@sad.it
- * \author Angus Leeming, a.leeming@ic.ac.uk
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "ViewBase.h"
-#include "ButtonControllerBase.h"
 #include "ControlERT.h"
-#include "ControlInset.tmpl"
-#include "Dialogs.h"
-#include "frontends/LyXView.h"
-#include "buffer.h"
-#include "BufferView.h"
+#include "funcrequest.h"
 
-using std::vector;
-using SigC::slot;
 
-// sorry this is just a temporary hack we should include vspace.h! (Jug)
-extern const char * stringFromUnit(int);
+using std::string;
 
-ControlERT::ControlERT(LyXView & lv, Dialogs & d)
-       : ControlInset<InsetERT, ERTParams>(lv, d)
-{
-       d_.showERT.connect(slot(this, &ControlERT::showInset));
+namespace lyx {
+namespace frontend {
 
-       // We could have an extra method updateInset that calls
-       // view().update() rather than view().show(), but I don't see why
-       // it is really needed.
-       d_.updateERT.connect(slot(this, &ControlERT::showInset));
-}
-
-
-void ControlERT::applyParamsToInset()
-{
-       inset()->status(lv_.view(), params().status);
-}
+ControlERT::ControlERT(Dialog & parent)
+       : Dialog::Controller(parent), status_(InsetERT::Collapsed)
+{}
 
 
-void ControlERT::applyParamsNoInset()
+bool ControlERT::initialiseParams(string const & data)
 {
+       InsetERTMailer::string2params(data, status_);
+       return true;
 }
 
 
-ERTParams const ControlERT::getParams(InsetERT const & inset)
+void ControlERT::clearParams()
 {
-       return ERTParams(inset);
+       status_ = InsetERT::Collapsed;
 }
 
 
-ERTParams::ERTParams()
-       : status(InsetERT::Collapsed)
-{}
-
-ERTParams::ERTParams(InsetERT const & inset)
-       : status(inset.status())
-{}
-
-
-bool operator==(ERTParams const & p1, ERTParams const & p2)
+void ControlERT::dispatchParams()
 {
-       return (p1.status == p2.status);
+       string const lfun = InsetERTMailer::params2string(status_);
+       kernel().dispatch(FuncRequest(getLfun(), lfun));
 }
 
-
-bool operator!=(ERTParams const & p1, ERTParams const & p2)
-{
-       return !(p1 == p2);
-}
+} // namespace frontend
+} // namespace lyx