2002-06-03 03:38:30 +00:00
|
|
|
/**
|
2002-09-25 14:26:13 +00:00
|
|
|
* \file GLog.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-03 03:38:30 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Michael Koziarski
|
2002-09-25 14:26:13 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-06-03 03:38:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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)
|
2002-09-26 08:57:43 +00:00
|
|
|
: GnomeCB<ControlLog>(c, "GLog")
|
2002-06-03 03:38:30 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
2002-06-15 09:22:03 +00:00
|
|
|
log_text()->get_buffer()->set_text(text);
|
2002-06-03 03:38:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
Gtk::Button * GLog::refresh_btn() const
|
2002-06-03 03:38:30 +00:00
|
|
|
{
|
2002-12-01 22:59:25 +00:00
|
|
|
return getWidget<Gtk::Button>("r_refresh_btn");
|
2002-06-03 03:38:30 +00:00
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
Gtk::Button * GLog::close_btn() const
|
2002-06-03 03:38:30 +00:00
|
|
|
{
|
2002-12-01 22:59:25 +00:00
|
|
|
return getWidget<Gtk::Button>("r_close_btn");
|
2002-06-03 03:38:30 +00:00
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
Gtk::TextView * GLog::log_text() const
|
2002-06-03 03:38:30 +00:00
|
|
|
{
|
2002-12-01 22:59:25 +00:00
|
|
|
return getWidget<Gtk::TextView>("r_log_text");
|
2002-06-03 03:38:30 +00:00
|
|
|
}
|