lyx_mirror/src/frontends/controllers/ControlCommand.C
André Pönitz b8198905dc the FuncRequest changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4887 a592a061-630c-0410-9148-cb99ea01b6c8
2002-08-07 08:11:41 +00:00

64 lines
1.3 KiB
C

/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
*
* ======================================================
*
* \file ControlCommand.C
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlCommand.h"
#include "buffer.h"
#include "Dialogs.h"
#include "frontends/LyXView.h"
#include "lyxfunc.h"
#include "BufferView.h"
#include "funcrequest.h"
ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
: ControlInset<InsetCommand, InsetCommandParams>(lv, d),
action_(ac)
{}
InsetCommandParams const ControlCommand::getParams(string const & arg)
{
InsetCommandParams params;
params.setFromString(arg);
return params;
}
InsetCommandParams const ControlCommand::getParams(InsetCommand const & inset)
{
return inset.params();
}
void ControlCommand::applyParamsToInset()
{
inset()->setParams(params());
lv_.view()->updateInset(inset(), true);
}
void ControlCommand::applyParamsNoInset()
{
if (action_ == LFUN_NOACTION)
return;
lv_.getLyXFunc()->dispatch(FuncRequest(action_, params().getAsString()));
}