Hi,

The Texinfo dialog.  Will do the 'file' dialog next, since that's what
one gets when one activates a filename in the texinfo dialog.

John
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/ChangeLog,v
retrieving revision 1.71
diff -u -p -r1.71 ChangeLog
--- ChangeLog	8 Oct 2004 14:59:17 -0000	1.71
+++ ChangeLog	8 Oct 2004 16:40:02 -0000
@@ -1,5 +1,10 @@
 2004-10-08  John Spray  <[EMAIL PROTECTED]>
 
+	* The Texinfo dialog
+	* Dialogs.C, GTexinfo.C, GTexinfo.h, Makefile.am
+
+2004-10-08  John Spray  <[EMAIL PROTECTED]>
+
 	* The ErrorList dialog
 	* Dialogs.C, GErrorList.C, GErrorList.h, Makefile.am
 	* GViewBase.[Ch]: implement setTitle for gtk windows.
Index: Dialogs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/Dialogs.C,v
retrieving revision 1.26
diff -u -p -r1.26 Dialogs.C
--- Dialogs.C	8 Oct 2004 14:59:17 -0000	1.26
+++ Dialogs.C	8 Oct 2004 16:40:02 -0000
@@ -81,7 +81,7 @@
 #include "GSearch.h"
 #include "FormSendto.h"
 #include "FormTabular.h"
-#include "FormTexinfo.h"
+#include "GTexinfo.h"
 #include "FormShowFile.h"
 #include "GSpellchecker.h"
 #include "GTableCreate.h"
@@ -494,8 +494,9 @@ Dialogs::DialogPtr Dialogs::build(string
 		dialog->setView(new GTableCreate(*dialog));
 		dialog->bc().bp(new IgnorantPolicy);
 	} else if (name == "texinfo") {
+		dialog->bc().view(new GBC(dialog->bc()));	
 		dialog->setController(new ControlTexinfo(*dialog));
-		dialog->setView(new FormTexinfo(*dialog));
+		dialog->setView(new GTexinfo(*dialog));
 		dialog->bc().bp(new OkCancelPolicy);
 #ifdef HAVE_LIBAIKSAURUS
 	} else if (name == "thesaurus") {
Index: GTexinfo.C
===================================================================
RCS file: GTexinfo.C
diff -N GTexinfo.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ GTexinfo.C	8 Oct 2004 16:40:02 -0000
@@ -0,0 +1,142 @@
+/**
+ * \file GTexinfo.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 "GTexinfo.h"
+
+#include "ghelpers.h"
+
+#include "support/filetools.h"
+
+using std::string;
+
+namespace lyx {
+
+using support::OnlyFilename;
+
+namespace frontend {
+
+
+GTexinfo::GTexinfo(Dialog & parent)
+	: GViewCB<ControlTexinfo, GViewGladeB>(parent, _("LaTeX Information"), false),
+	  activeStyle(ControlTexinfo::cls)
+{}
+
+
+void GTexinfo::doBuild() {
+	string const gladeName = findGladeFile("texinfo");
+	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, &GTexinfo::onRefresh));
+	
+	xml_->get_widget("FullPath", fullpathcheck_);
+	fullpathcheck_->signal_toggled().connect(
+		sigc::mem_fun(*this, &GTexinfo::updateStyles));
+	
+	// For both liststores
+	listCols_.add(listCol_);
+	listCols_.add(listColIndex_);
+	
+	// Items ListView
+	xml_->get_widget("Items", itemsview_);
+	itemsstore_ = Gtk::ListStore::create(listCols_);
+	itemsview_->set_model(itemsstore_);
+	itemsview_->append_column("Item", listCol_);
+	listSel_ = itemsview_->get_selection();
+	
+	itemsview_->signal_row_activated().connect(
+		sigc::mem_fun(*this, &GTexinfo::onItemActivate));
+
+	// Type Selection Combobox
+	xml_->get_widget("Type", typecombo_);
+	typestore_ = Gtk::ListStore::create(listCols_);
+	typecombo_->set_model(typestore_);
+	Gtk::CellRendererText * cell = Gtk::manage(new Gtk::CellRendererText);
+	typecombo_->pack_start(*cell, true);
+	typecombo_->add_attribute(*cell, "text", 0);
+	typecombo_->signal_changed().connect(
+		sigc::mem_fun(*this, &GTexinfo::onTypeComboChanged));
+	
+	Gtk::TreeModel::iterator row = typestore_->append();
+	(*row)[listCol_] = _("LaTeX classes");
+	(*row)[listColIndex_] = ControlTexinfo::cls;	
+	// This is the default selection
+	typecombo_->set_active(row);
+	activeStyle = ControlTexinfo::cls;
+	
+	row = typestore_->append();	
+	(*row)[listCol_] = _("LaTeX styles");
+	(*row)[listColIndex_] = ControlTexinfo::sty;		
+	
+	row = typestore_->append();	
+	(*row)[listCol_] = _("BibTeX styles");
+	(*row)[listColIndex_] = ControlTexinfo::bst;
+
+	updateStyles();
+}
+
+
+void GTexinfo::onItemActivate(
+	Gtk::TreeModel::Path const & path,
+	Gtk::TreeViewColumn * col)
+{
+	int const choice =
+		(*itemsstore_->get_iter(path))[listColIndex_];
+
+	ContentsType const & data = texdata_[activeStyle];
+	if (choice >= 0 && choice <= data.size() - 1)
+		controller().viewFile(data[choice]);
+}
+
+
+void GTexinfo::onTypeComboChanged()
+{
+	int const typeindex =
+		(*typecombo_->get_active())[listColIndex_];
+	activeStyle = static_cast<ControlTexinfo::texFileSuffix>(typeindex);
+	updateStyles();
+}
+
+
+void GTexinfo::onRefresh()
+{
+	// makes sense only if the rights are set well for
+	// users (/var/lib/texmf/ls-R)
+	texhash();
+	rescanTexStyles();
+	updateStyles();
+}
+
+
+void GTexinfo::updateStyles()
+{
+	ContentsType & data = texdata_[activeStyle];
+	getTexFileList(activeStyle, data);
+
+	bool const withFullPath = fullpathcheck_->get_active();
+
+	itemsstore_->clear();
+	ContentsType::const_iterator it  = data.begin();
+	ContentsType::const_iterator end = data.end();
+	for (int rowindex = 0; it != end; ++it, ++rowindex) {
+		string const line = withFullPath ? *it : OnlyFilename(*it);
+		Gtk::TreeModel::iterator row = itemsstore_->append();
+		(*row)[listCol_] = line;
+		(*row)[listColIndex_] = rowindex;
+	}
+}
+
+} // namespace frontend
+} // namespace lyx
Index: GTexinfo.h
===================================================================
RCS file: GTexinfo.h
diff -N GTexinfo.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ GTexinfo.h	8 Oct 2004 16:40:02 -0000
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+/**
+ * \file GTexinfo.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 GTEXINFO_H
+#define GTEXINFO_H
+
+#include "ControlTexinfo.h"
+
+#include "GViewBase.h"
+
+#include <map>
+
+namespace lyx {
+namespace frontend {
+
+class GTexinfo
+	: public GViewCB<ControlTexinfo, GViewGladeB> {
+public:
+
+	GTexinfo(Dialog &);
+private:
+	// not needed
+	virtual void apply() {}
+	// Build the dialog.
+	virtual void doBuild();
+	// not needed
+	virtual void update() {}
+
+	void updateStyles();
+
+	ControlTexinfo::texFileSuffix activeStyle;
+
+	Gtk::TreeView * itemsview_;
+	Gtk::ComboBox * typecombo_;
+	Gtk::TreeModelColumn<Glib::ustring> listCol_;
+	Gtk::TreeModelColumn<unsigned int> listColIndex_;
+	Gtk::TreeModel::ColumnRecord listCols_;
+	Glib::RefPtr<Gtk::ListStore> itemsstore_;
+	Glib::RefPtr<Gtk::ListStore> typestore_;
+	Glib::RefPtr<Gtk::TreeSelection> listSel_;
+	
+	Gtk::CheckButton * fullpathcheck_;
+	
+	void onTypeComboChanged();
+ 	void onItemActivate(Gtk::TreeModel::Path const & path, Gtk::TreeViewColumn * col);
+	void onRefresh();
+
+	typedef std::vector<std::string> ContentsType;
+	std::map<ControlTexinfo::texFileSuffix, ContentsType> texdata_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GTEXINFO_H
Index: Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/Makefile.am,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile.am
--- Makefile.am	8 Oct 2004 14:59:17 -0000	1.24
+++ Makefile.am	8 Oct 2004 16:40:02 -0000
@@ -54,6 +54,8 @@ libgtk_la_SOURCES = \
 	GSpellchecker.h \
 	GTableCreate.C \
 	GTableCreate.h \
+	GTexinfo.C \
+	GTexinfo.h \
 	GText.C \
 	GText.h \
 	GTimeout.C \
@@ -124,7 +126,6 @@ xforms_objects = \
 	../xforms/forms_gettext.lo \
 	../xforms/FormShowFile.lo \
 	../xforms/FormTabular.lo \
-	../xforms/FormTexinfo.lo \
 	../xforms/FormText.lo \
 	../xforms/FormThesaurus.lo \
 	../xforms/FormVSpace.lo \
Index: glade/texinfo.glade
===================================================================
RCS file: glade/texinfo.glade
diff -N glade/texinfo.glade
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ glade/texinfo.glade	8 Oct 2004 16:40:02 -0000
@@ -0,0 +1,218 @@
+<?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="title" translatable="yes">Lyx: LaTeX Information</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+  <property name="modal">False</property>
+  <property name="default_width">200</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="GtkVBox" id="vbox1">
+	  <property name="border_width">6</property>
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkHBox" id="hbox1">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkComboBox" id="Type">
+		  <property name="visible">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="FullPath">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes">Show the full path instead of just the file name</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Show Full _Path</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">6</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">6</property>
+	      <property name="expand">False</property>
+	      <property name="fill">True</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_ALWAYS</property>
+	      <property name="shadow_type">GTK_SHADOW_IN</property>
+	      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+	      <child>
+		<widget class="GtkTreeView" id="Items">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes">Double click to view contents of file</property>
+		  <property name="can_focus">True</property>
+		  <property name="headers_visible">False</property>
+		  <property name="rules_hint">False</property>
+		  <property name="reorderable">False</property>
+		  <property name="enable_search">True</property>
+		</widget>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="Refresh">
+	      <property name="visible">True</property>
+	      <property name="tooltip" translatable="yes">Build new file lists</property>
+	      <property name="can_focus">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment2">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">0</property>
+		  <property name="yscale">0</property>
+		  <property name="top_padding">0</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">0</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox4">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">2</property>
+
+		      <child>
+			<widget class="GtkImage" id="image2">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-refresh</property>
+			  <property name="icon_size">4</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label2">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Refresh List</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">6</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </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>

Reply via email to