2001-03-15 13:37:04 +00:00
|
|
|
/* This file is part of
|
2002-03-21 21:21:28 +00:00
|
|
|
* ======================================================
|
2001-03-15 13:37:04 +00:00
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
*/
|
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
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"
|
2002-05-23 12:08:47 +00:00
|
|
|
#include "frontends/LyXView.h"
|
2001-04-24 17:33:01 +00:00
|
|
|
#include "lyxfunc.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "BufferView.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
#include "funcrequest.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
|
|
|
{
|
2002-08-07 08:11:41 +00:00
|
|
|
if (action_ == LFUN_NOACTION)
|
|
|
|
return;
|
|
|
|
lv_.getLyXFunc()->dispatch(FuncRequest(action_, params().getAsString()));
|
2001-03-15 13:37:04 +00:00
|
|
|
}
|