mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Add GTK Log view dialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9071 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0e976314ed
commit
2c7c49ad8b
@ -1,3 +1,8 @@
|
||||
2004-10-09 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Log dialog
|
||||
* Dialogs.C, GLog.C, GLog.h, Makefile.am, glade/log.glade
|
||||
|
||||
2004-10-08 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The ShowFile dialog
|
||||
|
@ -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 const & name)
|
||||
_("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") {
|
||||
|
64
src/frontends/gtk/GLog.C
Normal file
64
src/frontends/gtk/GLog.C
Normal file
@ -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
|
43
src/frontends/gtk/GLog.h
Normal file
43
src/frontends/gtk/GLog.h
Normal file
@ -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
|
@ -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 \
|
||||
|
107
src/frontends/gtk/glade/log.glade
Normal file
107
src/frontends/gtk/glade/log.glade
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user