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>
|
|
|
|
|
2001-04-26 18:40:38 +00:00
|
|
|
#include "ViewBase.h"
|
|
|
|
#include "ButtonControllerBase.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#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 "LyXView.h"
|
2001-04-24 17:33:01 +00:00
|
|
|
#include "lyxfunc.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "BufferView.h"
|
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());
|
|
|
|
lv_.view()->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
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|