]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlCommand.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlCommand.C
index fbb13883252fd38d133b5da740b8544c6fa87053..7fbdf294be04dacd74532a5333fb2eb09d875b12 100644 (file)
@@ -1,60 +1,49 @@
-/* This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 2001 The LyX Team.
+/**
+ * \file ControlCommand.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ======================================================
+ * \author Angus Leeming
  *
- * \file ControlCommand.C
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * Full author contact details are available in file CREDITS
  */
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include <config.h>
 
 #include "ControlCommand.h"
-#include "buffer.h"
-#include "Dialogs.h"
-#include "lyxfunc.h"
-#include "LyXView.h"
-
-ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
-       : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
-         action_(ac)
+#include "Kernel.h"
+
+#include "funcrequest.h"
+#include "insets/insetcommand.h"
+
+
+ControlCommand::ControlCommand(Dialog & dialog, string const & lfun_name)
+       : Dialog::Controller(dialog),
+         lfun_name_(lfun_name)
 {}
 
 
-InsetCommandParams const ControlCommand::getParams(string const & arg)
+bool ControlCommand::initialiseParams(string const & data)
 {
-       InsetCommandParams params;
-       params.setFromString(arg);
-       return params;
+       InsetCommandMailer::string2params(data, params_);
+       return true;
 }
 
-InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
-{
-       return inset.params();
-}
 
-void ControlCommand::applyParamsToInset()
+void ControlCommand::clearParams()
 {
-       inset()->setParams(params());
-       lv_.view()->updateInset(inset(), true);
+       params_.setCmdName(string());
+       params_.setOptions(string());
+       params_.setContents(string());
 }
 
-void ControlCommand::applyParamsNoInset()
+
+void ControlCommand::dispatchParams()
 {
-       std::cerr << "1" << std::endl;
-       if (action_ == LFUN_NOACTION) return;
+       if (lfun_name_.empty())
+               return;
 
-       std::cerr << "2" << std::endl;
-       
-       lv_.getLyXFunc()->Dispatch(action_, params().getAsString());
-       std::cerr << "3" << std::endl;
+       string const lfun = InsetCommandMailer::params2string(lfun_name_,
+                                                             params_);
+       kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
-