Hello everybody,

I think this patch fixes all (known) problems with the Merge-Changes dialog.

Michael


[EMAIL PROTECTED] schrieb:
Author: schmitt
Date: Thu Feb  1 21:48:43 2007
New Revision: 17019

URL: http://www.lyx.org/trac/changeset/17019
Log:
        * 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

Modified:
    lyx-devel/trunk/src/frontends/controllers/ControlChanges.C
    lyx-devel/trunk/src/frontends/controllers/ControlChanges.h
    lyx-devel/trunk/src/frontends/qt4/QChanges.C

Modified: lyx-devel/trunk/src/frontends/controllers/ControlChanges.C
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/controllers/ControlChanges.C?rev=17019
==============================================================================
--- lyx-devel/trunk/src/frontends/controllers/ControlChanges.C (original)
+++ lyx-devel/trunk/src/frontends/controllers/ControlChanges.C Thu Feb  1 
21:48:43 2007
@@ -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 @@
 {}
-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::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();
 }
Modified: lyx-devel/trunk/src/frontends/controllers/ControlChanges.h
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/controllers/ControlChanges.h?rev=17019
==============================================================================
--- lyx-devel/trunk/src/frontends/controllers/ControlChanges.h (original)
+++ lyx-devel/trunk/src/frontends/controllers/ControlChanges.h Thu Feb  1 
21:48:43 2007
@@ -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 @@
        /// 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 @@
        /// 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

Modified: lyx-devel/trunk/src/frontends/qt4/QChanges.C
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/QChanges.C?rev=17019
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/QChanges.C (original)
+++ lyx-devel/trunk/src/frontends/qt4/QChanges.C Thu Feb  1 21:48:43 2007
@@ -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.
  */
@@ -23,8 +24,6 @@
 #include <QTextBrowser>
using lyx::support::bformat;
-
-using std::string;
namespace lyx {
 namespace frontend {
@@ -50,14 +49,6 @@
void QChanges::update_contents()
 {
-       next();
-}
-
-
-void QChanges::next()
-{
-       controller().find();
-
        docstring text;
        docstring author = controller().getChangeAuthor();
        docstring date = controller().getChangeDate();
@@ -68,6 +59,12 @@
                text += bformat(_("Change made at %1$s\n"), date);
dialog_->changeTB->setPlainText(toqstr(text));
+}
+
+
+void QChanges::next()
+{
+       controller().next();
 }

_______________________________________________
Cvslog mailing list
[EMAIL PROTECTED]
http://www.lyx.org/mailman/listinfo/cvslog


Reply via email to