moving more stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5142 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-08-28 17:33:42 +00:00
parent c3427999a2
commit cd4d035577
3 changed files with 80 additions and 111 deletions

View File

@ -47,14 +47,12 @@
#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"
@ -909,16 +907,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
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)
@ -1101,26 +1089,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
}
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 ---------------------------
@ -1215,9 +1183,8 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
{
InsetBibtex * inset =
static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
if (inset) {
if (inset)
inset->delDatabase(ev.argument);
}
}
break;
@ -1225,52 +1192,11 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
{
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;

View File

@ -5,10 +5,14 @@
#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"
@ -17,6 +21,7 @@
#include "insets/insetref.h"
#include "insets/insettabular.h"
#include "insets/insettext.h"
#include "insets/insettoc.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
@ -67,6 +72,16 @@ Inset * createInset(FuncRequest const & cmd)
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;
@ -77,6 +92,29 @@ Inset * createInset(FuncRequest const & cmd)
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;

View File

@ -1140,40 +1140,6 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
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();
@ -1581,6 +1547,45 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
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;
}