Hi,

The patch spam continues: here is the "LaTeX log" dialog. Exactly the same as the ShowFile dialog, but with a refresh button and for the different controller API.

John
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/ChangeLog,v
retrieving revision 1.73
diff -u -p -r1.73 ChangeLog
--- ChangeLog	9 Oct 2004 07:51:36 -0000	1.73
+++ ChangeLog	9 Oct 2004 08:17:05 -0000
@@ -1,3 +1,8 @@
+2004-10-09  John Spray  <[EMAIL PROTECTED]>
+
+	* The Log dialog
+	* Dialogs.C, GLog.C, GLog.h, Makefile.am, glade/log.glade
+
 2004-10-08  John Spray  <[EMAIL PROTECTED]>
 
 	* The ShowFile dialog
Index: Dialogs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/Dialogs.C,v
retrieving revision 1.28
diff -u -p -r1.28 Dialogs.C
--- Dialogs.C	9 Oct 2004 07:51:36 -0000	1.28
+++ Dialogs.C	9 Oct 2004 08:17:05 -0000
@@ -66,7 +66,7 @@
 #include "FormFloat.h"
 #include "FormGraphics.h"
 #include "FormInclude.h"
-#include "FormLog.h"
+#include "GLog.h"
 #include "GMathPanel.h"
 #include "FormMathsBitmap.h"
 #include "GMathsMatrix.h"
@@ -258,8 +258,9 @@ Dialogs::DialogPtr Dialogs::build(string
 					  _("Label"), _("Label:|#L")));
 		dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
 	} else if (name == "log") {
+		dialog->bc().view(new GBC(dialog->bc()));
 		dialog->setController(new ControlLog(*dialog));
-		dialog->setView(new FormLog(*dialog));
+		dialog->setView(new GLog(*dialog));
 		dialog->bc().bp(new OkCancelPolicy);
 
 	} else if (name == "mathpanel") {
Index: GLog.C
===================================================================
RCS file: GLog.C
diff -N GLog.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ GLog.C	9 Oct 2004 08:17:05 -0000
@@ -0,0 +1,64 @@
+/**
+ * \file GLog.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 "GLog.h"
+#include "ControlLog.h"
+
+#include "ghelpers.h"
+
+#include <sstream>
+
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+GLog::GLog(Dialog & parent)
+	: GViewCB<ControlLog, GViewGladeB>(parent, _("Log Viewer"), false)
+{}
+
+
+void GLog::doBuild()
+{
+	string const gladeName = findGladeFile("log");
+	xml_ = Gnome::Glade::Xml::create(gladeName);
+
+	Gtk::Button * button;
+	xml_->get_widget("Close", button);
+	setCancel(button);
+
+	xml_->get_widget("Refresh", button);
+	button->signal_clicked().connect(
+		sigc::mem_fun(*this, &GLog::update));
+
+	Gtk::TextView * contentview;
+	xml_->get_widget("ContentView", contentview);
+	contentbuffer_ = contentview->get_buffer();
+}
+
+
+void GLog::update()
+{
+	string const title = controller().title();
+
+	if (!title.empty())
+		setTitle(title);
+
+	std::ostringstream contents;
+	controller().getContents(contents);
+
+	if (!contents.str().empty())
+		contentbuffer_->set_text(contents.str());
+	else
+		contentbuffer_->set_text(_("Error reading file!"));
+}
+
+} // namespace frontend
+} // namespace lyx
Index: GLog.h
===================================================================
RCS file: GLog.h
diff -N GLog.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ GLog.h	9 Oct 2004 08:17:05 -0000
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+/**
+ * \file GLog.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 GLOG_H
+#define GLOG_H
+
+#include "GViewBase.h"
+
+namespace lyx {
+namespace frontend {
+
+class ControlLog;
+
+/**
+ * This class provides a GTK+ implementation of a dialog to browse through a
+ * log file.
+ */
+class GLog : public GViewCB<ControlLog, GViewGladeB> {
+public:
+	GLog(Dialog &);
+
+	// Create the dialog
+	virtual void doBuild();
+	// Set the Params variable for the Controller.
+	virtual void apply() {}
+	// Update dialog (load log into textbuffer)
+	virtual void update();
+
+	Glib::RefPtr<Gtk::TextBuffer> contentbuffer_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GLOG_H
Index: Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/Makefile.am,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile.am
--- Makefile.am	9 Oct 2004 07:51:36 -0000	1.26
+++ Makefile.am	9 Oct 2004 08:17:05 -0000
@@ -28,6 +28,8 @@ libgtk_la_SOURCES = \
 	GCharacter.h \
 	GErrorList.C \
 	GErrorList.h \
+	GLog.C \
+	GLog.h \
 	GLyXKeySym.C \
 	GLyXKeySym.h \
 	GMathDelim.C \
@@ -115,7 +117,6 @@ xforms_objects = \
 	../xforms/FormFloat.lo \
 	../xforms/FormGraphics.lo \
 	../xforms/FormInclude.lo \
-	../xforms/FormLog.lo \
 	../xforms/FormMathsBitmap.lo \
 	../xforms/FormMathsDelim.lo \
 	../xforms/FormMathsSpace.lo \
Index: glade/log.glade
===================================================================
RCS file: glade/log.glade
diff -N glade/log.glade
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ glade/log.glade	9 Oct 2004 08:17:05 -0000
@@ -0,0 +1,107 @@
+<?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">You shouldn't see this</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="default_width">550</property>
+  <property name="default_height">400</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="Refresh">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-refresh</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="Close">
+	      <property name="visible">True</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>
+	</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="GtkScrolledWindow" id="scrolledwindow1">
+	  <property name="visible">True</property>
+	  <property name="can_focus">True</property>
+	  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	  <property name="shadow_type">GTK_SHADOW_IN</property>
+	  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+	  <child>
+	    <widget class="GtkTextView" id="ContentView">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">False</property>
+	      <property name="overwrite">False</property>
+	      <property name="accepts_tab">True</property>
+	      <property name="justification">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap_mode">GTK_WRAP_NONE</property>
+	      <property name="cursor_visible">False</property>
+	      <property name="pixels_above_lines">0</property>
+	      <property name="pixels_below_lines">0</property>
+	      <property name="pixels_inside_wrap">0</property>
+	      <property name="left_margin">0</property>
+	      <property name="right_margin">0</property>
+	      <property name="indent">0</property>
+	      <property name="text" translatable="yes"></property>
+	    </widget>
+	  </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