#include "insets/inseturl.h"
#include "insets/insetlatexaccent.h"
#include "insets/insettoc.h"
-#include "insets/insetref.h"
-#include "insets/insetparent.h"
#include "insets/insetindex.h"
+#include "insets/insetref.h"
#include "insets/insetinclude.h"
#include "insets/insetcite.h"
#include "insets/insetgraphics.h"
#include "insets/insetmarginal.h"
-#include "insets/insetcaption.h"
#include "insets/insetfloatlist.h"
#include "mathed/formulabase.h"
switch (ev.action) {
- case LFUN_TOC_INSERT:
- {
- InsetCommandParams p;
- p.setCmdName("tableofcontents");
- Inset * inset = new InsetTOC(p);
- if (!insertInset(inset, tclass.defaultLayoutName()))
- delete inset;
- break;
- }
-
case LFUN_SCROLL_INSET:
// this is not handled here as this function is only active
// if we have a locking_inset and that one is (or contains)
}
break;
- case LFUN_INSET_CAPTION:
- {
- // Do we have a locking inset...
- if (bv_->theLockingInset()) {
- lyxerr << "Locking inset code: "
- << static_cast<int>(bv_->theLockingInset()->lyxCode());
- InsetCaption * new_inset =
- new InsetCaption(buffer_->params);
- new_inset->setOwner(bv_->theLockingInset());
- new_inset->setAutoBreakRows(true);
- new_inset->setDrawFrame(0, InsetText::LOCKED);
- new_inset->setFrameColor(0, LColor::captionframe);
- if (insertInset(new_inset))
- new_inset->edit(bv_);
- else
- delete new_inset;
- }
- }
- break;
-
// --- accented characters ---------------------------
{
InsetBibtex * inset =
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
- if (inset) {
+ if (inset)
inset->delDatabase(ev.argument);
- }
}
break;
{
InsetBibtex * inset =
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
- if (inset) {
+ if (inset)
inset->setOptions(ev.argument);
- }
}
break;
- case LFUN_INDEX_INSERT:
- {
- string entry = ev.argument;
- if (entry.empty())
- entry = bv_->getLyXText()->getStringToIndex(bv_);
-
- if (entry.empty()) {
- owner_->getDialogs().createIndex();
- break;
- }
-
- InsetIndex * inset = new InsetIndex(InsetCommandParams("index", entry));
-
- if (!insertInset(inset)) {
- delete inset;
- } else {
- updateInset(inset, true);
- }
- }
- break;
-
- case LFUN_INDEX_PRINT:
- {
- InsetCommandParams p("printindex");
- Inset * inset = new InsetPrintIndex(p);
- if (!insertInset(inset, tclass.defaultLayoutName()))
- delete inset;
- }
- break;
-
- case LFUN_PARENTINSERT:
- {
- InsetCommandParams p("lyxparent", ev.argument);
- Inset * inset = new InsetParent(p, *buffer_);
- if (!insertInset(inset, tclass.defaultLayoutName()))
- delete inset;
- }
-
- break;
-
case LFUN_CHILD_INSERT:
{
InsetInclude::Params p;
#include "FloatList.h"
#include "debug.h"
#include "BufferView.h"
+#include "lyxtext.h"
+
+#include "insets/insetcaption.h"
#include "insets/insetert.h"
#include "insets/insetexternal.h"
#include "insets/insetfloat.h"
#include "insets/insetfoot.h"
+#include "insets/insetindex.h"
#include "insets/insetmarginal.h"
#include "insets/insetminipage.h"
#include "insets/insetnote.h"
#include "insets/insetref.h"
#include "insets/insettabular.h"
#include "insets/insettext.h"
+#include "insets/insettoc.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
lyxerr << "Non-existent float type: " << cmd.argument << endl;
return 0;
+ case LFUN_INDEX_INSERT: {
+ string entry = cmd.argument;
+ if (entry.empty())
+ entry = bv->getLyXText()->getStringToIndex(bv);
+ if (!entry.empty())
+ return new InsetIndex(InsetCommandParams("index", entry));
+ bv->owner()->getDialogs().createIndex();
+ return 0;
+ }
+
case LFUN_TABULAR_INSERT:
if (!cmd.argument.empty()) {
int r = 2;
bv->owner()->getDialogs().showTabularCreate();
return 0;
+ case LFUN_INSET_CAPTION:
+ if (bv->theLockingInset()) {
+ lyxerr << "Locking inset code: "
+ << static_cast<int>(bv->theLockingInset()->lyxCode());
+ InsetCaption * inset = new InsetCaption(params);
+ inset->setOwner(bv->theLockingInset());
+ inset->setAutoBreakRows(true);
+ inset->setDrawFrame(0, InsetText::LOCKED);
+ inset->setFrameColor(0, LColor::captionframe);
+ return inset;
+ }
+ return 0;
+
+ case LFUN_INDEX_PRINT:
+ return new InsetPrintIndex(InsetCommandParams("printindex"));
+
+ case LFUN_TOC_INSERT:
+ return new InsetTOC(InsetCommandParams("tableofcontents"));
+
+ case LFUN_PARENTINSERT:
+ return new InsetParent(
+ InsetCommandParams("lyxparent", cmd.argument), *bv->buffer());
+
#if 0
case LFUN_INSET_LIST:
return new InsetList;
break;
}
-#if 0
- case LFUN_INSET_LIST:
- case LFUN_INSET_THEOREM:
-#endif
- case LFUN_INSERT_NOTE:
- case LFUN_INSET_ERT:
- case LFUN_INSET_EXTERNAL:
- case LFUN_INSET_FLOAT:
- case LFUN_INSET_FOOTNOTE:
- case LFUN_INSET_MARGINAL:
- case LFUN_INSET_MINIPAGE:
- case LFUN_INSET_OPTARG:
- case LFUN_INSET_WIDE_FLOAT:
- case LFUN_TABULAR_INSERT:
- {
- Inset * inset = createInset(cmd);
- if (inset) {
- bool gotsel = false;
- if (selection.set()) {
- cutSelection(bv, true, false);
- gotsel = true;
- }
- if (bv->insertInset(inset)) {
- inset->edit(bv);
- if (gotsel)
- bv->owner()->dispatch(FuncRequest(LFUN_PASTESELECTION));
- }
- else
- delete inset;
- }
- break;
- }
-
-
case LFUN_QUOTE: {
Paragraph const * par = cursor.par();
lyx::pos_type pos = cursor.pos();
break;
}
+#if 0
+ case LFUN_INSET_LIST:
+ case LFUN_INSET_THEOREM:
+#endif
+ case LFUN_INSERT_NOTE:
+ case LFUN_INSET_CAPTION:
+ case LFUN_INSET_ERT:
+ case LFUN_INSET_EXTERNAL:
+ case LFUN_INSET_FLOAT:
+ case LFUN_INSET_FOOTNOTE:
+ case LFUN_INSET_MARGINAL:
+ case LFUN_INSET_MINIPAGE:
+ case LFUN_INSET_OPTARG:
+ case LFUN_INSET_WIDE_FLOAT:
+ case LFUN_TABULAR_INSERT:
+ case LFUN_INDEX_INSERT:
+ case LFUN_INDEX_PRINT:
+ case LFUN_PARENTINSERT:
+ case LFUN_TOC_INSERT:
+ {
+ Inset * inset = createInset(cmd);
+ if (inset) {
+ bool gotsel = false;
+ if (selection.set()) {
+ cutSelection(bv, true, false);
+ gotsel = true;
+ }
+ if (bv->insertInset(inset)) {
+ inset->edit(bv);
+ if (gotsel)
+ bv->owner()->dispatch(FuncRequest(LFUN_PASTESELECTION));
+ }
+ else
+ delete inset;
+ }
+ break;
+ }
+
+
default:
return Inset::UNDISPATCHED;
}