And the patch...
Index: src/LyXAction.C
===================================================================
--- src/LyXAction.C	(Revision 15688)
+++ src/LyXAction.C	(Arbeitskopie)
@@ -366,6 +366,8 @@ void LyXAction::init()
 		{ LFUN_WINDOW_NEW, "window-new", NoBuffer },
 		{ LFUN_WINDOW_CLOSE, "window-close", NoBuffer },
 		{ LFUN_UNICODE_INSERT, "unicode-insert", Noop },
+		{ LFUN_NOMENCL_INSERT, "nomencl-insert", Noop },
+		{ LFUN_NOMENCL_PRINT, "nomencl-print", Noop },
 		
 		{ LFUN_NOACTION, "", Noop }
 	};
Index: src/LaTeXFeatures.C
===================================================================
--- src/LaTeXFeatures.C	(Revision 15688)
+++ src/LaTeXFeatures.C	(Arbeitskopie)
@@ -386,6 +386,11 @@ string const LaTeXFeatures::getPackages(
 	if (isRequired("xy"))
 		packages << "\\usepackage[all]{xy}\n";
 
+	if (isRequired("nomencl")) {
+		packages << "\\usepackage{nomencl}\n"
+			 << "\\makeglossary\n";
+	}
+ 
 	return packages.str();
 }
 
Index: src/insets/insetnomencl.h
===================================================================
--- src/insets/insetnomencl.h	(Revision 0)
+++ src/insets/insetnomencl.h	(Revision 0)
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+/**
+ * \file insetnomencl.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author O. U. BARAN (derived from Index counterpart of Lars Gullik Bjønnes. Thanks Lars)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef INSET_NOMENCL_H
+#define INSET_NOMENCL_H
+
+
+#include "insetcommand.h"
+
+
+namespace lyx {
+
+class LaTeXFeatures;
+
+/** Used to insert notation labels
+  */
+class InsetNomencl : public InsetCommand {
+public:
+	///
+	InsetNomencl(InsetCommandParams const &);
+	///
+	docstring const getScreenLabel(Buffer const &) const;
+	///
+	EDITABLE editable() const { return IS_EDITABLE; }
+	///
+	InsetBase::Code lyxCode() const;
+	///
+	int docbook(Buffer const &, odocstream &,
+		    OutputParams const &) const;
+private:
+	virtual std::auto_ptr<InsetBase> doClone() const {
+		return std::auto_ptr<InsetBase>(new InsetNomencl(params()));
+	}
+};
+
+
+class InsetPrintNomencl : public InsetCommand {
+public:
+	///
+	InsetPrintNomencl(InsetCommandParams const &);
+	/// Updates needed features for this inset.
+	void validate(LaTeXFeatures & features) const;
+	///
+	EDITABLE editable() const { return NOT_EDITABLE; }
+	///
+	InsetBase::Code lyxCode() const;
+	///
+	bool display() const { return true; }
+	///
+	docstring const getScreenLabel(Buffer const &) const;
+private:
+	virtual std::auto_ptr<InsetBase> doClone() const {
+		return std::auto_ptr<InsetBase>(new InsetPrintNomencl(params()));
+	}
+};
+
+
+} // namespace lyx
+
+#endif
Index: src/insets/insetbase.h
===================================================================
--- src/insets/insetbase.h	(Revision 15688)
+++ src/insets/insetbase.h	(Arbeitskopie)
@@ -322,7 +322,11 @@ public:
 		///
 		VSPACE_CODE,
 		///
-		MATHMACROARG_CODE
+		MATHMACROARG_CODE,
+		///
+		NOMENCL_CODE, // 45
+		///
+		NOMENCL_PRINT_CODE
 	};
 
 	/** returns the Code corresponding to the \c name.
Index: src/insets/insetcommandparams.C
===================================================================
--- src/insets/insetcommandparams.C	(Revision 15688)
+++ src/insets/insetcommandparams.C	(Arbeitskopie)
@@ -109,14 +109,23 @@ InsetCommandParams::findInfo(std::string
 		return &info;
 	}
 
-	// InsetIndex, InsetPrintIndex, InsetLabel
-	if (name == "index" || name == "printindex" || name == "label") {
+	// InsetIndex, InsetPrintIndex, InsetLabel, InsetPrintNomencl
+	if (name == "index" || name == "printindex" || name == "label" ||
+	    name == "printglossary") {
 		static const char * const paramnames[] = {"name", ""};
 		static const bool isoptional[] = {false};
 		static const CommandInfo info = {1, paramnames, isoptional};
 		return &info;
 	}
 
+	// InsetNomencl
+	if (name == "nomenclature") {
+		static const char * const paramnames[] = {"name", "explanation", "sortas", ""};
+		static const bool isoptional[] = {false, false, true};
+		static const CommandInfo info = {3, paramnames, isoptional};
+		return &info;
+	}
+
 	// InsetRef
 	if (name == "eqref" || name == "pageref" || name == "vpageref" ||
 	    name == "vref" || name == "prettyref" || name == "ref") {
Index: src/insets/insetnomencl.C
===================================================================
--- src/insets/insetnomencl.C	(Revision 0)
+++ src/insets/insetnomencl.C	(Revision 0)
@@ -0,0 +1,76 @@
+/**
+ * \file insetnomencl.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author O. U. BARAN (derived from Index counterpart of Lars Gullik Bjønnes. Thanks Lars.)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+#include <config.h>
+
+#include "insetnomencl.h"
+
+#include "dispatchresult.h"
+#include "funcrequest.h"
+#include "gettext.h"
+#include "LaTeXFeatures.h"
+#include "metricsinfo.h"
+#include "sgml.h"
+
+
+namespace lyx {
+
+using std::string;
+
+
+InsetNomencl::InsetNomencl(InsetCommandParams const & p)
+	: InsetCommand(p, "nomenclature")
+{}
+
+
+docstring const InsetNomencl::getScreenLabel(Buffer const &) const
+{
+	return _("Not");
+}
+
+
+int InsetNomencl::docbook(Buffer const &, odocstream & os,
+			OutputParams const &) const
+{
+/*	os << "<indexterm><primary>" << sgml::escapeString(getContents())
+	   << "</primary></indexterm>";*/
+	return 0;
+}
+
+
+InsetBase::Code InsetNomencl::lyxCode() const
+{
+	return InsetBase::NOMENCL_CODE;
+}
+
+
+InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
+	: InsetCommand(p, string())
+{}
+
+
+docstring const InsetPrintNomencl::getScreenLabel(Buffer const &) const
+{
+	return _("Notation");
+}
+
+
+void InsetPrintNomencl::validate(LaTeXFeatures & features) const
+{
+	features.require("nomencl");
+}
+
+
+InsetBase::Code InsetPrintNomencl::lyxCode() const
+{
+	return InsetBase::NOMENCL_PRINT_CODE;
+}
+
+
+} // namespace lyx
Index: src/insets/insetbase.C
===================================================================
--- src/insets/insetbase.C	(Revision 15688)
+++ src/insets/insetbase.C	(Arbeitskopie)
@@ -63,6 +63,7 @@ static TranslatorMap const build_transla
 		InsetName("accent", InsetBase::ACCENT_CODE),
 		InsetName("math", InsetBase::MATH_CODE),
 		InsetName("index", InsetBase::INDEX_CODE),
+		InsetName("nomenclature", InsetBase::NOMENCL_CODE),
 		InsetName("include", InsetBase::INCLUDE_CODE),
 		InsetName("graphics", InsetBase::GRAPHICS_CODE),
 		InsetName("bibitem", InsetBase::BIBITEM_CODE),
@@ -81,6 +82,7 @@ static TranslatorMap const build_transla
 		InsetName("cite", InsetBase::CITE_CODE),
 		InsetName("float_list", InsetBase::FLOAT_LIST_CODE),
 		InsetName("index_print", InsetBase::INDEX_PRINT_CODE),
+		InsetName("nomencl_print", InsetBase::NOMENCL_PRINT_CODE),
 		InsetName("optarg", InsetBase::OPTARG_CODE),
 		InsetName("environment", InsetBase::ENVIRONMENT_CODE),
 		InsetName("hfill", InsetBase::HFILL_CODE),
Index: src/insets/Makefile.am
===================================================================
--- src/insets/Makefile.am	(Revision 15688)
+++ src/insets/Makefile.am	(Arbeitskopie)
@@ -85,6 +85,8 @@ libinsets_la_SOURCES = \
 	insetmarginal.C \
 	insetnewline.C \
 	insetnewline.h \
+	insetnomencl.C \
+	insetnomencl.h \
 	insetnote.C \
 	insetnote.h \
 	insetoptarg.C \
Index: src/factory.C
===================================================================
--- src/factory.C	(Revision 15688)
+++ src/factory.C	(Arbeitskopie)
@@ -37,6 +37,7 @@
 #include "insets/insethfill.h"
 #include "insets/insetinclude.h"
 #include "insets/insetindex.h"
+#include "insets/insetnomencl.h"
 #include "insets/insetlabel.h"
 #include "insets/insetline.h"
 #include "insets/insetmarginal.h"
@@ -171,6 +172,11 @@ InsetBase * createInset(BufferView * bv,
 		return new InsetIndex(icp);
 	}
 
+	case LFUN_NOMENCL_INSERT: {
+		InsetCommandParams icp("nomenclature");
+		return new InsetNomencl(icp);
+	}
+
 	case LFUN_TABULAR_INSERT: {
 		if (cmd.argument().empty())
 			return 0;
@@ -195,6 +201,9 @@ InsetBase * createInset(BufferView * bv,
 	case LFUN_INDEX_PRINT:
 		return new InsetPrintIndex(InsetCommandParams("printindex"));
 
+	case LFUN_NOMENCL_PRINT:
+		return new InsetPrintNomencl(InsetCommandParams("printglossary"));
+
 	case LFUN_TOC_INSERT:
 		return new InsetTOC(InsetCommandParams("tableofcontents"));
 
@@ -264,6 +273,12 @@ InsetBase * createInset(BufferView * bv,
 							  icp);
 			return new InsetIndex(icp);
 
+		} else if (name == "nomenclature") {
+			InsetCommandParams icp(name);
+			InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
+							  icp);
+			return new InsetNomencl(icp);
+
 		} else if (name == "label") {
 			InsetCommandParams icp(name);
 			InsetCommandMailer::string2params(name, to_utf8(cmd.argument()),
@@ -369,6 +384,8 @@ InsetBase * readInset(LyXLex & lex, Buff
 			inset.reset(new InsetBibtex(inscmd));
 		} else if (cmdName == "index") {
 			inset.reset(new InsetIndex(inscmd));
+		} else if (cmdName == "nomenclature") {
+			inset.reset(new InsetNomencl(inscmd));
 		} else if (cmdName == "include") {
 			inset.reset(new InsetInclude(inscmd));
 		} else if (cmdName == "label") {
@@ -396,6 +413,8 @@ InsetBase * readInset(LyXLex & lex, Buff
 			inset.reset(new InsetFloatList("table"));
 		} else if (cmdName == "printindex") {
 			inset.reset(new InsetPrintIndex(inscmd));
+		} else if (cmdName == "printglossary") {
+			inset.reset(new InsetPrintNomencl(inscmd));
 		} else {
 			lyxerr << "unknown CommandInset '" << cmdName
 			       << "'" << std::endl;
Index: src/buffer.C
===================================================================
--- src/buffer.C	(Revision 15688)
+++ src/buffer.C	(Arbeitskopie)
@@ -142,7 +142,7 @@ using std::string;
 
 namespace {
 
-int const LYX_FORMAT = 252;
+int const LYX_FORMAT = 253;
 
 } // namespace anon
 
Index: src/lyxfunc.C
===================================================================
--- src/lyxfunc.C	(Revision 15688)
+++ src/lyxfunc.C	(Arbeitskopie)
@@ -1249,6 +1249,7 @@ void LyXFunc::dispatch(FuncRequest const
 			    name == "label" ||
 			    name == "ref" ||
 			    name == "toc" ||
+			    name == "nomenclature" ||
 			    name == "url") {
 				InsetCommandParams p(name);
 				data = InsetCommandMailer::params2string(name, p);
@@ -1341,6 +1342,10 @@ void LyXFunc::dispatch(FuncRequest const
 				dispatch(FuncRequest(LFUN_DIALOG_SHOW, "citation"));
 			break;
 		}
+		case LFUN_NOMENCL_INSERT: {
+			dispatch(FuncRequest(LFUN_DIALOG_SHOW_NEW_INSET, "nomenclature"));
+			break;
+		}
 
 		case LFUN_BUFFER_CHILD_OPEN: {
 			BOOST_ASSERT(lyx_view_);
Index: src/LaTeX.C
===================================================================
--- src/LaTeX.C	(Revision 15688)
+++ src/LaTeX.C	(Arbeitskopie)
@@ -158,6 +158,10 @@ void LaTeX::deleteFilesOnError() const
 	string const ind = changeExtension(ofname, ".ind");
 	unlink(ind);
 
+	// nomencl file
+	string const gls = changeExtension(ofname, ".gls");
+	unlink(gls);
+
 	// Also remove the aux file
 	string const aux = changeExtension(ofname, ".aux");
 	unlink(aux);
@@ -283,6 +287,12 @@ int LaTeX::run(TeXErrors & terr)
 		message(_("Running MakeIndex."));
 		rerun |= runMakeIndex(onlyFilename(changeExtension(file, ".idx")), runparams);
 	}
+	if (head.haschanged(onlyFilename(changeExtension(file, ".glo")))) {
+		lyxerr[Debug::LATEX] << "Running MakeIndex for nomencl." << endl;
+		message(_("Running Makeindex for nomencl."));
+		string const nomenclstr = " -s nomencl.ist -o " + changeExtension(file, ".gls");
+		rerun |= runMakeIndex(onlyFilename(changeExtension(file, ".glo")), runparams, nomenclstr);
+	}
 
 	// run bibtex
 	// if (scanres & UNDEF_CIT || scanres & RERUN || run_bibtex)
@@ -352,6 +362,14 @@ int LaTeX::run(TeXErrors & terr)
 		rerun = runMakeIndex(onlyFilename(changeExtension(file, ".idx")), runparams);
 	}
 
+	// I am not pretty sure if need this twice. 
+	if (head.haschanged(onlyFilename(changeExtension(file, ".glo")))) {
+		lyxerr[Debug::LATEX] << "Running MakeIndex for nomencl." << endl;
+		message(_("Running Makeindex for nomencl. "));
+		string nomenclstr = " -s nomencl.ist -o " + changeExtension(file, ".gls");
+		rerun |= runMakeIndex(onlyFilename(changeExtension(file, ".glo")), runparams, nomenclstr);
+	}
+
 	// 2
 	// we will only run latex more if the log file asks for it.
 	// or if the sumchange() is true.
@@ -396,13 +414,17 @@ int LaTeX::startscript()
 }
 
 
-bool LaTeX::runMakeIndex(string const & f, OutputParams const & runparams)
+bool LaTeX::runMakeIndex(string const & f, OutputParams const & runparams,
+                         string const & params)
 {
-	lyxerr[Debug::LATEX] << "idx file has been made,"
-		" running makeindex on file " <<  f << endl;
-	string tmp = lyxrc.index_command + " ";
+	lyxerr[Debug::LATEX]
+		<< "idx file has been made, running makeindex on file "
+		<< f << endl;
+	string tmp = lyxrc.index_command + ' ';
+	
 	tmp = subst(tmp, "$$lang", runparams.document_language);
 	tmp += quoteName(f);
+	tmp += params;
 	Systemcall one;
 	one.startscript(Systemcall::Wait, tmp);
 	return true;
@@ -712,7 +734,7 @@ void handleFoundFile(string const & ff, 
 	// (2) foundfile is in the tmpdir
 	//     insert it into head
 	if (fs::exists(onlyfile)) {
-		static regex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$");
+		static regex unwanted("^.*\\.(aux|log|dvi|bbl|ind)$");
 		if (regex_match(onlyfile, unwanted)) {
 			lyxerr[Debug::DEPEND]
 				<< "We don't want "
@@ -761,6 +783,7 @@ void LaTeX::deplog(DepTable & head)
 	// but instead only a line like this into the log:
 	//   Writing index file sample.idx
 	static regex reg5("Writing index file ([^ ]+).*");
+	static regex regnomencl("Writing glossary file ([^ ]+).*");
 	// If a toc should be created, MikTex does not write a line like
 	//    \openout# = `sample.toc'.
 	// but only a line like this into the log:
@@ -809,6 +832,8 @@ void LaTeX::deplog(DepTable & head)
 			handleFoundFile(sub.str(1), head);
 		else if (regex_match(token, sub, reg5))
 			handleFoundFile(sub.str(1), head);
+		else if (regex_match(token, sub, regnomencl))
+			handleFoundFile(sub.str(1), head);
 		else if (regex_match(token, sub, miktexTocReg))
 			handleFoundFile(changeExtension(file, ".toc"), head);
 	}
Index: src/frontends/qt4/QNomenclDialog.h
===================================================================
--- src/frontends/qt4/QNomenclDialog.h	(Revision 0)
+++ src/frontends/qt4/QNomenclDialog.h	(Revision 0)
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+/**
+ * \file QNomenclDialog.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author O. U. BARAN (derived from Index counterpart of John Levon. Thanks John)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef QNOMENCLDIALOG_H
+#define QNOMENCLDIALOG_H
+
+#include "ui/QNomenclUi.h"
+
+#include <QDialog>
+#include <QCloseEvent>
+
+namespace lyx {
+namespace frontend {
+
+class QNomencl;
+
+class QNomenclDialog : public QDialog, public Ui::QNomenclUi {
+	Q_OBJECT
+public:
+	QNomenclDialog(QNomencl * form);
+	virtual void show();
+protected Q_SLOTS:
+	virtual void change_adaptor();
+	virtual void reject();
+protected:
+	virtual void closeEvent(QCloseEvent * e);
+private:
+	QNomencl * form_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // QNOMENCLDIALOG_H
Index: src/frontends/qt4/Makefile.dialogs
===================================================================
--- src/frontends/qt4/Makefile.dialogs	(Revision 15688)
+++ src/frontends/qt4/Makefile.dialogs	(Arbeitskopie)
@@ -37,6 +37,7 @@ UIFILES = \
 	QViewSourceUi.ui \
 	QMathUi.ui \
 	QMathMatrixUi.ui \
+	QNomenclUi.ui \
 	QNoteUi.ui \
 	QParagraphUi.ui \
 	QPrefAsciiUi.ui \
@@ -114,6 +115,7 @@ MOCFILES = \
 	QLPrintDialog.C QLPrintDialog.h \
 	QMathDialog.C QMathDialog.h \
 	QMathMatrixDialog.C QMathMatrixDialog.h \
+	QNomenclDialog.C QNomenclDialog.h \
 	QNoteDialog.C QNoteDialog.h \
 	QParagraphDialog.C QParagraphDialog.h \
 	QPrefsDialog.C QPrefsDialog.h \
Index: src/frontends/qt4/Makefile.am
===================================================================
--- src/frontends/qt4/Makefile.am	(Revision 15688)
+++ src/frontends/qt4/Makefile.am	(Arbeitskopie)
@@ -64,6 +64,7 @@ libqt4_la_SOURCES = \
 	QLPainter.C QLPainter.h \
 	QLyXKeySym.C QLyXKeySym.h \
 	QMath.C QMath.h \
+	QNomencl.C QNomencl.h \
 	QNote.C QNote.h \
 	QParagraph.C QParagraph.h \
 	QPrefs.C QPrefs.h \
Index: src/frontends/qt4/ui/QNomenclUi.ui
===================================================================
--- src/frontends/qt4/ui/QNomenclUi.ui	(Revision 0)
+++ src/frontends/qt4/ui/QNomenclUi.ui	(Revision 0)
@@ -0,0 +1,150 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>QNomenclUi</class>
+ <widget class="QDialog" name="QNomenclUi" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>260</width>
+    <height>170</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>QNomenclDialogBase</string>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>true</bool>
+  </property>
+  <widget class="QWidget" name="layout4" >
+   <property name="geometry" >
+    <rect>
+     <x>10</x>
+     <y>11</y>
+     <width>240</width>
+     <height>149</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" >
+    <property name="margin" >
+     <number>0</number>
+    </property>
+    <property name="spacing" >
+     <number>6</number>
+    </property>
+    <item>
+     <layout class="QGridLayout" >
+      <property name="margin" >
+       <number>0</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <item row="0" column="0" >
+       <widget class="QLabel" name="keywordLA" >
+        <property name="text" >
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0" >
+       <widget class="QLabel" name="expLA" >
+        <property name="text" >
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" >
+       <widget class="QLabel" name="sortasLA" >
+        <property name="text" >
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1" >
+       <widget class="QLineEdit" name="keywordED" >
+        <property name="toolTip" >
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1" >
+       <widget class="QLineEdit" name="expED" />
+      </item>
+      <item row="2" column="1" >
+       <widget class="QLineEdit" name="sortasED" />
+      </item>
+     </layout>
+    </item>
+    <item>
+     <spacer>
+      <property name="orientation" >
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeType" >
+       <enum>QSizePolicy::Expanding</enum>
+      </property>
+      <property name="sizeHint" >
+       <size>
+        <width>20</width>
+        <height>16</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" >
+      <property name="margin" >
+       <number>0</number>
+      </property>
+      <property name="spacing" >
+       <number>6</number>
+      </property>
+      <item>
+       <spacer>
+        <property name="orientation" >
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeType" >
+         <enum>QSizePolicy::Expanding</enum>
+        </property>
+        <property name="sizeHint" >
+         <size>
+          <width>20</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QPushButton" name="okPB" >
+        <property name="text" >
+         <string>&amp;OK</string>
+        </property>
+        <property name="shortcut" >
+         <string>Alt+O</string>
+        </property>
+        <property name="default" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="closePB" >
+        <property name="text" >
+         <string>Cancel</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
Index: src/frontends/qt4/QNomencl.C
===================================================================
--- src/frontends/qt4/QNomencl.C	(Revision 0)
+++ src/frontends/qt4/QNomencl.C	(Revision 0)
@@ -0,0 +1,79 @@
+/**
+ * \file QNomencl.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author O. U. BARAN (derived from Index counterpart of John Levon. Thanks John)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "debug.h"
+#include "ControlCommand.h"
+#include "qt_helpers.h"
+
+#include "QNomenclDialog.h"
+#include "QNomencl.h"
+#include "Qt2BC.h"
+#include "ButtonController.h"
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+typedef QController<ControlCommand, QView<QNomenclDialog> > base_class;
+
+
+QNomencl::QNomencl(Dialog & parent, docstring const & title, QString const & label)
+	: base_class(parent, title), label_(label)
+{
+}
+
+
+void QNomencl::build_dialog()
+{
+	dialog_.reset(new QNomenclDialog(this));
+
+	dialog_->keywordLA->setText(label_);
+	dialog_->expLA->setText(qt_("Explanation:"));
+	dialog_->sortasLA->setText(qt_("SortAs:"));
+
+	bcview().setOK(dialog_->okPB);
+	bcview().setCancel(dialog_->closePB);
+	bcview().addReadOnly(dialog_->keywordED);
+	bcview().addReadOnly(dialog_->expED);
+	bcview().addReadOnly(dialog_->sortasED);
+}
+
+
+void QNomencl::update_contents()
+{
+	dialog_->keywordED->setText(toqstr(controller().params()["name"]));
+	dialog_->expED->setText(toqstr(controller().params()["explanation"]));
+	dialog_->sortasED->setText(toqstr(controller().params()["sortas"]));
+
+	bc().valid(isValid());
+}
+
+
+void QNomencl::apply()
+{
+	controller().params()["name"] = qstring_to_ucs4(dialog_->keywordED->text());
+	controller().params()["explanation"] = qstring_to_ucs4(dialog_->expED->text());
+	controller().params()["sortas"] = qstring_to_ucs4(dialog_->sortasED->text());
+}
+
+
+bool QNomencl::isValid()
+{
+	return (!dialog_->keywordED->text().isEmpty() && !dialog_->expED->text().isEmpty() );
+}
+
+} // namespace frontend
+} // namespace lyx
Index: src/frontends/qt4/QNomencl.h
===================================================================
--- src/frontends/qt4/QNomencl.h	(Revision 0)
+++ src/frontends/qt4/QNomencl.h	(Revision 0)
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+/**
+ * \file QNomencl.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author O. U. BARAN (derived from Index counterpart of John Levon and Kalle Dalheimer. Thanks Guys)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef QNOMENCL_H
+#define QNOMENCL_H
+
+#include "QDialogView.h"
+
+namespace lyx {
+namespace frontend {
+
+class ControlCommand;
+class QNomenclDialog;
+
+
+class QNomencl :
+	public QController<ControlCommand, QView<QNomenclDialog> >
+{
+public:
+	friend class QNomenclDialog;
+
+	QNomencl(Dialog &, lyx::docstring const & title, QString const & label);
+protected:
+	virtual bool isValid();
+private:
+	/// Apply changes
+	virtual void apply();
+	/// update
+	virtual void update_contents();
+	/// build the dialog
+	virtual void build_dialog();
+	///
+	QString const label_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // QNOMENCL_H
Index: src/frontends/qt4/QNomenclDialog.C
===================================================================
--- src/frontends/qt4/QNomenclDialog.C	(Revision 0)
+++ src/frontends/qt4/QNomenclDialog.C	(Revision 0)
@@ -0,0 +1,69 @@
+/**
+ * \file QNomenclDialog.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author O. U. BARAN (derived from Index counterpart of John Levon. Thanks John)
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "qt_helpers.h"
+
+#include "QNomencl.h"
+#include "QNomenclDialog.h"
+
+#include <QPushButton>
+#include <QLineEdit>
+#include <QWhatsThis>
+#include <QCloseEvent>
+
+namespace lyx {
+namespace frontend {
+
+QNomenclDialog::QNomenclDialog(QNomencl * form)
+	: form_(form)
+{
+	setupUi(this);
+
+	connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
+	connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
+	connect(keywordED, SIGNAL(textChanged(const QString&)),
+	        this, SLOT(change_adaptor()));
+	connect(expED, SIGNAL(textChanged(const QString&)),
+	        this, SLOT(change_adaptor()));
+
+}
+
+
+void QNomenclDialog::show()
+{
+	QDialog::show();
+	keywordED->setFocus();
+}
+
+
+void QNomenclDialog::change_adaptor()
+{
+	form_->changed();
+}
+
+
+void QNomenclDialog::reject()
+{
+	form_->slotClose();
+}
+
+
+void QNomenclDialog::closeEvent(QCloseEvent * e)
+{
+	form_->slotWMHide();
+	e->accept();
+}
+
+} // namespace frontend
+} // namespace lyx
+
+#include "QNomenclDialog_moc.cpp"
Index: src/frontends/qt4/Dialogs.C
===================================================================
--- src/frontends/qt4/Dialogs.C	(Revision 15688)
+++ src/frontends/qt4/Dialogs.C	(Arbeitskopie)
@@ -61,6 +61,7 @@
 #include "QGraphics.h"
 #include "QInclude.h"
 #include "QIndex.h"
+#include "QNomencl.h"
 #include "QLog.h"
 #include "QViewSource.h"
 #include "QMath.h"
@@ -101,7 +102,7 @@ namespace {
 char const * const dialognames[] = {
 "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
 "citation", "document", "errorlist", "ert", "external", "file",
-"findreplace", "float", "graphics", "include", "index", "label", "log", "view-source",
+"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
 "mathpanel", "mathdelimiter", "mathmatrix", "note", "paragraph",
 "prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
 
@@ -109,7 +110,7 @@ char const * const dialognames[] = {
 "thesaurus",
 #endif
 
-"texinfo", "toc", "url", "vspace", "wrap" };
+"texinfo", "toc", "url", "view-source", "vspace", "wrap" };
 
 char const * const * const end_dialognames =
 	dialognames + (sizeof(dialognames) / sizeof(char *));
@@ -219,6 +220,12 @@ Dialogs::DialogPtr Dialogs::build(string
 					   _("Index Entry"),
 					   qt_("&Keyword:")));
 		dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
+	} else if (name == "nomenclature") {
+		dialog->setController(new ControlCommand(*dialog, name, name));
+		dialog->setView(new QNomencl(*dialog,
+					   _("Notation Entry"),
+					   qt_("&Keyword:")));
+		dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
 	} else if (name == "label") {
 		dialog->setController(new ControlCommand(*dialog, name, name));
 		dialog->setView(new QIndex(*dialog,
Index: src/text3.C
===================================================================
--- src/text3.C	(Revision 15688)
+++ src/text3.C	(Arbeitskopie)
@@ -1174,6 +1174,7 @@ void LyXText::dispatch(LCursor & cur, Fu
 	}
 
 	case LFUN_INDEX_PRINT:
+	case LFUN_NOMENCL_PRINT:
 	case LFUN_TOC_INSERT:
 	case LFUN_HFILL_INSERT:
 	case LFUN_LINE_INSERT:
@@ -1550,6 +1551,8 @@ bool LyXText::getStatus(LCursor & cur, F
 			code = InsetBase::INCLUDE_CODE;
 		else if (cmd.argument() == "index")
 			code = InsetBase::INDEX_CODE;
+		else if (cmd.argument() == "nomenclature")
+			code = InsetBase::NOMENCL_CODE;
 		else if (cmd.argument() == "label")
 			code = InsetBase::LABEL_CODE;
 		else if (cmd.argument() == "note")
@@ -1632,6 +1635,12 @@ bool LyXText::getStatus(LCursor & cur, F
 	case LFUN_INDEX_PRINT:
 		code = InsetBase::INDEX_PRINT_CODE;
 		break;
+	case LFUN_NOMENCL_INSERT:
+		code = InsetBase::NOMENCL_CODE;
+		break;
+	case LFUN_NOMENCL_PRINT:
+		code = InsetBase::NOMENCL_PRINT_CODE;
+		break;
 	case LFUN_TOC_INSERT:
 		code = InsetBase::TOC_CODE;
 		break;
Index: src/LaTeX.h
===================================================================
--- src/LaTeX.h	(Revision 15688)
+++ src/LaTeX.h	(Arbeitskopie)
@@ -161,7 +161,8 @@ private:
 	void deplog(DepTable & head);
 
 	///
-	bool runMakeIndex(std::string const &, OutputParams const &);
+	bool runMakeIndex(std::string const &, OutputParams const &,
+	                  std::string const & = std::string());
 
 	///
 	std::vector<Aux_Info> const scanAuxFiles(std::string const &);
Index: src/lfuns.h
===================================================================
--- src/lfuns.h	(Revision 15688)
+++ src/lfuns.h	(Arbeitskopie)
@@ -374,7 +374,9 @@ enum kb_action {
 	LFUN_UNICODE_INSERT,             // Lgb 20061022
 	// 285
 	LFUN_BOOKMARK_CLEAR,             // bpeng 20061031
-	
+	LFUN_NOMENCL_INSERT,			// Ugras
+	LFUN_NOMENCL_PRINT,			// Ugras
+
 	LFUN_LASTACTION                  // end of the table
 };
 
Index: lib/lyx2lyx/LyX.py
===================================================================
--- lib/lyx2lyx/LyX.py	(Revision 15688)
+++ lib/lyx2lyx/LyX.py	(Arbeitskopie)
@@ -73,7 +73,7 @@ format_relation = [("0_06",    [200], ge
                    ("1_2",     [220], generate_minor_versions("1.2" , 4)),
                    ("1_3",     [221], generate_minor_versions("1.3" , 7)),
                    ("1_4", range(222,246), generate_minor_versions("1.4" , 3)),
-                   ("1_5", range(246,253), generate_minor_versions("1.5" , 0))]
+                   ("1_5", range(246,254), generate_minor_versions("1.5" , 0))]
 
 
 def formats_list():
Index: lib/lyx2lyx/lyx_1_5.py
===================================================================
--- lib/lyx2lyx/lyx_1_5.py	(Revision 15688)
+++ lib/lyx2lyx/lyx_1_5.py	(Arbeitskopie)
@@ -488,6 +488,56 @@ def revert_commandparams(document):
         i = j + 1
 
 
+def revert_nomencl(document):
+    regex = re.compile(r'(\S+)\s+(.+)')
+    i = 0
+    use_nomencl = 0
+    while 1:
+        i = find_token(document.body, "\\begin_inset LatexCommand nomencl", i)
+        if i == -1:
+            break
+        use_nomencl = 1
+        j = find_end_of_inset(document.body, i + 1)
+        preview_line = ""
+        name = ""
+        explanation = ""
+        sortas = ""
+        for k in range(i + 1, j):
+            match = re.match(regex, document.body[k])
+            if match:
+                pname = match.group(1)
+                pvalue = match.group(2)
+                if pname == "preview":
+                    preview_line = document.body[k]
+                elif pname == "name":
+                    name = pvalue.strip('"').replace('\\"', '"')
+                elif pname == "explanation":
+                    explanation = pvalue.strip('"').replace('\\"', '"')
+                elif pname == "sortas":
+                    sortas = pvalue.strip('"').replace('\\"', '"')
+            elif document.body[k].strip() != "":
+                document.warning("Ignoring unknown contents `%s' in nomencl inset." % document.body[k]))
+        if sortas == "":
+            command = 'nomenclature{%s}{%s}' % (name, explanation)
+        else:
+            command = 'nomenclature[%s]{%s}{%s}' % (sortas, name, explanation)
+        document.body[i:j+1] = ['\\begin_inset ERT',
+                                'status collapsed',
+                                '',
+                                '\\begin_layout %s' % document.default_layout,
+                                '',
+                                '',
+                                '\\backslash',
+                                command,
+                                '\\end_layout',
+                                '',
+                                '\\end_inset']
+        i = i + 11
+    if use_nomencl:
+        document.preamble.append('\\usepackage{nomencl}')
+        document.preamble.append('\\makeglossary')
+
+
 ##
 # Conversion hub
 #
@@ -499,9 +549,11 @@ convert = [[246, []],
            [249, [convert_utf8]],
            [250, []],
            [251, []],
-           [252, [convert_commandparams, convert_bibitem]]]
+           [252, [convert_commandparams, convert_bibitem]],
+           [253, []]]
 
-revert =  [[251, [revert_commandparams]],
+revert =  [[252, [revert_nomencl]],
+           [251, [revert_commandparams]],
            [250, [revert_cs_label]],
            [249, []],
            [248, [revert_utf8]],
Index: lib/ui/stdtoolbars.ui
===================================================================
--- lib/ui/stdtoolbars.ui	(Revision 15688)
+++ lib/ui/stdtoolbars.ui	(Arbeitskopie)
@@ -76,6 +76,7 @@ Toolbar "extra" "Extra"
 	Item "Insert cross-reference" "dialog-show-new-inset ref"
 	Item "Insert citation" "dialog-show-new-inset citation"
 	Item "Insert index entry" "index-insert"
+	Item "Insert notation entry" "nomencl-insert"
 	Separator
 	Item "Insert footnote" "footnote-insert"
 	Item "Insert margin note" "marginalnote-insert"
Index: lib/ui/classic.ui
===================================================================
--- lib/ui/classic.ui	(Revision 15688)
+++ lib/ui/classic.ui	(Arbeitskopie)
@@ -221,6 +221,7 @@ Menuset
 		Item "Marginal Note|M" "marginalnote-insert"
 		Item "Short Title" "optional-insert"
 		Item "Index Entry|I" "index-insert"
+		Item "Notation Entry" "nomencl-insert"
 		Item "URL...|U" "url-insert"
 		Item "Note|N" "note-insert"
 		Submenu "Lists & TOC|O" "insert_toc"
@@ -310,6 +311,7 @@ Menuset
 		Item "Table of Contents|C" "toc-insert"
 		FloatListInsert
 		Item "Index List|I" "index-print"
+		Item "Notation List|N" "nomencl-print"
 		Item "BibTeX Bibliography...|B" "dialog-show-new-inset bibtex"
 	End
 
Index: lib/ui/stdmenus.ui
===================================================================
--- lib/ui/stdmenus.ui	(Revision 15688)
+++ lib/ui/stdmenus.ui	(Arbeitskopie)
@@ -294,6 +294,7 @@ Menuset
 		Item "Cross-reference...|r" "dialog-show-new-inset ref"
 		Item "Label...|L" "label-insert"
 		Item "Index Entry|d" "index-insert"
+		Item "Notation Entry" "nomencl-insert"
 		Item "Date" "date-insert"
 # I'm going to kill this dumb dialog, but for now ...
 		Separator
@@ -363,6 +364,7 @@ Menuset
 		Item "Table of Contents|C" "toc-insert"
 		FloatListInsert
 		Item "Index List|I" "index-print"
+		Item "Notation List" "nomencl-print"
 		Item "BibTeX Bibliography...|B" "dialog-show-new-inset bibtex"
 	End
 
Index: development/scons/scons_manifest.py
===================================================================
--- development/scons/scons_manifest.py	(Revision 15688)
+++ development/scons/scons_manifest.py	(Arbeitskopie)
@@ -350,6 +350,7 @@ src_insets_header_files = Split('''
     insetline.h
     insetmarginal.h
     insetnewline.h
+    insetnomencl.h
     insetnote.h
     insetoptarg.h
     insetpagebreak.h
@@ -405,6 +406,7 @@ src_insets_files = Split('''
     insetline.C
     insetmarginal.C
     insetnewline.C
+    insetnomencl.C
     insetnote.C
     insetoptarg.C
     insetpagebreak.C
@@ -627,6 +629,7 @@ src_frontends_qt4_ui_files = Split('''
     QLogUi.ui
     QMathMatrixUi.ui
     QMathUi.ui
+    QNomenclUi.ui
     QNoteUi.ui
     QParagraphUi.ui
     QPrefAsciiUi.ui
@@ -706,6 +709,8 @@ src_frontends_qt4_moc_files = Split('''
     QLPrintDialog.C
     QMathDialog.C
     QMathMatrixDialog.C
+    QNomencl.C
+    QNomenclDialog.C
     QNoteDialog.C
     QParagraphDialog.C
     QPrefsDialog.C
@@ -798,6 +803,8 @@ src_frontends_qt4_header_files = Split('
     QMath.h
     QMathDialog.h
     QMathMatrixDialog.h
+    QNomencl.h
+    QNomenclDialog.h
     QNote.h
     QNoteDialog.h
     QParagraph.h
@@ -918,6 +925,8 @@ src_frontends_qt4_files = Split('''
     QMath.C
     QMathDialog.C
     QMathMatrixDialog.C
+    QNomencl.C
+    QNomenclDialog.C
     QNote.C
     QNoteDialog.C
     QParagraph.C
Index: development/FORMAT
===================================================================
--- development/FORMAT	(Revision 15688)
+++ development/FORMAT	(Arbeitskopie)
@@ -1,6 +1,10 @@
 LyX file-format changes
 -----------------------§
 
+2006-10-18  Georg Baum  <[EMAIL PROTECTED]>
+
+	* format incremented to 253: new nomenclature inset
+
 2006-10-15  Georg Baum  <[EMAIL PROTECTED]>
 
 	* format incremented to 252: changed command inset syntax
@@ -28,7 +32,6 @@ LyX file-format changes
 	The order of the parameters and for each parameter the name and
 	optional/required bit is now stored in InsetCommandParams.
 
-
 2006-10-03  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
 
 	* format incremented to 251: save show_label param for charstyles.

Reply via email to