]> git.lyx.org Git - lyx.git/commitdiff
Implement the Log dialog, also update accessors.py
authorMichael Gerz <michael.gerz@teststep.org>
Mon, 3 Jun 2002 03:38:30 +0000 (03:38 +0000)
committerMichael Gerz <michael.gerz@teststep.org>
Mon, 3 Jun 2002 03:38:30 +0000 (03:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4323 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gnome/ChangeLog
src/frontends/gnome/Dialogs.C
src/frontends/gnome/GLog.C [new file with mode: 0644]
src/frontends/gnome/GLog.h [new file with mode: 0644]
src/frontends/gnome/Makefile.am
src/frontends/gnome/accessors.py
src/frontends/gnome/dialogs/GLog.glade [new file with mode: 0644]

index ed353cd0e5c2b06a84094b8e0b48ae2c92e0e668..00074b8351ce9078cc1fc252085fe13bc7b093d5 100644 (file)
@@ -1,3 +1,10 @@
+2002-06-03  Michael A. Koziarski  <michael@koziarski.com>
+
+       * dialogs/GLog.C
+       * GLog.C
+       * GLog.h: Implement Log view class
+       * accessors.py: update for new glade format
+
 2002-06-02  Michael A. Koziarski  <michael@koziarski.com>
 
         == Gtkmm2 upgrade ==
index 9874ad9c688979e271c95cddbbdfcc200bbf81f9..d8fdbefab2d0194447d76a9a155c3f1622d2537d 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "GError.h"
 #include "GERT.h"
+#include "GLog.h"
 #include "GPreamble.h"
 #include "GTabularCreate.h"
 #include "GUrl.h"
@@ -48,6 +49,8 @@ Dialogs::Dialogs(LyXView * lv)
            NoRepeatedApplyReadOnlyPolicy, gnomeBC>(*lv, *this));
        add(new GUI<ControlTabularCreate, GTabularCreate,
            OkApplyCancelReadOnlyPolicy, gnomeBC>(*lv, *this));
+       add(new GUI<ControlLog, GLog,
+                   OkCancelPolicy, gnomeBC>(*lv, *this));
 
        // reduce the number of connections needed in
        // dialogs by a simple connection here.
diff --git a/src/frontends/gnome/GLog.C b/src/frontends/gnome/GLog.C
new file mode 100644 (file)
index 0000000..c262e76
--- /dev/null
@@ -0,0 +1,89 @@
+/**
+ * \file GLog.C
+ * Copyright 2001 The LyX Team.
+ * See the file COPYING.
+ *
+ * \author Michael Koziarski <michael@koziarski.org>
+ */
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <config.h>
+#include <fstream>
+
+#include "gnomeBC.h"
+#include "GLog.h"
+
+#include <gtkmm/button.h>
+#include <gtkmm/textview.h>
+#include <gtkmm/dialog.h>
+
+GLog::GLog(ControlLog & c)
+       : FormCB<ControlLog>(c, "GLog")
+{}
+
+
+GLog::~GLog()
+{}
+
+
+void GLog::build()
+{
+       // Connect the buttons.
+       close_btn()->signal_clicked().connect(SigC::slot(*this, &GLog::CancelClicked));
+       refresh_btn()->signal_clicked().connect(SigC::slot(*this, &GLog::update));
+
+       // Manage the buttons state
+       bc().setCancel(close_btn());
+       bc().refresh();
+}
+
+void GLog::apply()
+{}
+
+
+void GLog::update()
+{
+       using namespace std;
+       pair<Buffer::LogType, string> const logfile = controller().logfile();
+
+       if (logfile.first == Buffer::buildlog)
+               dialog()->set_title(_("Build log"));
+       else
+               dialog()->set_title(_("LaTeX log"));
+
+       log_text()->get_buffer()->set_text("");
+
+       ifstream ifstr(logfile.second.c_str());
+       if (!ifstr) {
+               if (logfile.first == Buffer::buildlog)
+                       log_text()->get_buffer()->set_text(_("No build log file found"));
+               else
+                       log_text()->get_buffer()->set_text(_("No LaTeX log file found"));
+               return;
+       }
+
+       string text;
+       string line;
+
+       while (getline(ifstr, line))
+               text += line + "\n";
+
+       log_text()->get_buffer()->set_text(text.c_str());
+}
+
+
+Gtk::Button * GLog::refresh_btn() const 
+{
+        return getWidget<Gtk::Button>("r_refresh_btn");
+}
+Gtk::Button * GLog::close_btn() const 
+{
+        return getWidget<Gtk::Button>("r_close_btn");
+}
+Gtk::TextView * GLog::log_text() const 
+{
+        return getWidget<Gtk::TextView>("r_log_text");
+}
diff --git a/src/frontends/gnome/GLog.h b/src/frontends/gnome/GLog.h
new file mode 100644 (file)
index 0000000..4c027a8
--- /dev/null
@@ -0,0 +1,56 @@
+
+// -*- C++ -*-
+/**
+ * \file GLog.h
+ * Copyright 2001 The LyX Team.
+ * See the file COPYING.
+ *
+ * \author Michael Koziarski <michael@koziarski.org>
+ */
+
+#ifndef GLOG_H
+#define GLOG_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ControlLog.h"
+#include "GnomeBase.h"
+
+namespace Gtk {
+       class Button;
+       class TextView;
+}
+
+/**
+ * This class implements the dialog to modify the LaTeX preamble
+ */
+class GLog : public FormCB<ControlLog> {
+public:
+       ///
+       GLog(ControlLog & c);
+       ///
+       ~GLog();
+
+       void apply();
+       void update();
+       
+private:
+       /// Build the dialog
+       void build();
+
+       /// Returns true if the dialog input is in a valid state.
+       bool validate() const;
+       
+       /// generated by accessors.py
+       Gtk::Button * refresh_btn() const;
+       /// generated by accessors.py
+       Gtk::Button * close_btn() const;
+       /// generated by accessors.py
+       Gtk::TextView * log_text() const;
+
+       
+};
+
+#endif
index 5cb06a08094bebb758ed89e36f36dd73235610ac..19f5d57905a4fd19f07b3e1934f97c9aca734520 100644 (file)
@@ -72,6 +72,8 @@ libgnome_la_SOURCES = \
        GError.h \
        GERT.C \
        GERT.h \
+       GLog.C \
+       GLog.h \
        GPreamble.C \
        GPreamble.h \
        GTabularCreate.C \
index 1fc223bdf160d7118bb38a8811a1ca4bce3102e9..008df5c47554228b4e72191a5435d687cca06315 100644 (file)
@@ -50,23 +50,18 @@ class GnomeFrontendHandler(ContentHandler):
         
     def startElement(self, name, attrs):
         self.elemstack.append(name)
+        if name == "widget" and rn.search(attrs["id"]):
+                self.TODO.append(widget(attrs["class"], 
+                                        re.sub("^r_", "", attrs["id"])))
     
     def endElement(self, name):
         self.elemstack.pop()
 
-        if name == "widget":
-            self.currclass = ""
         
     def characters(self, data):
 
         elem = self.elemstack[-1]
 
-        if elem == "class":
-            self.currclass = data
-        elif elem == "name":
-            if rn.search(data):
-                self.TODO.append(widget(self.currclass,
-                                        re.sub("^r_", "", data)))
     def widgets(self):
         return self.TODO
 
diff --git a/src/frontends/gnome/dialogs/GLog.glade b/src/frontends/gnome/dialogs/GLog.glade
new file mode 100644 (file)
index 0000000..a785079
--- /dev/null
@@ -0,0 +1,98 @@
+<?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="GLog">
+  <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">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="border_width">2</property>
+      <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="border_width">5</property>
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+         <property name="spacing">10</property>
+
+         <child>
+           <widget class="GtkButton" id="r_refresh_btn">
+             <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="response_id">0</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="r_close_btn">
+             <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="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_ALWAYS</property>
+         <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+         <property name="shadow_type">GTK_SHADOW_NONE</property>
+         <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+         <child>
+           <widget class="GtkTextView" id="r_log_text">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="justification">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap_mode">GTK_WRAP_NONE</property>
+             <property name="cursor_visible">True</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>