On Sun, 2004-10-10 at 18:06, John Levon wrote:
> This isn't great UI. Users *hate* things jumping up in front of them.
> What you should probably do instead is clear all the items on the
> dialog, and perhaps place a message "All changes merged" on the dialog.
> Under no circumstances use an alert for a successful operation.

Revised version does everything with one dialog.

John
Index: controllers/ControlChanges.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlChanges.C,v
retrieving revision 1.17
diff -u -p -r1.17 ControlChanges.C
--- controllers/ControlChanges.C	19 May 2004 15:11:30 -0000	1.17
+++ controllers/ControlChanges.C	11 Oct 2004 13:45:44 -0000
@@ -72,18 +72,19 @@ string const ControlChanges::getChangeAu
 }
 
 
-void ControlChanges::accept()
+bool ControlChanges::accept()
 {
 	kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
-	find::findNextChange(kernel().bufferview());
+	return find::findNextChange(kernel().bufferview());
 }
 
 
-void ControlChanges::reject()
+bool ControlChanges::reject()
 {
 	kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
-	find::findNextChange(kernel().bufferview());
+	return find::findNextChange(kernel().bufferview());
 }
+
 
 } // namespace frontend
 } // namespace lyx
Index: controllers/ControlChanges.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlChanges.h,v
retrieving revision 1.9
diff -u -p -r1.9 ControlChanges.h
--- controllers/ControlChanges.h	19 May 2004 15:11:30 -0000	1.9
+++ controllers/ControlChanges.h	11 Oct 2004 13:45:44 -0000
@@ -43,10 +43,10 @@ public:
 	std::string const getChangeAuthor();
 
 	/// accept the current merge
-	void accept();
+	bool accept();
 
 	/// reject the current merge
-	void reject();
+	bool reject();
 };
 
 } // namespace frontend
Index: gtk/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/ChangeLog,v
retrieving revision 1.74
diff -u -p -r1.74 ChangeLog
--- gtk/ChangeLog	9 Oct 2004 13:51:04 -0000	1.74
+++ gtk/ChangeLog	11 Oct 2004 13:45:45 -0000
@@ -1,3 +1,10 @@
+2004-10-11  John Spray  <[EMAIL PROTECTED]>
+
+	* The Changes dialog
+	* Dialogs.C, Makefile.am, GChanges.C, GChanges.h
+	* ControlChanges.[Ch]: make accept() and reject() return bool
+	from findNextChange
+
 2004-10-09  John Spray  <[EMAIL PROTECTED]>
 
 	* The Log dialog
Index: gtk/Dialogs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/Dialogs.C,v
retrieving revision 1.29
diff -u -p -r1.29 Dialogs.C
--- gtk/Dialogs.C	9 Oct 2004 13:51:04 -0000	1.29
+++ gtk/Dialogs.C	11 Oct 2004 13:45:45 -0000
@@ -56,7 +56,7 @@
 #include "FormBibtex.h"
 #include "FormBox.h"
 #include "FormBranch.h"
-#include "FormChanges.h"
+#include "GChanges.h"
 #include "GCharacter.h"
 #include "FormCitation.h"
 #include "FormDocument.h"
@@ -194,8 +194,9 @@ Dialogs::DialogPtr Dialogs::build(string
 		dialog->setView(new FormBox(*dialog));
 		dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
 	} else if (name == "changes") {
+		dialog->bc().view(new GBC(dialog->bc()));
 		dialog->setController(new ControlChanges(*dialog));
-		dialog->setView(new FormChanges(*dialog));
+		dialog->setView(new GChanges(*dialog));
 		dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
 	} else if (name == "character") {
 		dialog->bc().view(new GBC(dialog->bc()));
Index: gtk/GChanges.C
===================================================================
RCS file: gtk/GChanges.C
diff -N gtk/GChanges.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gtk/GChanges.C	11 Oct 2004 13:45:45 -0000
@@ -0,0 +1,122 @@
+/**
+ * \file GChanges.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Spray
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include "GChanges.h"
+#include "ControlChanges.h"
+
+#include "ghelpers.h"
+
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+
+GChanges::GChanges(Dialog & parent)
+	: GViewCB<ControlChanges, GViewGladeB>(parent, _("Merge Changes"), false)
+{}
+
+
+void GChanges::doBuild()
+{
+	string const gladeName = findGladeFile("changes");
+	xml_ = Gnome::Glade::Xml::create(gladeName);
+
+	xml_->get_widget("Message", messagelabel_);
+
+	Gtk::Button * closebutton;
+	xml_->get_widget("Close", closebutton);
+	setCancel(closebutton);
+
+	xml_->get_widget("Accept", acceptbutton_);
+	bcview().addReadOnly(acceptbutton_);
+	acceptbutton_->signal_clicked().connect(
+		sigc::mem_fun(*this, &GChanges::onAccept));
+
+	xml_->get_widget("Reject", rejectbutton_);
+	bcview().addReadOnly(rejectbutton_);
+	rejectbutton_->signal_clicked().connect(
+		sigc::mem_fun(*this, &GChanges::onReject));
+
+	xml_->get_widget("Next", nextbutton_);
+	nextbutton_->signal_clicked().connect(
+		sigc::mem_fun(*this, &GChanges::onNext));
+}
+
+
+void GChanges::update()
+{
+	onNext();
+}
+
+
+void GChanges::onAccept()
+{
+	if (controller().accept()) {
+		promptChange();
+	} else {
+		promptDismiss();
+	}
+}
+
+
+void GChanges::onReject()
+{
+	if (controller().reject()) {
+		promptChange();
+	} else {
+		promptDismiss();
+	}
+}
+
+
+void GChanges::onNext()
+{
+	if (controller().find()) {
+		promptChange();
+	} else {
+		promptDismiss();
+	}
+}
+
+
+void GChanges::promptChange()
+{
+	string const header = _("Accept highlighted change?");
+	string const author = controller().getChangeAuthor();
+	string const date = controller().getChangeDate();
+	
+
+	messagelabel_->set_markup("<big><b>" + header +
+	                        "</b></big>\n\nChanged by <b>" + author
+	                        + "</b> on <b>" + date + "</b>");
+
+	acceptbutton_->set_sensitive(true && !readOnly());
+	rejectbutton_->set_sensitive(true && !readOnly());
+	nextbutton_->set_sensitive(true);
+}
+
+
+void GChanges::promptDismiss()
+{
+	string const header = _("Done merging changes");
+
+	messagelabel_->set_markup("<big><b>" + header +
+	                        "</b></big>");
+
+	// Disable all buttons but close.
+	acceptbutton_->set_sensitive(false);
+	rejectbutton_->set_sensitive(false);
+	nextbutton_->set_sensitive(false);
+}
+
+
+} // namespace frontend
+} // namespace lyx
Index: gtk/GChanges.h
===================================================================
RCS file: gtk/GChanges.h
diff -N gtk/GChanges.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gtk/GChanges.h	11 Oct 2004 13:45:45 -0000
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+/**
+ * \file GChanges.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Spray
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GCHANGES_H
+#define GCHANGES_H
+
+#include "GViewBase.h"
+
+namespace lyx {
+namespace frontend {
+
+class ControlChanges;
+
+/**
+ * This class provides a GTK+ implementation of the Merge Changes Dialog.
+ */
+class GChanges
+	: public GViewCB<ControlChanges, GViewGladeB> {
+public:
+	GChanges(Dialog &);
+
+private:
+	/// not needed.
+	virtual void apply() {}
+	/// Build the dialog
+	virtual void doBuild();
+	/// update the dialog
+	virtual void update();
+
+	void onAccept();
+	void onReject();
+	void onNext();
+
+	void promptChange();
+	void promptDismiss();
+
+	Gtk::Label * messagelabel_;
+	Gtk::Button * nextbutton_;
+	Gtk::Button * acceptbutton_;
+	Gtk::Button * rejectbutton_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GCHANGES_H
Index: gtk/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/Makefile.am,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile.am
--- gtk/Makefile.am	9 Oct 2004 13:51:05 -0000	1.27
+++ gtk/Makefile.am	11 Oct 2004 13:45:45 -0000
@@ -24,6 +24,8 @@ libgtk_la_SOURCES = \
 	GAboutlyx.h \
 	GBC.C \
 	GBC.h \
+	GChanges.C \
+	GChanges.h \
 	GCharacter.C \
 	GCharacter.h \
 	GErrorList.C \
@@ -107,7 +109,6 @@ xforms_objects = \
 	../xforms/FormBox.lo \
 	../xforms/FormBranch.lo \
 	../xforms/FormBrowser.lo \
-	../xforms/FormChanges.lo \
 	../xforms/FormCitation.lo \
 	../xforms/FormColorpicker.lo \
 	../xforms/FormDialogView.lo \
Index: gtk/glade/changes.glade
===================================================================
RCS file: gtk/glade/changes.glade
diff -N gtk/glade/changes.glade
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gtk/glade/changes.glade	11 Oct 2004 13:45:45 -0000
@@ -0,0 +1,352 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
+<glade-interface>
+
+<widget class="GtkDialog" id="dialog">
+  <property name="border_width">6</property>
+  <property name="title" translatable="yes">dialog1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">True</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="has_separator">False</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area1">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="Close">
+	      <property name="visible">True</property>
+	      <property name="tooltip" translatable="yes">Abort merge</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-7</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="Next">
+	      <property name="visible">True</property>
+	      <property name="tooltip" translatable="yes">Ignore this change and proceed to the next</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">0</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment8">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">0</property>
+		  <property name="yscale">0</property>
+		  <property name="top_padding">0</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">0</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox13">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">2</property>
+
+		      <child>
+			<widget class="GtkImage" id="image10">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-go-forward</property>
+			  <property name="icon_size">4</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label14">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Next</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="Reject">
+	      <property name="visible">True</property>
+	      <property name="tooltip" translatable="yes">Reject this change</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-6</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment4">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">0</property>
+		  <property name="yscale">0</property>
+		  <property name="top_padding">0</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">0</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox7">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">2</property>
+
+		      <child>
+			<widget class="GtkImage" id="image4">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-no</property>
+			  <property name="icon_size">4</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label8">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Reject</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="Accept">
+	      <property name="visible">True</property>
+	      <property name="tooltip" translatable="yes">Accept the change highlighted in the main window</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">0</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment5">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">0</property>
+		  <property name="yscale">0</property>
+		  <property name="top_padding">0</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">0</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox10">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">2</property>
+
+		      <child>
+			<widget class="GtkImage" id="image7">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-yes</property>
+			  <property name="icon_size">4</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label11">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Accept</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkHBox" id="hbox9">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkImage" id="image6">
+	      <property name="visible">True</property>
+	      <property name="stock">gtk-dialog-question</property>
+	      <property name="icon_size">6</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">6</property>
+	      <property name="ypad">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkVBox" id="vbox1">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkVBox" id="vbox2">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
+
+		  <child>
+		    <widget class="GtkLabel" id="Message">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">&lt;b&gt;&lt;big&gt;Accept highlighted change?&lt;/big&gt;&lt;/b&gt;
+
+Changed by &lt;b&gt;A Person&lt;/b&gt; on &lt;b&gt;4th July&lt;/b&gt;</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">True</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">4</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>

Reply via email to