]> git.lyx.org Git - features.git/commitdiff
* frontends/qt4/QChanges.C:
authorMichael Schmitt <michael.schmitt@teststep.org>
Thu, 1 Feb 2007 20:48:43 +0000 (20:48 +0000)
committerMichael Schmitt <michael.schmitt@teststep.org>
Thu, 1 Feb 2007 20:48:43 +0000 (20:48 +0000)
* 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
src/frontends/controllers/ControlChanges.h
src/frontends/qt4/QChanges.C

index e9d266145c4742e4f7d5da19b47b30bce0ca94a7..4a1e574581dd232576d7d61fbe5509156052cf8c 100644 (file)
@@ -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.
  */
 #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();
 }
 
 
index 25b1b57ade4fd30edbb64e76e3edb58e5718c3c1..7168cc655fd021384680dd4402850bda49ed78c5 100644 (file)
@@ -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
index 71504f55ba58679431f24d38120c6ac598f4c0db..4891a77c96ade845965d96b4d2b600a4ec35b4ae 100644 (file)
@@ -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();