mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Add ShowFile dialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9070 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e8b0d829e7
commit
0e976314ed
@ -1,10 +1,9 @@
|
||||
2004-10-08 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The ShowFile dialog
|
||||
* Dialogs.C, GShowFile.C, GShowFile.h, Makefile.am
|
||||
* The Texinfo dialog
|
||||
* Dialogs.C, GTexinfo.C, GTexinfo.h, Makefile.am
|
||||
|
||||
2004-10-08 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The ErrorList dialog
|
||||
* Dialogs.C, GErrorList.C, GErrorList.h, Makefile.am
|
||||
* GViewBase.[Ch]: implement setTitle for gtk windows.
|
||||
|
@ -82,7 +82,7 @@
|
||||
#include "FormSendto.h"
|
||||
#include "FormTabular.h"
|
||||
#include "GTexinfo.h"
|
||||
#include "FormShowFile.h"
|
||||
#include "GShowFile.h"
|
||||
#include "GSpellchecker.h"
|
||||
#include "GTableCreate.h"
|
||||
#include "GToc.h"
|
||||
@ -224,8 +224,9 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
|
||||
dialog->setView(new FormExternal(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "file") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlShowFile(*dialog));
|
||||
dialog->setView(new FormShowFile(*dialog));
|
||||
dialog->setView(new GShowFile(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "findreplace") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
|
57
src/frontends/gtk/GShowFile.C
Normal file
57
src/frontends/gtk/GShowFile.C
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* \file GShowFile.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 "GShowFile.h"
|
||||
#include "ControlShowFile.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GShowFile::GShowFile(Dialog & parent)
|
||||
: GViewCB<ControlShowFile, GViewGladeB>(parent, _("Show File"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GShowFile::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("showfile");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * closebutton;
|
||||
xml_->get_widget("Close", closebutton);
|
||||
setCancel(closebutton);
|
||||
|
||||
Gtk::TextView * contentview;
|
||||
xml_->get_widget("ContentView", contentview);
|
||||
contentbuffer_ = contentview->get_buffer();
|
||||
}
|
||||
|
||||
|
||||
void GShowFile::update()
|
||||
{
|
||||
string const title = controller().getFileName();
|
||||
|
||||
if (!title.empty())
|
||||
setTitle(title);
|
||||
|
||||
string const contents = controller().getFileContents();
|
||||
|
||||
if (!contents.empty())
|
||||
contentbuffer_->set_text(contents);
|
||||
else
|
||||
contentbuffer_->set_text(_("Error reading file!"));
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
45
src/frontends/gtk/GShowFile.h
Normal file
45
src/frontends/gtk/GShowFile.h
Normal file
@ -0,0 +1,45 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GShowFile.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 GSHOWFILE_H
|
||||
#define GSHOWFILE_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlShowFile;
|
||||
|
||||
/**
|
||||
* This class provides a GTK+ implementation of a dialog to browse through a
|
||||
* text file.
|
||||
*/
|
||||
class GShowFile : public GViewCB<ControlShowFile, GViewGladeB> {
|
||||
public:
|
||||
///
|
||||
GShowFile(Dialog &);
|
||||
|
||||
// Functions accessible to the Controller.
|
||||
|
||||
virtual void doBuild();
|
||||
/// Set the Params variable for the Controller.
|
||||
virtual void apply() {}
|
||||
/// Update dialog before/whilst showing it.
|
||||
virtual void update();
|
||||
|
||||
Glib::RefPtr<Gtk::TextBuffer> contentbuffer_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GFILE_H
|
@ -50,6 +50,8 @@ libgtk_la_SOURCES = \
|
||||
GScreen.h \
|
||||
GSearch.C \
|
||||
GSearch.h \
|
||||
GShowFile.C \
|
||||
GShowFile.h \
|
||||
GSpellchecker.C \
|
||||
GSpellchecker.h \
|
||||
GTableCreate.C \
|
||||
@ -124,7 +126,6 @@ xforms_objects = \
|
||||
../xforms/FormRef.lo \
|
||||
../xforms/FormSendto.lo \
|
||||
../xforms/forms_gettext.lo \
|
||||
../xforms/FormShowFile.lo \
|
||||
../xforms/FormTabular.lo \
|
||||
../xforms/FormText.lo \
|
||||
../xforms/FormThesaurus.lo \
|
||||
|
94
src/frontends/gtk/glade/showfile.glade
Normal file
94
src/frontends/gtk/glade/showfile.glade
Normal file
@ -0,0 +1,94 @@
|
||||
<?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="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