]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Update it.po
[lyx.git] / src / BufferView.cpp
index 695f95baf385c341fd9e4fc274e8893f29df39d7..84194605a59200d3a6f816f22aa40e02d73e6720 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);
-               LBUFERR(!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;
        }
@@ -1529,8 +1513,14 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                docstring const data =
                        find2string(searched_string, true, false, fw);
                bool found = lyxfind(this, FuncRequest(LFUN_WORD_FIND, data));
-               if (found)
+               if (found) {
                        dr.screenUpdate(Update::Force | Update::FitCursor);
+                       cur.dispatched();
+                       dispatched = true;
+               } else {
+                       cur.undispatched();
+                       dispatched = false;
+               }
                break;
        }
 
@@ -1542,10 +1532,14 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, "findreplace"));
                        break;
                }
-               if (lyxfind(this, req))
+               if (lyxfind(this, req)) {
                        dr.screenUpdate(Update::Force | Update::FitCursor);
-               else
-                       message(_("String not found."));
+                       cur.dispatched();
+                       dispatched = true;
+               } else {
+                       cur.undispatched();
+                       dispatched = false;
+               }
                d->search_request_cache_ = req;
                break;
        }
@@ -1567,6 +1561,11 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                if (lyxreplace(this, cmd, has_deleted)) {
                        dr.forceBufferUpdate();
                        dr.screenUpdate(Update::Force | Update::FitCursor);
+                       cur.dispatched();
+                       dispatched = true;
+               } else {
+                       cur.undispatched();
+                       dispatched = false;
                }
                break;
        }
@@ -1988,48 +1987,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);
@@ -2401,7 +2358,7 @@ TextMetrics const & BufferView::textMetrics(Text const * t) const
 
 TextMetrics & BufferView::textMetrics(Text const * t)
 {
-       LBUFERR(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(
@@ -2458,9 +2415,12 @@ bool BufferView::checkDepm(Cursor & cur, Cursor & old)
                return false;
 
        d->cursor_ = cur;
+       
+       // we would rather not do this here, but it needs to be done before 
+       // the changed() signal is sent.
+       buffer_.updateBuffer();
 
-       cur.forceBufferUpdate();
-       cur.screenUpdateFlags(Update::Force);
+       buffer_.changed(true);
        return true;
 }
 
@@ -2792,7 +2752,7 @@ Point BufferView::coordOffset(DocIterator const & dit) const
        TextMetrics const & tm = textMetrics(sl.text());
        ParagraphMetrics const & pm = tm.parMetrics(sl.pit());
 
-       LBUFERR(!pm.rows().empty(), _(""));
+       LBUFERR(!pm.rows().empty());
        y -= pm.rows()[0].ascent();
 #if 1
        // FIXME: document this mess