]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Natbib authoryear uses (Ref1; Ref2) by default.
[lyx.git] / src / BufferView.cpp
index 3aa201b5909ddc740a200969866c0964e47ae038..daa05a60d939b033bea992e36c88eabd920a3eb7 100644 (file)
@@ -876,7 +876,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool recenter)
 
        if (tm.contains(bot_pit)) {
                ParagraphMetrics const & pm = tm.parMetrics(bot_pit);
-               LASSERT(!pm.rows().empty(), /**/);
+               LBUFERR(!pm.rows().empty());
                // FIXME: smooth scrolling doesn't work in mathed.
                CursorSlice const & cs = dit.innerTextSlice();
                int offset = coordOffset(dit).y_;
@@ -1186,22 +1186,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                break;
        }
 
-       // FIXME We do not really want this here, but at present we need to
-       // handle their dispatch here, for reasons explained there, so we'll
-       // handle this here, too, for consistency.
-       case LFUN_BRANCH_ACTIVATE:
-       case LFUN_BRANCH_DEACTIVATE:
-       case LFUN_BRANCH_MASTER_ACTIVATE:
-       case LFUN_BRANCH_MASTER_DEACTIVATE: {
-               bool const master = (cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE
-                                   || cmd.action() == LFUN_BRANCH_MASTER_DEACTIVATE);
-               BranchList const & branchList = master ? buffer().masterBuffer()->params().branchlist()
-                                                      : buffer().params().branchlist();
-               docstring const branchName = cmd.argument();
-               flag.setEnabled(!branchName.empty() && branchList.find(branchName));
-               break;
-       }
-
        default:
                return false;
        }
@@ -1545,7 +1529,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                if (lyxfind(this, req))
                        dr.screenUpdate(Update::Force | Update::FitCursor);
                else
-                       message(_("String not found!"));
+                       message(_("String not found."));
                d->search_request_cache_ = req;
                break;
        }
@@ -1988,48 +1972,6 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                break;
        }
 
-       // FIXME We do not really want this here, but it has to be at present
-       // because we need a cursor for the recordUndoFullDocument call. What
-       // we would really like is a recordUndoBufferParams call that did not
-       // need a cursor, but we do not have that yet.
-       // So, if this does get fixed, this code can be moved back to Buffer.cpp,
-       // and the corresponding code in getStatus() should be moved back, too.
-       case LFUN_BRANCH_ACTIVATE:
-       case LFUN_BRANCH_DEACTIVATE:
-       case LFUN_BRANCH_MASTER_ACTIVATE:
-       case LFUN_BRANCH_MASTER_DEACTIVATE: {
-               bool const master = (cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE
-                                    || cmd.action() == LFUN_BRANCH_MASTER_DEACTIVATE);
-               Buffer * buf = master ? const_cast<Buffer *>(buffer().masterBuffer())
-                                     : &buffer();
-
-               docstring const branch_name = cmd.argument();
-               // the case without a branch name is handled elsewhere
-               if (branch_name.empty()) {
-                       dispatched = false;
-                       break;
-               }
-               Branch * branch = buf->params().branchlist().find(branch_name);
-               if (!branch) {
-                       LYXERR0("Branch " << branch_name << " does not exist.");
-                       dr.setError(true);
-                       docstring const msg =
-                               bformat(_("Branch \"%1$s\" does not exist."), branch_name);
-                       dr.setMessage(msg);
-                       break;
-               }
-               bool activate = (cmd.action() == LFUN_BRANCH_ACTIVATE
-                                || cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE);
-               if (branch->isSelected() != activate) {
-                       branch->setSelected(activate);
-                       cur.recordUndoFullDocument();
-                       dr.setError(false);
-                       dr.screenUpdate(Update::Force);
-                       dr.forceBufferUpdate();
-               }
-               break;
-       }
-
        default:
                // OK, so try the Buffer itself...
                buffer_.dispatch(cmd, dr);
@@ -2169,7 +2111,7 @@ void BufferView::clearLastInset(Inset * inset) const
 {
        if (d->last_inset_ != inset) {
                LYXERR0("Wrong last_inset!");
-               LASSERT(false, /**/);
+               LATTEST(false);
        }
        d->last_inset_ = 0;
 }
@@ -2401,7 +2343,7 @@ TextMetrics const & BufferView::textMetrics(Text const * t) const
 
 TextMetrics & BufferView::textMetrics(Text const * t)
 {
-       LASSERT(t, /**/);
+       LBUFERR(t);
        TextMetricsCache::iterator tmc_it  = d->text_metrics_.find(t);
        if (tmc_it == d->text_metrics_.end()) {
                tmc_it = d->text_metrics_.insert(
@@ -2467,7 +2409,7 @@ bool BufferView::checkDepm(Cursor & cur, Cursor & old)
 
 bool BufferView::mouseSetCursor(Cursor & cur, bool select)
 {
-       LASSERT(&cur.bv() == this, /**/);
+       LASSERT(&cur.bv() == this, return false);
 
        if (!select)
                // this event will clear selection so we save selection for
@@ -2708,7 +2650,7 @@ void BufferView::updateMetrics()
 
 void BufferView::insertLyXFile(FileName const & fname)
 {
-       LASSERT(d->cursor_.inTexted(), /**/);
+       LASSERT(d->cursor_.inTexted(), return);
 
        // Get absolute path of file and add ".lyx"
        // to the filename if necessary
@@ -2791,7 +2733,8 @@ Point BufferView::coordOffset(DocIterator const & dit) const
        CursorSlice const & sl = dit[0];
        TextMetrics const & tm = textMetrics(sl.text());
        ParagraphMetrics const & pm = tm.parMetrics(sl.pit());
-       LASSERT(!pm.rows().empty(), /**/);
+
+       LBUFERR(!pm.rows().empty());
        y -= pm.rows()[0].ascent();
 #if 1
        // FIXME: document this mess