]> git.lyx.org Git - lyx.git/commitdiff
moving more stuff
authorAndré Pönitz <poenitz@gmx.net>
Wed, 28 Aug 2002 17:33:42 +0000 (17:33 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 28 Aug 2002 17:33:42 +0000 (17:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5142 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/factory.C
src/text3.C

index 696f9197c14093ed3baec1bc7fa8a8cd03040c0b..5b20865439a6eaa348142c15a0248a0407b5de01 100644 (file)
 #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;
index ac1368b63010f617c2b058786f91e3e5c4c7a707..4e536e64230c60cac3b4c649ba033b6c3a3fa738 100644 (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;
index 3f0d7eacacf132654250463949adccc39dc99d6d..bf3ea5f767a39af5985465277757457fc2c8735e 100644 (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;
        }