]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
* src/LyXRC.{cpp,h}:
[lyx.git] / src / BufferView.cpp
index 2b6820949c4ec46b6b44fc7e460fb1858ec11e3f..eee61d6b93631f6b6f9422b4d72575066e7c0b71 100644 (file)
@@ -131,7 +131,7 @@ bool findInset(DocIterator & dit, vector<InsetCode> const & codes,
        bool same_content);
 
 bool findNextInset(DocIterator & dit, vector<InsetCode> const & codes,
-       string const & contents)
+       docstring const & contents)
 {
        DocIterator tmpdit = dit;
 
@@ -140,7 +140,7 @@ bool findNextInset(DocIterator & dit, vector<InsetCode> const & codes,
                if (inset
                    && find(codes.begin(), codes.end(), inset->lyxCode()) != codes.end()
                    && (contents.empty() ||
-                   static_cast<InsetCommand const *>(inset)->getContents() == contents)) {
+                   static_cast<InsetCommand const *>(inset)->getFirstNonOptParam() == contents)) {
                        dit = tmpdit;
                        return true;
                }
@@ -151,11 +151,11 @@ bool findNextInset(DocIterator & dit, vector<InsetCode> const & codes,
 }
 
 
-/// Looks for next inset with one of the the given code
+/// Looks for next inset with one of the given codes.
 bool findInset(DocIterator & dit, vector<InsetCode> const & codes,
        bool same_content)
 {
-       string contents;
+       docstring contents;
        DocIterator tmpdit = dit;
        tmpdit.forwardInset();
        if (!tmpdit)
@@ -165,7 +165,7 @@ bool findInset(DocIterator & dit, vector<InsetCode> const & codes,
                Inset const * inset = tmpdit.nextInset();
                if (inset
                    && find(codes.begin(), codes.end(), inset->lyxCode()) != codes.end()) {
-                       contents = static_cast<InsetCommand const *>(inset)->getContents();
+                       contents = static_cast<InsetCommand const *>(inset)->getFirstNonOptParam();
                }
        }
 
@@ -468,7 +468,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 +507,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 +1757,7 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select)
                d->cursor_.clearSelection();
 
        d->cursor_.finishUndo();
+       d->cursor_.setCurrentFont();
        return update;
 }
 
@@ -1941,15 +1942,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());
 
@@ -2128,14 +2128,14 @@ void BufferView::draw(frontend::Painter & pain)
 //     lyxerr << "par ascent: " << text.getPar(d->metrics_info_.p1).ascent() << endl;
        if (d->metrics_info_.y1 > 0
                && d->metrics_info_.update_strategy == FullScreenUpdate)
-               pain.fillRectangle(0, 0, width_, d->metrics_info_.y1, Color::bottomarea);
+               pain.fillRectangle(0, 0, width_, d->metrics_info_.y1, Color_bottomarea);
 
        // and possibly grey out below
 //     lyxerr << "par descent: " << text.getPar(d->metrics_info_.p1).ascent() << endl;
        if (d->metrics_info_.y2 < height_
                && d->metrics_info_.update_strategy == FullScreenUpdate)
                pain.fillRectangle(0, d->metrics_info_.y2, width_,
-                       height_ - d->metrics_info_.y2, Color::bottomarea);
+                       height_ - d->metrics_info_.y2, Color_bottomarea);
 }
 
 
@@ -2189,13 +2189,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)