#include "kbmap.h"
#include "lyxfunc.h"
#include "bufferlist.h"
+#include "ColorHandler.h"
#include "lyxserver.h"
#include "lyx.h"
#include "intl.h"
#include "insets/insetexternal.h"
#include "insets/insetgraphics.h"
#include "insets/insetfoot.h"
+#include "insets/insetmarginal.h"
+#include "insets/insetminipage.h"
+#include "insets/insetfloat.h"
+#include "insets/insetlist.h"
#include "insets/insettabular.h"
+#include "insets/insettheorem.h"
#include "mathed/formulamacro.h"
#include "toolbar.h"
#include "spellchecker.h" // RVDK_PATCH_5
#include "menus.h"
#include "bufferview_funcs.h"
#include "frontends/Dialogs.h"
+#include "FloatList.h"
using std::pair;
using std::endl;
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
} else {
tli->UnlockInsetInInset(owner->view(),
- tli->GetLockingInset());
+ tli->GetLockingInset(),true);
}
return 0;
}
}
case LFUN_TABLE:
+#ifndef NEW_TABULAR
Table();
+#else
+ owner->getDialogs()->showTabularCreate();
+#endif
break;
case LFUN_FIGURE:
txt->cursor.par(),
txt->cursor.pos());
tmpinset->Edit(owner->view(),
- tmpinset->x() + tmpinset->width(owner->view()->painter(),font),
- tmpinset->descent(owner->view()->painter(),font),
+ tmpinset->x() +
+ tmpinset->width(owner->view(),font),
+ tmpinset->descent(owner->view(),font),
0);
break;
}
case LFUN_INSET_TEXT:
{
- InsetText * new_inset = new InsetText();
+ InsetText * new_inset = new InsetText;
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
delete new_inset;
}
break;
+
case LFUN_INSET_ERT:
{
- InsetERT * new_inset = new InsetERT();
+ InsetERT * new_inset = new InsetERT;
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
case LFUN_INSET_EXTERNAL:
{
- InsetExternal * new_inset = new InsetExternal();
+ InsetExternal * new_inset = new InsetExternal;
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
case LFUN_INSET_FOOTNOTE:
{
- InsetFoot * new_inset = new InsetFoot();
+ InsetFoot * new_inset = new InsetFoot;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_MARGINAL:
+ {
+ InsetMarginal * new_inset = new InsetMarginal;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_MINIPAGE:
+ {
+ InsetMinipage * new_inset = new InsetMinipage;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_FLOAT:
+ {
+ // check if the float type exist
+ if (floatList.typeExist(argument)) {
+ InsetFloat * new_inset = new InsetFloat(argument);
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ } else {
+ lyxerr << "Non-existant float type: "
+ << argument << endl;
+ }
+
+ }
+ break;
+
+ case LFUN_INSET_LIST:
+ {
+ InsetList * new_inset = new InsetList;
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_THEOREM:
+ {
+ InsetTheorem * new_inset = new InsetTheorem;
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
}
break;
+ case LFUN_CREATE_CITATION:
+ {
+ owner->getDialogs()->createCitation( argument );
+ }
+ break;
+
case LFUN_INSERT_CITATION:
- {
- InsetCitation * new_inset = new InsetCitation();
- // ale970405
- // The note, if any, must be after the key, delimited
- // by a | so both key and remark can have spaces.
- if (!argument.empty()) {
- string lsarg(argument);
- if (contains(lsarg, "|")) {
- new_inset->setContents(token(lsarg, '|', 0));
- new_inset->setOptions(token(lsarg, '|', 1));
- } else
- new_inset->setContents(lsarg);
- if (!owner->view()->insertInset(new_inset))
- delete new_inset;
- } else {
- if (owner->view()->insertInset(new_inset))
- new_inset->Edit(owner->view(), 0, 0, 0);
- else
- delete new_inset;
- }
+ {
+ string keys = token(argument, '|', 0);
+ string text = token(argument, '|', 1);
+
+ InsetCitation * inset = new InsetCitation( keys, text );
+ if (!owner->view()->insertInset(inset))
+ delete inset;
+ else
+ owner->view()->updateInset( inset, true );
}
break;
}
break;
+ case LFUN_SET_COLOR:
+ {
+ string lyx_name, x11_name;
+ x11_name = split(argument, lyx_name, ' ');
+ if (lyx_name.empty() || x11_name.empty()) {
+ LyXBell();
+ setErrorMessage(N_("Syntax: set-color <lyx_name>"
+ " <x11_name>"));
+ break;
+ }
+
+ if (!lcolor.setColor(lyx_name, x11_name)) {
+ static string err1 (N_("Set-color \""));
+ static string err2 (N_("\" failed - color is undefined "
+ "or may not be redefined"));
+ LyXBell();
+ setErrorMessage(err1 + lyx_name + err2);
+ break;
+ }
+ lyxColorHandler->updateColor(lcolor.getFromLyXName(lyx_name));
+ owner->view()->redraw();
+ break;
+ }
+
case LFUN_UNKNOWN_ACTION:
{
if(!owner->buffer()) {