From: Michael Gerz Date: Mon, 3 Jun 2002 03:38:30 +0000 (+0000) Subject: Implement the Log dialog, also update accessors.py X-Git-Tag: 1.6.10~19142 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f66ffcee8c3450acf9a699011165d2fee39fcc4e;p=lyx.git Implement the Log dialog, also update accessors.py git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4323 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/gnome/ChangeLog b/src/frontends/gnome/ChangeLog index ed353cd0e5..00074b8351 100644 --- a/src/frontends/gnome/ChangeLog +++ b/src/frontends/gnome/ChangeLog @@ -1,3 +1,10 @@ +2002-06-03 Michael A. Koziarski + + * dialogs/GLog.C + * GLog.C + * GLog.h: Implement Log view class + * accessors.py: update for new glade format + 2002-06-02 Michael A. Koziarski == Gtkmm2 upgrade == diff --git a/src/frontends/gnome/Dialogs.C b/src/frontends/gnome/Dialogs.C index 9874ad9c68..d8fdbefab2 100644 --- a/src/frontends/gnome/Dialogs.C +++ b/src/frontends/gnome/Dialogs.C @@ -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(*lv, *this)); + add(new GUI(*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 index 0000000000..c262e761e7 --- /dev/null +++ b/src/frontends/gnome/GLog.C @@ -0,0 +1,89 @@ +/** + * ile GLog.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Michael Koziarski + */ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include +#include + +#include "gnomeBC.h" +#include "GLog.h" + +#include +#include +#include + +GLog::GLog(ControlLog & c) + : FormCB(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 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("r_refresh_btn"); +} +Gtk::Button * GLog::close_btn() const +{ + return getWidget("r_close_btn"); +} +Gtk::TextView * GLog::log_text() const +{ + return getWidget("r_log_text"); +} diff --git a/src/frontends/gnome/GLog.h b/src/frontends/gnome/GLog.h new file mode 100644 index 0000000000..4c027a8e02 --- /dev/null +++ b/src/frontends/gnome/GLog.h @@ -0,0 +1,56 @@ + +// -*- C++ -*- +/** + * \file GLog.h + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Michael Koziarski + */ + +#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 { +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 diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index 5cb06a0809..19f5d57905 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -72,6 +72,8 @@ libgnome_la_SOURCES = \ GError.h \ GERT.C \ GERT.h \ + GLog.C \ + GLog.h \ GPreamble.C \ GPreamble.h \ GTabularCreate.C \ diff --git a/src/frontends/gnome/accessors.py b/src/frontends/gnome/accessors.py index 1fc223bdf1..008df5c475 100644 --- a/src/frontends/gnome/accessors.py +++ b/src/frontends/gnome/accessors.py @@ -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 index 0000000000..a785079a2a --- /dev/null +++ b/src/frontends/gnome/dialogs/GLog.glade @@ -0,0 +1,98 @@ + + + + + + + dialog1 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + + + + 2 + True + False + 0 + + + + 5 + True + GTK_BUTTONBOX_END + 10 + + + + True + True + True + gtk-refresh + True + GTK_RELIEF_NORMAL + 0 + + + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + + + + + + +