lyx_mirror/src/frontends/controllers/ControlCommand.C
Angus Leeming 9705be9f1b Implemented controller-view split for FormError and FormInclude.
Cleaned up code in controllers in the process; I think that the interface
is stabilising now.
Cleaned up code in InsetInclude a little.

Mental note (to me?!): the Bibitem, Bibtex and Include insets create an
inset when the appropriate menu item is selected. This is incorrect;
the inset should only be created when "Ok" is pressed, as with the
majority of insets. CREATE_XXX flags and associated code are needed.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1817 a592a061-630c-0410-9148-cb99ea01b6c8
2001-03-23 17:09:34 +00:00

57 lines
1.1 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>
*/
#ifdef __GNUG__
#pragma implementation
#endif
#include <config.h>
#include "ControlCommand.h"
#include "buffer.h"
#include "Dialogs.h"
#include "lyxfunc.h"
#include "LyXView.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(action_, params().getAsString());
}