]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Further cleanup of InsetFlex, InsetCollapsable and InsetLayout:
[lyx.git] / src / BufferView.cpp
index 066789a69b62afb270834d45385c2af0d778b3f7..388b0c60a91bb228a22503ec82e0c6812f2cc2a1 100644 (file)
@@ -420,9 +420,11 @@ BufferView::~BufferView()
        // currently can only handle bottom (whole document) level pit and pos.
        // That is to say, if a cursor is in a nested inset, it will be
        // restore to the left of the top level inset.
+       LastFilePosSection::FilePos fp;
+       fp.pit = d->cursor_.bottom().pit();
+       fp.pos = d->cursor_.bottom().pos();
        LyX::ref().session().lastFilePos().save(
-               support::FileName(buffer_.absFileName()),
-               boost::tie(d->cursor_.bottom().pit(), d->cursor_.bottom().pos()) );
+               support::FileName(buffer_.absFileName()), fp);
 
        delete d;
 }
@@ -468,7 +470,7 @@ bool BufferView::fitCursor()
 {
        if (cursorStatus(d->cursor_) == CUR_INSIDE) {
                frontend::FontMetrics const & fm =
-                       theFontMetrics(d->cursor_.getFont());
+                       theFontMetrics(d->cursor_.getFont().fontInfo());
                int const asc = fm.maxAscent();
                int const des = fm.maxDescent();
                Point const p = getPos(d->cursor_, d->cursor_.boundary());
@@ -507,7 +509,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
 
        // Update macro store
        if (!(cursor().inMathed() && cursor().inMacroMode()))
-               buffer_.buildMacros();
+               buffer_.updateMacros();
 
        // Now do the first drawing step if needed. This consists on updating
        // the CoordCache in updateMetrics().
@@ -1757,6 +1759,7 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select)
                d->cursor_.clearSelection();
 
        d->cursor_.finishUndo();
+       d->cursor_.setCurrentFont();
        return update;
 }
 
@@ -1941,15 +1944,14 @@ void BufferView::menuInsertLyXFile(string const & filenm)
                        initpath = trypath;
 
                // FIXME UNICODE
-               FileDialog fileDlg(_("Select LyX document to insert"),
-                       LFUN_FILE_INSERT,
-                       make_pair(_("Documents|#o#O"), from_utf8(lyxrc.document_path)),
-                       make_pair(_("Examples|#E#e"),
-                                   from_utf8(addPath(package().system_support().absFilename(),
-                                   "examples"))));
+               FileDialog dlg(_("Select LyX document to insert"), LFUN_FILE_INSERT);
+               dlg.setButton1(_("Documents|#o#O"), from_utf8(lyxrc.document_path));
+               dlg.setButton2(_("Examples|#E#e"),
+                       from_utf8(addPath(package().system_support().absFilename(),
+                       "examples")));
 
                FileDialog::Result result =
-                       fileDlg.open(from_utf8(initpath),
+                       dlg.open(from_utf8(initpath),
                                     FileFilterList(_("LyX Documents (*.lyx)")),
                                     docstring());
 
@@ -2189,13 +2191,13 @@ docstring BufferView::contentsOfPlaintextFile(string const & f,
        FileName fname(f);
 
        if (fname.empty()) {
-               FileDialog fileDlg(_("Select file to insert"),
+               FileDialog dlg(_("Select file to insert"),
                                   ( asParagraph
                                     ? LFUN_FILE_INSERT_PLAINTEXT_PARA 
                                     : LFUN_FILE_INSERT_PLAINTEXT) );
 
                FileDialog::Result result =
-                       fileDlg.open(from_utf8(buffer().filePath()),
+                       dlg.open(from_utf8(buffer().filePath()),
                                     FileFilterList(), docstring());
 
                if (result.first == FileDialog::Later)