]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/TocWidget.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / TocWidget.cpp
index e6b85327778ee02c06c40a47ed88f488d8d53a8f..538c04c177cb894dd2f4045301e7db29fb640087 100644 (file)
@@ -19,6 +19,7 @@
 #include "TocModel.h"
 
 #include "Buffer.h"
+#include "BufferView.h"
 #include "CutAndPaste.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
@@ -173,6 +174,9 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
        TocItem const & item =
                gui_view_.tocModels().currentItem(current_type_, index);
 
+       // Start an undo group.
+       cur.beginUndoGroup();
+
        switch (cmd.action)
        {
        case LFUN_CHANGE_ACCEPT:
@@ -201,6 +205,7 @@ void TocWidget::doDispatch(Cursor & cur, FuncRequest const & cmd)
                if (inset)
                        inset->dispatch(cur, tmpcmd);
        }
+       cur.endUndoGroup();
 }
 
 
@@ -404,7 +409,7 @@ static bool isSortable(QString const & type)
 
 void TocWidget::updateView()
 {
-       if (!gui_view_.currentBufferView()) {
+       if (!gui_view_.documentBufferView()) {
                enableControls(false);
                typeCO->setEnabled(false);
                tocTV->setModel(0);
@@ -440,7 +445,7 @@ void TocWidget::updateView()
        persistentCB->setEnabled(can_navigate_);
 
        bool controls_enabled = toc_model && toc_model->rowCount() > 0
-               && !gui_view_.buffer()->isReadonly();
+               && !gui_view_.documentBufferView()->buffer().isReadonly();
        enableControls(controls_enabled);
 
        depthSL->setMaximum(gui_view_.tocModels().depth(current_type_));