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
This commit is contained in:
Michael Gerz 2002-06-03 03:38:30 +00:00
parent f4332037dc
commit f66ffcee8c
7 changed files with 258 additions and 8 deletions

View 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 ==

View 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.

View File

@ -0,0 +1,89 @@
/**
* ile 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");
}

View File

@ -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

View File

@ -72,6 +72,8 @@ libgnome_la_SOURCES = \
GError.h \
GERT.C \
GERT.h \
GLog.C \
GLog.h \
GPreamble.C \
GPreamble.h \
GTabularCreate.C \

View 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

View File

@ -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>