-/* 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()
{
- if (action_ == LFUN_NOACTION) return;
+ if (lfun_name_.empty())
+ return;
- lv_.getLyXFunc()->Dispatch(action_, params().getAsString());
+ string const lfun = InsetCommandMailer::params2string(lfun_name_,
+ params_);
+ kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}
-