]> 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 76c87ce454f519321778838f23d9bb7cf333ce26..a809f7795e40b506872d1b2961f83c88f16dd1e5 100644 (file)
@@ -1,67 +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 "ControlERT.h"
+#include "funcrequest.h"
 
-// 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)
+namespace lyx {
+namespace frontend {
+
+ControlERT::ControlERT(Dialog & parent)
+       : Dialog::Controller(parent), status_(InsetERT::Collapsed)
 {}
 
 
-void ControlERT::applyParamsToInset()
+bool ControlERT::initialiseParams(string const & data)
 {
-       inset()->status(lv_.view().get(), params().status);
+       InsetERTMailer::string2params(data, status_);
+       return true;
 }
 
 
-void ControlERT::applyParamsNoInset()
+void ControlERT::clearParams()
 {
+       status_ = InsetERT::Collapsed;
 }
 
 
-ERTParams const ControlERT::getParams(InsetERT const & inset)
+void ControlERT::dispatchParams()
 {
-       return ERTParams(inset);
+       string const lfun = InsetERTMailer::params2string(status_);
+       kernel().dispatch(FuncRequest(getLfun(), lfun));
 }
 
-
-ERTParams::ERTParams()
-       : status(InsetERT::Collapsed)
-{}
-
-
-ERTParams::ERTParams(InsetERT const & inset)
-       : status(inset.status())
-{}
-
-
-bool operator==(ERTParams const & p1, ERTParams const & p2)
-{
-       return (p1.status == p2.status);
-}
-
-
-bool operator!=(ERTParams const & p1, ERTParams const & p2)
-{
-       return !(p1 == p2);
-}
+} // namespace frontend
+} // namespace lyx