2002-09-05 14:10:50 +00:00
|
|
|
/**
|
|
|
|
* \file ControlCommand.C
|
|
|
|
* Read the file COPYING
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Angus Leeming
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
2001-03-15 13:37:04 +00:00
|
|
|
*/
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ControlCommand.h"
|
2002-08-14 19:19:47 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "BufferView.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
#include "funcrequest.h"
|
2002-08-14 19:19:47 +00:00
|
|
|
#include "lyxfunc.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
|
2001-03-23 17:09:34 +00:00
|
|
|
: ControlInset<InsetCommand, InsetCommandParams>(lv, d),
|
|
|
|
action_(ac)
|
2001-03-15 13:37:04 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2001-03-23 17:09:34 +00:00
|
|
|
InsetCommandParams const ControlCommand::getParams(string const & arg)
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
|
|
|
InsetCommandParams params;
|
|
|
|
params.setFromString(arg);
|
2001-03-23 17:09:34 +00:00
|
|
|
return params;
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
2001-04-24 17:33:01 +00:00
|
|
|
|
2001-03-23 17:09:34 +00:00
|
|
|
InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2001-03-23 17:09:34 +00:00
|
|
|
return inset.params();
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
2001-04-24 17:33:01 +00:00
|
|
|
|
2001-03-23 17:09:34 +00:00
|
|
|
void ControlCommand::applyParamsToInset()
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2001-03-23 17:09:34 +00:00
|
|
|
inset()->setParams(params());
|
2002-08-12 20:17:41 +00:00
|
|
|
bufferview()->updateInset(inset(), true);
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
2001-04-24 17:33:01 +00:00
|
|
|
|
2001-03-23 17:09:34 +00:00
|
|
|
void ControlCommand::applyParamsNoInset()
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2002-08-07 08:11:41 +00:00
|
|
|
if (action_ == LFUN_NOACTION)
|
|
|
|
return;
|
2002-08-12 20:17:41 +00:00
|
|
|
lyxfunc().dispatch(FuncRequest(action_, params().getAsString()));
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|