]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
* Painter.h:
[lyx.git] / src / BufferView.C
index 5b31f80b567bbca33edb3caaa838bf412b342ba2..93fe6d698b3c65428378254fc32130965c599c64 100644 (file)
@@ -123,7 +123,7 @@ T * getInsetByCode(LCursor & cur, InsetBase::Code code)
 
 
 BufferView::BufferView()
-       : buffer_(0), wh_(0),
+       : width_(0), height_(0), buffer_(0), wh_(0),
          cursor_(*this),
          multiparsel_cache_(false), anchor_ref_(0), offset_ref_(0),
          intl_(new Intl)
@@ -132,8 +132,8 @@ BufferView::BufferView()
 
        saved_positions.resize(saved_positions_num);
        // load saved bookmarks
-       Session::BookmarkList & bmList = LyX::ref().session().loadBookmarks();
-       for (Session::BookmarkList::iterator bm = bmList.begin();
+       BookmarksSection::BookmarkList & bmList = LyX::ref().session().bookmarks().load();
+       for (BookmarksSection::BookmarkList::iterator bm = bmList.begin();
                bm != bmList.end(); ++bm)
                if (bm->get<0>() < saved_positions_num)
                        saved_positions[bm->get<0>()] = Position( bm->get<1>(), bm->get<2>(), bm->get<3>() );
@@ -167,7 +167,7 @@ void BufferView::setBuffer(Buffer * b)
                buffer_->saveCursor(cursor_.selectionBegin(),
                                    cursor_.selectionEnd());
                // current buffer is going to be switched-off, save cursor pos
-               LyX::ref().session().saveFilePosition(buffer_->fileName(),
+               LyX::ref().session().lastFilePos().save(buffer_->fileName(),
                        boost::tie(cursor_.pit(), cursor_.pos()) );
        }
 
@@ -246,6 +246,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
                if (!theBufferList().close(theBufferList().getBuffer(s), false))
                        return false;
                // Fall through to new load. (Asger)
+               buffer_ = 0;
        }
 
        Buffer * b = 0;
@@ -279,7 +280,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
        if (lyxrc.use_lastfilepos) {
                pit_type pit;
                pos_type pos;
-               boost::tie(pit, pos) = LyX::ref().session().loadFilePosition(s);
+               boost::tie(pit, pos) = LyX::ref().session().lastFilePos().load(s);
                // I am not sure how to separate the following part to a function
                // so I will leave this to Lars.
                //
@@ -298,7 +299,7 @@ bool BufferView::loadLyXFile(string const & filename, bool tolastfiles)
        }
 
        if (tolastfiles)
-               LyX::ref().session().addLastFile(b->fileName());
+               LyX::ref().session().lastFiles().add(b->fileName());
 
        return true;
 }
@@ -431,11 +432,14 @@ void BufferView::updateScrollbar()
                sumh += h2;
                nh++;
        }
+
+       BOOST_ASSERT(nh);
        int const hav = sumh / nh;
        // More realistic average paragraph height
        if (hav > wh_)
                wh_ = hav;
 
+       BOOST_ASSERT(h);
        scrollbarParameters_.height = (parsize + 1) * wh_;
        scrollbarParameters_.position = anchor_ref_ * wh_ + int(offset_ref_ * wh_ / float(h));
        scrollbarParameters_.lineScrollHeight = int(wh_ * defaultRowHeight() / float(h));
@@ -570,7 +574,7 @@ void BufferView::saveSavedPositions()
        // par_id and pit.
        for (unsigned int i=1; i < saved_positions_num; ++i) {
                if ( isSavedPosition(i) )
-                       LyX::ref().session().saveBookmark( boost::tie(
+                       LyX::ref().session().bookmarks().save( boost::tie(
                                i,
                                saved_positions[i].filename,
                                saved_positions[i].par_id,