-/* 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 <leeming@lyx.org>
+ * Full author contact details are available in file CREDITS
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "ControlCommand.h"
+#include "Kernel.h"
-#include "BufferView.h"
#include "funcrequest.h"
-#include "lyxfunc.h"
+#include "insets/insetcommand.h"
-ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
- : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
- action_(ac)
+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)
+void ControlCommand::clearParams()
{
- return inset.params();
+ params_.setCmdName(string());
+ params_.setOptions(string());
+ params_.setContents(string());
}
-void ControlCommand::applyParamsToInset()
+void ControlCommand::dispatchParams()
{
- inset()->setParams(params());
- bufferview()->updateInset(inset(), true);
-}
-
-
-void ControlCommand::applyParamsNoInset()
-{
- if (action_ == LFUN_NOACTION)
+ if (lfun_name_.empty())
return;
- lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
+
+ string const lfun = InsetCommandMailer::params2string(lfun_name_,
+ params_);
+ kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
}