From bbc332f2342d82999fe425a404c28ba7f0a6ed13 Mon Sep 17 00:00:00 2001 From: Michael Schmitt Date: Thu, 1 Feb 2007 20:48:43 +0000 Subject: [PATCH] * frontends/qt4/QChanges.C: * frontends/controllers/ControlChanges.C: * frontends/controllers/ControlChanges.h: fix merge-changes dialog; remove old cruft; strip interface down to what is really needed git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17019 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ControlChanges.C | 44 ++++++---------------- src/frontends/controllers/ControlChanges.h | 16 ++++---- src/frontends/qt4/QChanges.C | 17 ++++----- 3 files changed, 26 insertions(+), 51 deletions(-) diff --git a/src/frontends/controllers/ControlChanges.C b/src/frontends/controllers/ControlChanges.C index e9d266145c..4a1e574581 100644 --- a/src/frontends/controllers/ControlChanges.C +++ b/src/frontends/controllers/ControlChanges.C @@ -4,6 +4,7 @@ * Licence details can be found in the file COPYING. * * \author John Levon + * \author Michael Gerz * * Full author contact details are available in file CREDITS. */ @@ -20,14 +21,8 @@ #include "funcrequest.h" #include "lyxfind.h" -// FIXME: those two headers are needed because of the -// WorkArea::redraw() call below. -#include "frontends/LyXView.h" -#include "frontends/WorkArea.h" - #include "support/lyxtime.h" -using std::string; namespace lyx { @@ -39,29 +34,16 @@ ControlChanges::ControlChanges(Dialog & parent) {} -bool ControlChanges::find() +void ControlChanges::next() { - // FIXME: it would be better to use an LFUN. - if (!findNextChange(kernel().bufferview())) - return false; - - kernel().bufferview()->update(); - kernel().lyxview().currentWorkArea()->redraw(); - return true; -} - - -bool ControlChanges::changed() -{ - Change c(kernel().bufferview()->getCurrentChange()); - return c.type != Change::UNCHANGED; + kernel().dispatch(FuncRequest(LFUN_CHANGE_NEXT)); } docstring const ControlChanges::getChangeDate() { - Change c(kernel().bufferview()->getCurrentChange()); - if (c.type == Change::UNCHANGED || !c.changetime) + Change const & c = kernel().bufferview()->getCurrentChange(); + if (c.type == Change::UNCHANGED) return docstring(); // FIXME UNICODE @@ -71,35 +53,33 @@ docstring const ControlChanges::getChangeDate() docstring const ControlChanges::getChangeAuthor() { - Change c(kernel().bufferview()->getCurrentChange()); + Change const & c = kernel().bufferview()->getCurrentChange(); if (c.type == Change::UNCHANGED) return docstring(); - Author const & a(kernel().buffer().params().authors().get(c.author)); + Author const & a = kernel().buffer().params().authors().get(c.author); docstring author(a.name()); if (!a.email().empty()) { - author += " ("; - author += a.email(); - author += ")"; + author += " (" + a.email() + ")"; } return author; } -bool ControlChanges::accept() +void ControlChanges::accept() { kernel().dispatch(FuncRequest(LFUN_CHANGE_ACCEPT)); - return find(); + next(); } -bool ControlChanges::reject() +void ControlChanges::reject() { kernel().dispatch(FuncRequest(LFUN_CHANGE_REJECT)); - return find(); + next(); } diff --git a/src/frontends/controllers/ControlChanges.h b/src/frontends/controllers/ControlChanges.h index 25b1b57ade..7168cc655f 100644 --- a/src/frontends/controllers/ControlChanges.h +++ b/src/frontends/controllers/ControlChanges.h @@ -5,6 +5,7 @@ * Licence details can be found in the file COPYING. * * \author John Levon + * \author Michael Gerz * * Full author contact details are available in file CREDITS. */ @@ -37,11 +38,8 @@ public: /// always true since dispatchParams() is empty virtual bool canApply() const { return true; } - /// find the next merge chunk and highlight it - bool find(); - - /// Are there changes to be merged at current location? - bool changed(); + /// find the next change and highlight it + void next(); /// return date of change lyx::docstring const getChangeDate(); @@ -49,11 +47,11 @@ public: /// return author of change lyx::docstring const getChangeAuthor(); - /// accept the current merge - bool accept(); + /// accept the current change + void accept(); - /// reject the current merge - bool reject(); + /// reject the current change + void reject(); }; } // namespace frontend diff --git a/src/frontends/qt4/QChanges.C b/src/frontends/qt4/QChanges.C index 71504f55ba..4891a77c96 100644 --- a/src/frontends/qt4/QChanges.C +++ b/src/frontends/qt4/QChanges.C @@ -4,6 +4,7 @@ * Licence details can be found in the file COPYING. * * \author John Levon + * \author Michael Gerz * * Full author contact details are available in file CREDITS. */ @@ -24,8 +25,6 @@ using lyx::support::bformat; -using std::string; - namespace lyx { namespace frontend { @@ -50,14 +49,6 @@ void QChanges::build_dialog() void QChanges::update_contents() { - next(); -} - - -void QChanges::next() -{ - controller().find(); - docstring text; docstring author = controller().getChangeAuthor(); docstring date = controller().getChangeDate(); @@ -71,6 +62,12 @@ void QChanges::next() } +void QChanges::next() +{ + controller().next(); +} + + void QChanges::accept() { controller().accept(); -- 2.39.5