2001-03-15 13:37:04 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-03-20 10:14:03 +00:00
|
|
|
* Copyright 2001 The LyX Team.
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* \file ControlCommand.C
|
|
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "ControlCommand.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "buffer.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "Dialogs.h"
|
|
|
|
#include "lyxfunc.h"
|
|
|
|
#include "LyXView.h"
|
|
|
|
|
|
|
|
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-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-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());
|
|
|
|
lv_.view()->updateInset(inset(), true);
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|
2001-03-23 17:09:34 +00:00
|
|
|
void ControlCommand::applyParamsNoInset()
|
2001-03-15 13:37:04 +00:00
|
|
|
{
|
2001-03-23 17:09:34 +00:00
|
|
|
if (action_ == LFUN_NOACTION) return;
|
|
|
|
lv_.getLyXFunc()->Dispatch(action_, params().getAsString());
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|
|
|
|
|