]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/LyXView.C
Rename .C => .cpp for files in src/frontends/controllers, step 1
[lyx.git] / src / frontends / LyXView.C
index 8c6059bf75b9419b0055af0382edd4d3247ec4a4..1ae358e20e6d686c6bdafa238dbb2c818d534be1 100644 (file)
@@ -133,6 +133,8 @@ void LyXView::setBuffer(Buffer * b)
                getDialogs().hideBufferDependent();
 
        work_area_->bufferView().setBuffer(b);
+       // Make sure the TOC is updated before anything else.
+       updateToc();
 
        if (work_area_->bufferView().buffer()) {
                // Buffer-dependent dialogs should be updated or
@@ -166,6 +168,7 @@ bool LyXView::loadLyXFile(FileName const & filename, bool tolastfiles)
 
        bool loaded = work_area_->bufferView().loadLyXFile(filename, tolastfiles);
 
+       updateToc();
        updateMenubar();
        updateToolbars();
        updateLayoutChoice();
@@ -192,6 +195,10 @@ void LyXView::connectBuffer(Buffer & buf)
                buf.changed.connect(
                        boost::bind(&WorkArea::redraw, work_area_));
 
+       bufferStructureChangedConnection_ =
+               buf.structureChanged.connect(
+                       boost::bind(&LyXView::updateToc, this));
+
        errorsConnection_ =
                buf.errors.connect(
                        boost::bind(&LyXView::showErrorList, this, _1));
@@ -226,6 +233,7 @@ void LyXView::disconnectBuffer()
 {
        errorsConnection_.disconnect();
        bufferChangedConnection_.disconnect();
+       bufferStructureChangedConnection_.disconnect();
        messageConnection_.disconnect();
        busyConnection_.disconnect();
        titleConnection_.disconnect();
@@ -309,6 +317,12 @@ BufferView * LyXView::view() const
 }
 
 
+void LyXView::updateToc()
+{
+       updateDialog("toc", "");
+}
+
+
 void LyXView::updateToolbars()
 {
        BOOST_ASSERT(work_area_);
@@ -328,7 +342,7 @@ void LyXView::updateToolbars()
 }
 
 
-ToolbarBackend::Flags LyXView::getToolbarState(string const & name)
+ToolbarInfo::Flags LyXView::getToolbarState(string const & name)
 {
        return toolbars_->getToolbarState(name);
 }
@@ -356,7 +370,7 @@ void LyXView::updateMenubar()
 
 void LyXView::autoSave()
 {
-       lyxerr[Debug::INFO] << "Running autoSave()" << endl;
+       LYXERR(Debug::INFO) << "Running autoSave()" << endl;
 
        if (view()->buffer())
                lyx::autoSave(view());
@@ -417,6 +431,7 @@ void LyXView::updateWindowTitle()
        }
 
        setWindowTitle(maximize_title, minimize_title);
+       updateTab();
 }