New nomenclature inset from Ugras

* src/LyXAction.C
	(LyXAction::init): Add LFUN_NOMENCL_INSERT and LFUN_NOMENCL_PRINT

	* src/insets/insetbase.C
	(build_translator): ditto

	* src/LaTeXFeatures.C
	(LaTeXFeatures::getPackages): Add nomencl

	* src/insets/insetnomencl.[Ch]: new insets InsetNomencl and
	InsetPrintNomencl

	* src/insets/insetbase.h: Add NOMENCL_CODE and NOMENCL_PRINT_CODE

	* src/insets/insetcommandparams.C
	(InsetCommandParams::findInfo): Add nomenclature and printnomenclature
	(InsetCommandParams::getCommand): Extend end of command protection to
	cover commands with only optional arguments like printnomenclature

	* src/insets/insetert.C
	(InsetERT::getStatus): disable LFUN_NOMENCL_INSERT and
	LFUN_NOMENCL_PRINT

	* src/insets/Makefile.am: Add new files
	* src/frontends/qt4/Makefile.dialogs: ditto
	* src/frontends/qt4/Makefile.am: ditto

	* src/factory.C
	(createInset): Handle InsetNomencl and InsetPrintNomencl
	(readInset): ditto

	* src/buffer.C
	(LYX_FORMAT): increase

	* src/lyxfunc.C
	(LyXFunc::dispatch): Handle nomenclature

	* src/LaTeX.C
	(LaTeX::deleteFilesOnError): Delete .nls file
	(LaTeX::run): Run makeindex for nomenclature
	(LaTeX::runMakeIndex): handle nomenclature options
	(LaTeX::deplog): Recognize nomenclature file

	* src/frontends/qt4/QNomenclDialog.[Ch]: new
	* src/frontends/qt4/QNomencl.[Ch]: ditto
	* src/frontends/qt4/ui/QNomenclUi.ui: ditto

	* src/frontends/qt4/Dialogs.C
	(Dialogs::build): handle nomenclature dialog

	* src/text3.C
	(LyXText::dispatch): Handle LFUN_NOMENCL_INSERT and
	LFUN_NOMENCL_PRINT
	(LyXText::getStatus): Ditto

	* src/lfuns.h
	(kb_action): Add LFUN_NOMENCL_INSERT and LFUN_NOMENCL_PRINT

	* lib/lyx2lyx/LyX.py
	(format_relation): Update 1.5 format range

	* lib/lyx2lyx/lyx_1_5.py
	(revert_nomenclature): New
	(revert_printnomenclature): ditto

	* lib/chkconfig.ltx: Test for nomencl package

	* lib/doc/LaTeXConfig.lyx.in: Add nomencl package

	* lib/doc/Extended.lyx: Add documentation for nomencl

	* lib/ui/stdtoolbars.ui
	(Toolbar "extra" "Extra"): Add nomencl-insert

	* lib/ui/classic.ui: Add nomencl-insert and nomencl-print
	* lib/ui/stdmenus.ui: ditto

	* development/scons/scons_manifest.py: Add new files

	* development/FORMAT: Describe new format


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15739 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-11-04 17:55:36 +00:00
parent a4b0f284bb
commit e35725d5c0
34 changed files with 1130 additions and 20 deletions

View File

@ -1,6 +1,13 @@
LyX file-format changes LyX file-format changes
-----------------------§ -----------------------§
2006-10-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* format incremented to 253: new nomenclature and printnomenclature
insets. These are standard InsetCommand with the following parameters:
\nomenclature[prefix]{symbol}{description}
\printnomenclature[labelwidth]
2006-10-15 Georg Baum <Georg.Baum@post.rwth-aachen.de> 2006-10-15 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* format incremented to 252: changed command inset syntax * format incremented to 252: changed command inset syntax
@ -28,7 +35,6 @@ LyX file-format changes
The order of the parameters and for each parameter the name and The order of the parameters and for each parameter the name and
optional/required bit is now stored in InsetCommandParams. optional/required bit is now stored in InsetCommandParams.
2006-10-03 Jürgen Spitzmüller <j.spitzmueller@gmx.de> 2006-10-03 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* format incremented to 251: save show_label param for charstyles. * format incremented to 251: save show_label param for charstyles.

View File

@ -350,6 +350,7 @@ src_insets_header_files = Split('''
insetline.h insetline.h
insetmarginal.h insetmarginal.h
insetnewline.h insetnewline.h
insetnomencl.h
insetnote.h insetnote.h
insetoptarg.h insetoptarg.h
insetpagebreak.h insetpagebreak.h
@ -405,6 +406,7 @@ src_insets_files = Split('''
insetline.C insetline.C
insetmarginal.C insetmarginal.C
insetnewline.C insetnewline.C
insetnomencl.C
insetnote.C insetnote.C
insetoptarg.C insetoptarg.C
insetpagebreak.C insetpagebreak.C
@ -627,6 +629,7 @@ src_frontends_qt4_ui_files = Split('''
QLogUi.ui QLogUi.ui
QMathMatrixUi.ui QMathMatrixUi.ui
QMathUi.ui QMathUi.ui
QNomenclUi.ui
QNoteUi.ui QNoteUi.ui
QParagraphUi.ui QParagraphUi.ui
QPrefAsciiUi.ui QPrefAsciiUi.ui
@ -706,6 +709,8 @@ src_frontends_qt4_moc_files = Split('''
QLPrintDialog.C QLPrintDialog.C
QMathDialog.C QMathDialog.C
QMathMatrixDialog.C QMathMatrixDialog.C
QNomencl.C
QNomenclDialog.C
QNoteDialog.C QNoteDialog.C
QParagraphDialog.C QParagraphDialog.C
QPrefsDialog.C QPrefsDialog.C
@ -798,6 +803,8 @@ src_frontends_qt4_header_files = Split('''
QMath.h QMath.h
QMathDialog.h QMathDialog.h
QMathMatrixDialog.h QMathMatrixDialog.h
QNomencl.h
QNomenclDialog.h
QNote.h QNote.h
QNoteDialog.h QNoteDialog.h
QParagraph.h QParagraph.h
@ -918,6 +925,8 @@ src_frontends_qt4_files = Split('''
QMath.C QMath.C
QMathDialog.C QMathDialog.C
QMathMatrixDialog.C QMathMatrixDialog.C
QNomencl.C
QNomenclDialog.C
QNote.C QNote.C
QNoteDialog.C QNoteDialog.C
QParagraph.C QParagraph.C

View File

@ -223,6 +223,7 @@
\TestPackage{latex8} \TestPackage{latex8}
\TestPackage{longtable} \TestPackage{longtable}
\TestPackage{natbib} \TestPackage{natbib}
\TestPackage{nomencl}
\TestPackage{prettyref} \TestPackage{prettyref}
\TestPackage{preview} \TestPackage{preview}
\TestPackage{rotating} \TestPackage{rotating}

View File

@ -1,4 +1,4 @@
#LyX 1.4.2svn created this file. For more info see http://www.lyx.org/ #LyX 1.4.3 created this file. For more info see http://www.lyx.org/
\lyxformat 245 \lyxformat 245
\begin_document \begin_document
\begin_header \begin_header
@ -2668,6 +2668,299 @@ Be careful not to put spaces between the word in the text and the index
marker; apparently the wrong page number can be produced if this happens. marker; apparently the wrong page number can be produced if this happens.
\end_layout \end_layout
\begin_layout Section
Notation Lists
\end_layout
\begin_layout Standard
by
\noun on
Özgür U\i \~{g}
ra\i \c{s}
Baram
\end_layout
\begin_layout Standard
Sometimes you need to compile a list of symbols that are mentioned in your
document with a brief explanation of them.
A LaTeX package named
\family typewriter
nomencl
\family default
provides an easy way of compiling such lists.
\family typewriter
nomencl
\family default
is included in most standard Linux distributions.
If your distribution doesn't contain it, you should download it from a
CTAN mirror and install the package in order to use this feature of LyX.
\end_layout
\begin_layout Standard
A notation entry is created if you place the cursor after a symbol entry
and then use the menu
\family sans
Insert\SpecialChar \menuseparator
Notation\InsetSpace ~
Entry
\family default
.
A gray box labeled
\begin_inset Quotes eld
\end_inset
\family sans
Not
\family default
\begin_inset Quotes erd
\end_inset
is inserted and a window pops up asking for the notation entry.
A notation entry consists of two main entries.
The first is the symbol that you want to refer to.
You should enter a valid LaTeX code for the corresponding field in the
notation dialog.
The second is the description of the symbol.
You should fill the corresponding field to complete the notation entry.
\end_layout
\begin_layout Subsection
Sort Order of Notation Entries
\end_layout
\begin_layout Standard
Suppose you have two notation entries for the symbols
\begin_inset Formula $a$
\end_inset
and
\begin_inset Formula $\sigma$
\end_inset
.
The
\family typewriter
nomencl
\family default
package automatically sorts these two entries considering the symbol entry,
while printing the Notation List.
However, this can lead to an undesired sort order.
For the example given, the first entry appears as
\family typewriter
$a$
\family default
, while the second is
\family typewriter
$
\backslash
sigma$
\family default
.
Note that, in this case
\begin_inset Formula $\sigma$
\end_inset
is located in front of the
\begin_inset Formula $a$
\end_inset
, since the character
\begin_inset Quotes eld
\end_inset
\backslash
\begin_inset Quotes erd
\end_inset
is considered in sorting.
In order to control the sort order, you can edit the
\family sans
Sort\InsetSpace ~
as
\family default
field of the notation dialog.
For the given example, you can edit this field as
\family typewriter
a
\family default
and
\family typewriter
sigma
\family default
correspondingly.
Then, these entries will be effective in the sort ordering and
\begin_inset Formula $a$
\end_inset
will be located before
\begin_inset Formula $\sigma$
\end_inset
.
\end_layout
\begin_layout Standard
This feature provides exciting ways of ordering the entries.
For subgrouping and tips for using sort entries see the official nomencl
documentation.
\end_layout
\begin_layout Subsection
Referencing
\end_layout
\begin_layout Standard
You can turn on referencing to the equations and pages in the notation entries.
For this purpose, you should add referencing options commands at the end
of description field.
There are six referencing options in nomencl package:
\end_layout
\begin_layout Paragraph*
\backslash
refeq:
\end_layout
\begin_layout Standard
Adds reference to the equation by adding the phrase
\begin_inset Quotes eld
\end_inset
, see equation (#)
\begin_inset Quotes erd
\end_inset
\end_layout
\begin_layout Paragraph*
\backslash
refpage:
\end_layout
\begin_layout Standard
Adds reference to the page by adding the phrase
\begin_inset Quotes eld
\end_inset
, page (#)
\begin_inset Quotes erd
\end_inset
\end_layout
\begin_layout Paragraph*
\backslash
refeqpage:
\end_layout
\begin_layout Standard
Is the short notation of
\backslash
refeq
\backslash
refpage.
\end_layout
\begin_layout Paragraph*
\backslash
norefeq,
\backslash
norefpag,
\backslash
norefeqpage:
\end_layout
\begin_layout Standard
Turns off corresponding referencing options if they are turned on globally
(see reference documentation of nomencl).
\end_layout
\begin_layout Subsection
Printing Notation List
\end_layout
\begin_layout Standard
You can insert the notation list with the menu
\family sans
Insert\SpecialChar \menuseparator
Lists\InsetSpace ~
&TOC\SpecialChar \menuseparator
Notation\InsetSpace ~
List
\family default
.
A light blue box labeled
\begin_inset Quotes eld
\end_inset
\family sans
Notation
\family default
\begin_inset Quotes erd
\end_inset
will show the place where the index is printed in the output.
The index list box is not clickable like other LyX-boxes.
In the printed output the title of the notation list appears as
\series bold
Nomenclature
\series default
\begin_inset Foot
status collapsed
\begin_layout Standard
This is translated to the document language for a small number of languages,
amongst others French and German
\end_layout
\end_inset
.
If you are not happy with the title, you can change it by re-defining the
command
\family typewriter
\backslash
nomname
\family default
in the preamble.
For example, in order to change the title
\emph on
List of Symbols
\emph default
for the
\emph on
Notation List
\emph default
add the following line to the preamble.
\end_layout
\begin_layout LyX-Code
\backslash
renewcommand{
\backslash
nomname}{List of Symbols}
\end_layout
\begin_layout LyX-Code
\end_layout
\begin_layout Section \begin_layout Section
Multipart Documents Multipart Documents
\end_layout \end_layout

View File

@ -2839,6 +2839,28 @@ jurabib
instead). instead).
\end_layout \end_layout
\begin_layout Subsection
nomencl
\end_layout
\begin_layout Description
Found: @chk_nomencl@
\end_layout
\begin_layout Description
CTAN:
\family typewriter
macros/latex/contrib/nomencl/
\end_layout
\begin_layout Description
Notes: The package
\family sans
nomencl
\family default
is needed by LyX to produce a notation list.
\end_layout
\begin_layout Subsection \begin_layout Subsection
prettyref prettyref
\end_layout \end_layout

View File

@ -73,7 +73,7 @@ format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)),
("1_2", [220], generate_minor_versions("1.2" , 4)), ("1_2", [220], generate_minor_versions("1.2" , 4)),
("1_3", [221], generate_minor_versions("1.3" , 7)), ("1_3", [221], generate_minor_versions("1.3" , 7)),
("1_4", range(222,246), generate_minor_versions("1.4" , 3)), ("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(): def formats_list():

View File

@ -488,6 +488,102 @@ def revert_commandparams(document):
i = j + 1 i = j + 1
def revert_nomenclature(document):
" Convert nomenclature entry to ERT. "
regex = re.compile(r'(\S+)\s+(.+)')
i = 0
use_nomencl = 0
while 1:
i = find_token(document.body, "\\begin_inset LatexCommand nomenclature", i)
if i == -1:
break
use_nomencl = 1
j = find_end_of_inset(document.body, i + 1)
preview_line = ""
symbol = ""
description = ""
prefix = ""
for k in range(i + 1, j):
match = re.match(regex, document.body[k])
if match:
name = match.group(1)
value = match.group(2)
if name == "preview":
preview_line = document.body[k]
elif name == "symbol":
symbol = value.strip('"').replace('\\"', '"')
elif name == "description":
description = value.strip('"').replace('\\"', '"')
elif name == "prefix":
prefix = value.strip('"').replace('\\"', '"')
elif document.body[k].strip() != "":
document.warning("Ignoring unknown contents `%s' in nomenclature inset." % document.body[k])
if prefix == "":
command = 'nomenclature{%s}{%s}' % (symbol, description)
else:
command = 'nomenclature[%s]{%s}{%s}' % (prefix, symbol, description)
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 and find_token(document.preamble, '\\usepackage{nomencl}[2005/09/22]', 0) == -1:
document.preamble.append('\\usepackage{nomencl}[2005/09/22]')
document.preamble.append('\\makenomenclature')
def revert_printnomenclature(document):
" Convert printnomenclature to ERT. "
regex = re.compile(r'(\S+)\s+(.+)')
i = 0
use_nomencl = 0
while 1:
i = find_token(document.body, "\\begin_inset LatexCommand printnomenclature", i)
if i == -1:
break
use_nomencl = 1
j = find_end_of_inset(document.body, i + 1)
preview_line = ""
labelwidth = ""
for k in range(i + 1, j):
match = re.match(regex, document.body[k])
if match:
name = match.group(1)
value = match.group(2)
if name == "preview":
preview_line = document.body[k]
elif name == "labelwidth":
labelwidth = value.strip('"').replace('\\"', '"')
elif document.body[k].strip() != "":
document.warning("Ignoring unknown contents `%s' in printnomenclature inset." % document.body[k])
if labelwidth == "":
command = 'nomenclature{}'
else:
command = 'nomenclature[%s]' % labelwidth
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 and find_token(document.preamble, '\\usepackage{nomencl}[2005/09/22]', 0) == -1:
document.preamble.append('\\usepackage{nomencl}[2005/09/22]')
document.preamble.append('\\makenomenclature')
## ##
# Conversion hub # Conversion hub
# #
@ -499,9 +595,11 @@ convert = [[246, []],
[249, [convert_utf8]], [249, [convert_utf8]],
[250, []], [250, []],
[251, []], [251, []],
[252, [convert_commandparams, convert_bibitem]]] [252, [convert_commandparams, convert_bibitem]],
[253, []]]
revert = [[251, [revert_commandparams]], revert = [[252, [revert_nomenclature, revert_printnomenclature]],
[251, [revert_commandparams]],
[250, [revert_cs_label]], [250, [revert_cs_label]],
[249, []], [249, []],
[248, [revert_utf8]], [248, [revert_utf8]],

View File

@ -221,6 +221,7 @@ Menuset
Item "Marginal Note|M" "marginalnote-insert" Item "Marginal Note|M" "marginalnote-insert"
Item "Short Title" "optional-insert" Item "Short Title" "optional-insert"
Item "Index Entry|I" "index-insert" Item "Index Entry|I" "index-insert"
Item "Notation Entry" "nomencl-insert"
Item "URL...|U" "url-insert" Item "URL...|U" "url-insert"
Item "Note|N" "note-insert" Item "Note|N" "note-insert"
Submenu "Lists & TOC|O" "insert_toc" Submenu "Lists & TOC|O" "insert_toc"
@ -310,6 +311,7 @@ Menuset
Item "Table of Contents|C" "toc-insert" Item "Table of Contents|C" "toc-insert"
FloatListInsert FloatListInsert
Item "Index List|I" "index-print" Item "Index List|I" "index-print"
Item "Notation List|N" "nomencl-print"
Item "BibTeX Bibliography...|B" "dialog-show-new-inset bibtex" Item "BibTeX Bibliography...|B" "dialog-show-new-inset bibtex"
End End

View File

@ -299,6 +299,7 @@ Menuset
Item "Cross-reference...|r" "dialog-show-new-inset ref" Item "Cross-reference...|r" "dialog-show-new-inset ref"
Item "Label...|L" "label-insert" Item "Label...|L" "label-insert"
Item "Index Entry|d" "index-insert" Item "Index Entry|d" "index-insert"
Item "Notation Entry" "nomencl-insert"
Item "Date" "date-insert" Item "Date" "date-insert"
# I'm going to kill this dumb dialog, but for now ... # I'm going to kill this dumb dialog, but for now ...
Separator Separator
@ -368,6 +369,7 @@ Menuset
Item "Table of Contents|C" "toc-insert" Item "Table of Contents|C" "toc-insert"
FloatListInsert FloatListInsert
Item "Index List|I" "index-print" Item "Index List|I" "index-print"
Item "Notation List" "nomencl-print"
Item "BibTeX Bibliography...|B" "dialog-show-new-inset bibtex" Item "BibTeX Bibliography...|B" "dialog-show-new-inset bibtex"
End End

View File

@ -76,6 +76,7 @@ Toolbar "extra" "Extra"
Item "Insert cross-reference" "dialog-show-new-inset ref" Item "Insert cross-reference" "dialog-show-new-inset ref"
Item "Insert citation" "dialog-show-new-inset citation" Item "Insert citation" "dialog-show-new-inset citation"
Item "Insert index entry" "index-insert" Item "Insert index entry" "index-insert"
Item "Insert notation entry" "nomencl-insert"
Separator Separator
Item "Insert footnote" "footnote-insert" Item "Insert footnote" "footnote-insert"
Item "Insert margin note" "marginalnote-insert" Item "Insert margin note" "marginalnote-insert"

View File

@ -158,6 +158,10 @@ void LaTeX::deleteFilesOnError() const
string const ind = changeExtension(ofname, ".ind"); string const ind = changeExtension(ofname, ".ind");
unlink(ind); unlink(ind);
// nomencl file
string const nls = changeExtension(ofname, ".nls");
unlink(nls);
// Also remove the aux file // Also remove the aux file
string const aux = changeExtension(ofname, ".aux"); string const aux = changeExtension(ofname, ".aux");
unlink(aux); unlink(aux);
@ -283,6 +287,12 @@ int LaTeX::run(TeXErrors & terr)
message(_("Running MakeIndex.")); message(_("Running MakeIndex."));
rerun |= runMakeIndex(onlyFilename(changeExtension(file, ".idx")), runparams); rerun |= runMakeIndex(onlyFilename(changeExtension(file, ".idx")), runparams);
} }
if (head.haschanged(onlyFilename(changeExtension(file, ".nlo")))) {
lyxerr[Debug::LATEX] << "Running MakeIndex for nomencl." << endl;
message(_("Running Makeindex for nomencl."));
string const nomenclstr = " -s nomencl.ist -o " + changeExtension(file, ".nls");
rerun |= runMakeIndex(onlyFilename(changeExtension(file, ".nlo")), runparams, nomenclstr);
}
// run bibtex // run bibtex
// if (scanres & UNDEF_CIT || scanres & RERUN || 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); rerun = runMakeIndex(onlyFilename(changeExtension(file, ".idx")), runparams);
} }
// I am not pretty sure if need this twice.
if (head.haschanged(onlyFilename(changeExtension(file, ".nlo")))) {
lyxerr[Debug::LATEX] << "Running MakeIndex for nomencl." << endl;
message(_("Running Makeindex for nomencl. "));
string nomenclstr = " -s nomencl.ist -o " + changeExtension(file, ".nls");
rerun |= runMakeIndex(onlyFilename(changeExtension(file, ".nlo")), runparams, nomenclstr);
}
// 2 // 2
// we will only run latex more if the log file asks for it. // we will only run latex more if the log file asks for it.
// or if the sumchange() is true. // 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," lyxerr[Debug::LATEX]
" running makeindex on file " << f << endl; << "idx file has been made, running makeindex on file "
string tmp = lyxrc.index_command + " "; << f << endl;
string tmp = lyxrc.index_command + ' ';
tmp = subst(tmp, "$$lang", runparams.document_language); tmp = subst(tmp, "$$lang", runparams.document_language);
tmp += quoteName(f); tmp += quoteName(f);
tmp += params;
Systemcall one; Systemcall one;
one.startscript(Systemcall::Wait, tmp); one.startscript(Systemcall::Wait, tmp);
return true; return true;
@ -761,6 +783,7 @@ void LaTeX::deplog(DepTable & head)
// but instead only a line like this into the log: // but instead only a line like this into the log:
// Writing index file sample.idx // Writing index file sample.idx
static regex reg5("Writing index file ([^ ]+).*"); static regex reg5("Writing index file ([^ ]+).*");
static regex regnomencl("Writing nomenclature file ([^ ]+).*");
// If a toc should be created, MikTex does not write a line like // If a toc should be created, MikTex does not write a line like
// \openout# = `sample.toc'. // \openout# = `sample.toc'.
// but only a line like this into the log: // but only a line like this into the log:
@ -809,6 +832,8 @@ void LaTeX::deplog(DepTable & head)
handleFoundFile(sub.str(1), head); handleFoundFile(sub.str(1), head);
else if (regex_match(token, sub, reg5)) else if (regex_match(token, sub, reg5))
handleFoundFile(sub.str(1), head); handleFoundFile(sub.str(1), head);
else if (regex_match(token, sub, regnomencl))
handleFoundFile(sub.str(1), head);
else if (regex_match(token, sub, miktexTocReg)) else if (regex_match(token, sub, miktexTocReg))
handleFoundFile(changeExtension(file, ".toc"), head); handleFoundFile(changeExtension(file, ".toc"), head);
} }

View File

@ -161,7 +161,8 @@ private:
void deplog(DepTable & head); 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 &); std::vector<Aux_Info> const scanAuxFiles(std::string const &);

View File

@ -386,6 +386,11 @@ string const LaTeXFeatures::getPackages() const
if (isRequired("xy")) if (isRequired("xy"))
packages << "\\usepackage[all]{xy}\n"; packages << "\\usepackage[all]{xy}\n";
if (isRequired("nomencl")) {
packages << "\\usepackage{nomencl}[2005/09/22]\n"
<< "\\makenomenclature\n";
}
return packages.str(); return packages.str();
} }

View File

@ -367,7 +367,9 @@ void LyXAction::init()
{ LFUN_WINDOW_CLOSE, "window-close", NoBuffer }, { LFUN_WINDOW_CLOSE, "window-close", NoBuffer },
{ LFUN_UNICODE_INSERT, "unicode-insert", Noop }, { LFUN_UNICODE_INSERT, "unicode-insert", Noop },
{ LFUN_TOOLBAR_TOGGLE_STATE, "", NoBuffer }, { LFUN_TOOLBAR_TOGGLE_STATE, "", NoBuffer },
{ LFUN_NOMENCL_INSERT, "nomencl-insert", Noop },
{ LFUN_NOMENCL_PRINT, "nomencl-print", Noop },
{ LFUN_NOACTION, "", Noop } { LFUN_NOACTION, "", Noop }
}; };

View File

@ -142,7 +142,7 @@ using std::string;
namespace { namespace {
int const LYX_FORMAT = 252; int const LYX_FORMAT = 253;
} // namespace anon } // namespace anon

View File

@ -37,6 +37,7 @@
#include "insets/insethfill.h" #include "insets/insethfill.h"
#include "insets/insetinclude.h" #include "insets/insetinclude.h"
#include "insets/insetindex.h" #include "insets/insetindex.h"
#include "insets/insetnomencl.h"
#include "insets/insetlabel.h" #include "insets/insetlabel.h"
#include "insets/insetline.h" #include "insets/insetline.h"
#include "insets/insetmarginal.h" #include "insets/insetmarginal.h"
@ -171,6 +172,14 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
return new InsetIndex(icp); return new InsetIndex(icp);
} }
case LFUN_NOMENCL_INSERT: {
InsetCommandParams icp("nomenclature");
icp["symbol"] = cmd.argument().empty() ?
bv->getLyXText()->getStringToIndex(bv->cursor()) :
cmd.argument();
return new InsetNomencl(icp);
}
case LFUN_TABULAR_INSERT: { case LFUN_TABULAR_INSERT: {
if (cmd.argument().empty()) if (cmd.argument().empty())
return 0; return 0;
@ -195,6 +204,9 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
case LFUN_INDEX_PRINT: case LFUN_INDEX_PRINT:
return new InsetPrintIndex(InsetCommandParams("printindex")); return new InsetPrintIndex(InsetCommandParams("printindex"));
case LFUN_NOMENCL_PRINT:
return new InsetPrintNomencl(InsetCommandParams("printnomenclature"));
case LFUN_TOC_INSERT: case LFUN_TOC_INSERT:
return new InsetTOC(InsetCommandParams("tableofcontents")); return new InsetTOC(InsetCommandParams("tableofcontents"));
@ -264,6 +276,12 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
icp); icp);
return new InsetIndex(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") { } else if (name == "label") {
InsetCommandParams icp(name); InsetCommandParams icp(name);
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), InsetCommandMailer::string2params(name, to_utf8(cmd.argument()),
@ -369,6 +387,8 @@ InsetBase * readInset(LyXLex & lex, Buffer const & buf)
inset.reset(new InsetBibtex(inscmd)); inset.reset(new InsetBibtex(inscmd));
} else if (cmdName == "index") { } else if (cmdName == "index") {
inset.reset(new InsetIndex(inscmd)); inset.reset(new InsetIndex(inscmd));
} else if (cmdName == "nomenclature") {
inset.reset(new InsetNomencl(inscmd));
} else if (cmdName == "include") { } else if (cmdName == "include") {
inset.reset(new InsetInclude(inscmd)); inset.reset(new InsetInclude(inscmd));
} else if (cmdName == "label") { } else if (cmdName == "label") {
@ -396,6 +416,8 @@ InsetBase * readInset(LyXLex & lex, Buffer const & buf)
inset.reset(new InsetFloatList("table")); inset.reset(new InsetFloatList("table"));
} else if (cmdName == "printindex") { } else if (cmdName == "printindex") {
inset.reset(new InsetPrintIndex(inscmd)); inset.reset(new InsetPrintIndex(inscmd));
} else if (cmdName == "printnomenclature") {
inset.reset(new InsetPrintNomencl(inscmd));
} else { } else {
lyxerr << "unknown CommandInset '" << cmdName lyxerr << "unknown CommandInset '" << cmdName
<< "'" << std::endl; << "'" << std::endl;

View File

@ -61,6 +61,7 @@
#include "QGraphics.h" #include "QGraphics.h"
#include "QInclude.h" #include "QInclude.h"
#include "QIndex.h" #include "QIndex.h"
#include "QNomencl.h"
#include "QLog.h" #include "QLog.h"
#include "QViewSource.h" #include "QViewSource.h"
#include "QMath.h" #include "QMath.h"
@ -101,7 +102,7 @@ namespace {
char const * const dialognames[] = { char const * const dialognames[] = {
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character", "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
"citation", "document", "errorlist", "ert", "external", "file", "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", "mathpanel", "mathdelimiter", "mathmatrix", "note", "paragraph",
"prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate", "prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
@ -109,7 +110,7 @@ char const * const dialognames[] = {
"thesaurus", "thesaurus",
#endif #endif
"texinfo", "toc", "url", "vspace", "wrap" }; "texinfo", "toc", "url", "view-source", "vspace", "wrap" };
char const * const * const end_dialognames = char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *)); dialognames + (sizeof(dialognames) / sizeof(char *));
@ -219,6 +220,10 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
_("Index Entry"), _("Index Entry"),
qt_("&Keyword:"))); qt_("&Keyword:")));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "nomenclature") {
dialog->setController(new ControlCommand(*dialog, name, name));
dialog->setView(new QNomencl(*dialog, _("Notation Entry")));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "label") { } else if (name == "label") {
dialog->setController(new ControlCommand(*dialog, name, name)); dialog->setController(new ControlCommand(*dialog, name, name));
dialog->setView(new QIndex(*dialog, dialog->setView(new QIndex(*dialog,

View File

@ -64,6 +64,7 @@ libqt4_la_SOURCES = \
QLPainter.C QLPainter.h \ QLPainter.C QLPainter.h \
QLyXKeySym.C QLyXKeySym.h \ QLyXKeySym.C QLyXKeySym.h \
QMath.C QMath.h \ QMath.C QMath.h \
QNomencl.C QNomencl.h \
QNote.C QNote.h \ QNote.C QNote.h \
QParagraph.C QParagraph.h \ QParagraph.C QParagraph.h \
QPrefs.C QPrefs.h \ QPrefs.C QPrefs.h \

View File

@ -37,6 +37,7 @@ UIFILES = \
QViewSourceUi.ui \ QViewSourceUi.ui \
QMathUi.ui \ QMathUi.ui \
QMathMatrixUi.ui \ QMathMatrixUi.ui \
QNomenclUi.ui \
QNoteUi.ui \ QNoteUi.ui \
QParagraphUi.ui \ QParagraphUi.ui \
QPrefAsciiUi.ui \ QPrefAsciiUi.ui \
@ -114,6 +115,7 @@ MOCFILES = \
QLPrintDialog.C QLPrintDialog.h \ QLPrintDialog.C QLPrintDialog.h \
QMathDialog.C QMathDialog.h \ QMathDialog.C QMathDialog.h \
QMathMatrixDialog.C QMathMatrixDialog.h \ QMathMatrixDialog.C QMathMatrixDialog.h \
QNomenclDialog.C QNomenclDialog.h \
QNoteDialog.C QNoteDialog.h \ QNoteDialog.C QNoteDialog.h \
QParagraphDialog.C QParagraphDialog.h \ QParagraphDialog.C QParagraphDialog.h \
QPrefsDialog.C QPrefsDialog.h \ QPrefsDialog.C QPrefsDialog.h \

View File

@ -0,0 +1,76 @@
/**
* \file QNomencl.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author O. U. Baran
*
* 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)
: base_class(parent, title)
{
}
void QNomencl::build_dialog()
{
dialog_.reset(new QNomenclDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->symbolED);
bcview().addReadOnly(dialog_->descrED);
bcview().addReadOnly(dialog_->prefixED);
}
void QNomencl::update_contents()
{
dialog_->prefixED->setText(toqstr(controller().params()["prefix"]));
dialog_->symbolED->setText(toqstr(controller().params()["symbol"]));
dialog_->descrED->setText(toqstr(controller().params()["description"]));
bc().valid(isValid());
}
void QNomencl::apply()
{
controller().params()["prefix"] = qstring_to_ucs4(dialog_->prefixED->text());
controller().params()["symbol"] = qstring_to_ucs4(dialog_->symbolED->text());
controller().params()["description"] = qstring_to_ucs4(dialog_->descrED->text());
}
bool QNomencl::isValid()
{
return (!dialog_->symbolED->text().isEmpty() && !dialog_->descrED->text().isEmpty());
}
} // namespace frontend
} // namespace lyx

View File

@ -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 John Levon
* \author Kalle Dalheimer
* \author O. U. Baran
*
* 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 &, docstring const & title);
protected:
virtual bool isValid();
private:
/// Apply changes
virtual void apply();
/// update
virtual void update_contents();
/// build the dialog
virtual void build_dialog();
};
} // namespace frontend
} // namespace lyx
#endif // QNOMENCL_H

View File

@ -0,0 +1,70 @@
/**
* \file QNomenclDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author O. U. Baran
*
* 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(symbolED, SIGNAL(textChanged(const QString&)),
this, SLOT(change_adaptor()));
connect(descrED, SIGNAL(textChanged(const QString&)),
this, SLOT(change_adaptor()));
}
void QNomenclDialog::show()
{
QDialog::show();
symbolED->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"

View File

@ -0,0 +1,43 @@
// -*- C++ -*-
/**
* \file QNomenclDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author O. U. Baran
*
* 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

View File

@ -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/>
</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="symbolLA" >
<property name="text" >
<string>Symbol:</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="descrLA" >
<property name="text" >
<string>Description:</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="prefixLA" >
<property name="text" >
<string>Sort as:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="symbolED" >
<property name="toolTip" >
<string/>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="descrED" />
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="prefixED" />
</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/>
<resources/>
<connections/>
</ui>

View File

@ -85,6 +85,8 @@ libinsets_la_SOURCES = \
insetmarginal.C \ insetmarginal.C \
insetnewline.C \ insetnewline.C \
insetnewline.h \ insetnewline.h \
insetnomencl.C \
insetnomencl.h \
insetnote.C \ insetnote.C \
insetnote.h \ insetnote.h \
insetoptarg.C \ insetoptarg.C \

View File

@ -63,6 +63,7 @@ static TranslatorMap const build_translator()
InsetName("accent", InsetBase::ACCENT_CODE), InsetName("accent", InsetBase::ACCENT_CODE),
InsetName("math", InsetBase::MATH_CODE), InsetName("math", InsetBase::MATH_CODE),
InsetName("index", InsetBase::INDEX_CODE), InsetName("index", InsetBase::INDEX_CODE),
InsetName("nomenclature", InsetBase::NOMENCL_CODE),
InsetName("include", InsetBase::INCLUDE_CODE), InsetName("include", InsetBase::INCLUDE_CODE),
InsetName("graphics", InsetBase::GRAPHICS_CODE), InsetName("graphics", InsetBase::GRAPHICS_CODE),
InsetName("bibitem", InsetBase::BIBITEM_CODE), InsetName("bibitem", InsetBase::BIBITEM_CODE),
@ -81,6 +82,7 @@ static TranslatorMap const build_translator()
InsetName("cite", InsetBase::CITE_CODE), InsetName("cite", InsetBase::CITE_CODE),
InsetName("float_list", InsetBase::FLOAT_LIST_CODE), InsetName("float_list", InsetBase::FLOAT_LIST_CODE),
InsetName("index_print", InsetBase::INDEX_PRINT_CODE), InsetName("index_print", InsetBase::INDEX_PRINT_CODE),
InsetName("nomencl_print", InsetBase::NOMENCL_PRINT_CODE),
InsetName("optarg", InsetBase::OPTARG_CODE), InsetName("optarg", InsetBase::OPTARG_CODE),
InsetName("environment", InsetBase::ENVIRONMENT_CODE), InsetName("environment", InsetBase::ENVIRONMENT_CODE),
InsetName("hfill", InsetBase::HFILL_CODE), InsetName("hfill", InsetBase::HFILL_CODE),

View File

@ -322,7 +322,11 @@ public:
/// ///
VSPACE_CODE, VSPACE_CODE,
/// ///
MATHMACROARG_CODE MATHMACROARG_CODE,
///
NOMENCL_CODE, // 45
///
NOMENCL_PRINT_CODE
}; };
/** returns the Code corresponding to the \c name. /** returns the Code corresponding to the \c name.

View File

@ -117,6 +117,22 @@ InsetCommandParams::findInfo(std::string const & name)
return &info; return &info;
} }
// InsetNomencl
if (name == "nomenclature") {
static const char * const paramnames[] = {"prefix", "symbol", "description", ""};
static const bool isoptional[] = {true, false, false};
static const CommandInfo info = {3, paramnames, isoptional};
return &info;
}
// InsetPrintNomencl
if (name == "printnomenclature") {
static const char * const paramnames[] = {"labelwidth", ""};
static const bool isoptional[] = {true};
static const CommandInfo info = {1, paramnames, isoptional};
return &info;
}
// InsetRef // InsetRef
if (name == "eqref" || name == "pageref" || name == "vpageref" || if (name == "eqref" || name == "pageref" || name == "vpageref" ||
name == "vref" || name == "prettyref" || name == "ref") { name == "vref" || name == "prettyref" || name == "ref") {
@ -288,6 +304,7 @@ void InsetCommandParams::write(ostream & os) const
docstring const InsetCommandParams::getCommand() const docstring const InsetCommandParams::getCommand() const
{ {
docstring s = '\\' + from_ascii(name_); docstring s = '\\' + from_ascii(name_);
bool noparam = true;
for (size_t i = 0; i < info_->n; ++i) { for (size_t i = 0; i < info_->n; ++i) {
if (info_->optional[i]) { if (info_->optional[i]) {
if (params_[i].empty()) { if (params_[i].empty()) {
@ -299,15 +316,20 @@ docstring const InsetCommandParams::getCommand() const
break; break;
if (!params_[j].empty()) { if (!params_[j].empty()) {
s += "[]"; s += "[]";
noparam = false;
break; break;
} }
} }
} else } else {
s += '[' + params_[i] + ']'; s += '[' + params_[i] + ']';
} else noparam = false;
}
} else {
s += '{' + params_[i] + '}'; s += '{' + params_[i] + '}';
noparam = false;
}
} }
if (info_->n == 0) if (noparam)
// Make sure that following stuff does not change the // Make sure that following stuff does not change the
// command name. // command name.
s += "{}"; s += "{}";

View File

@ -352,6 +352,8 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
case LFUN_INSET_INSERT: case LFUN_INSET_INSERT:
case LFUN_PARAGRAPH_PARAMS_APPLY: case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_UPDATE: case LFUN_PARAGRAPH_UPDATE:
case LFUN_NOMENCL_INSERT:
case LFUN_NOMENCL_PRINT:
case LFUN_NOACTION: case LFUN_NOACTION:
status.enabled(false); status.enabled(false);
return true; return true;

99
src/insets/insetnomencl.C Normal file
View File

@ -0,0 +1,99 @@
/**
* \file insetnomencl.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author O. U. Baran
*
* 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
{
// FIXME: This does not work, because the entry needs to be put
// in the glossary.
#if 0
os << "<glossentry><glossterm>"
<< sgml::escapeString(getParam("symbol"))
<< "</glossterm><glossdef><para>"
<< sgml::escapeString(getParam("description"))
<< "</para></glossdef></glossentry>";
#endif
return 0;
}
void InsetNomencl::validate(LaTeXFeatures & features) const
{
features.require("nomencl");
}
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");
}
int InsetPrintNomencl::docbook(Buffer const &, odocstream & os,
OutputParams const &) const
{
// FIXME This does not work, we need to define the entries here.
//os << "<glossary><glossary/>";
return 0;
}
void InsetPrintNomencl::validate(LaTeXFeatures & features) const
{
features.require("nomencl");
}
InsetBase::Code InsetPrintNomencl::lyxCode() const
{
return InsetBase::NOMENCL_PRINT_CODE;
}
} // namespace lyx

78
src/insets/insetnomencl.h Normal file
View File

@ -0,0 +1,78 @@
// -*- C++ -*-
/**
* \file insetnomencl.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author O. U. Baran
*
* 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; }
/// Updates needed features for this inset.
void validate(LaTeXFeatures & features) const;
///
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;
// FIXME: This should be editable to set the label width (stored
// in params_["labelwidth"]).
// Currently the width can be read from file and written, but not
// changed.
///
EDITABLE editable() const { return NOT_EDITABLE; }
///
int docbook(Buffer const &, odocstream &,
OutputParams const &) const;
///
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

View File

@ -375,7 +375,9 @@ enum kb_action {
// 285 // 285
LFUN_BOOKMARK_CLEAR, // bpeng 20061031 LFUN_BOOKMARK_CLEAR, // bpeng 20061031
LFUN_TOOLBAR_TOGGLE_STATE, // bpeng 20061101 LFUN_TOOLBAR_TOGGLE_STATE, // bpeng 20061101
LFUN_NOMENCL_INSERT, // Ugras
LFUN_NOMENCL_PRINT, // Ugras
LFUN_LASTACTION // end of the table LFUN_LASTACTION // end of the table
}; };

View File

@ -1252,6 +1252,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
name == "bibtex" || name == "bibtex" ||
name == "index" || name == "index" ||
name == "label" || name == "label" ||
name == "nomenclature" ||
name == "ref" || name == "ref" ||
name == "toc" || name == "toc" ||
name == "url") { name == "url") {

View File

@ -1160,7 +1160,8 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
cur.dispatch(FuncRequest(LFUN_LAYOUT, "Caption")); cur.dispatch(FuncRequest(LFUN_LAYOUT, "Caption"));
break; break;
case LFUN_INDEX_INSERT: { case LFUN_INDEX_INSERT:
case LFUN_NOMENCL_INSERT: {
InsetBase * inset = createInset(&cur.bv(), cmd); InsetBase * inset = createInset(&cur.bv(), cmd);
if (!inset) if (!inset)
break; break;
@ -1169,11 +1170,17 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
cur.clearSelection(); cur.clearSelection();
insertInset(cur, inset); insertInset(cur, inset);
inset->edit(cur, true); inset->edit(cur, true);
// Show the dialog for the nomenclature entry, since the
// description entry still needs to be filled in.
if (cmd.action == LFUN_NOMENCL_INSERT)
InsetCommandMailer("nomenclature",
*reinterpret_cast<InsetCommand *>(inset)).showDialog(&cur.bv());
cur.posRight(); cur.posRight();
break; break;
} }
case LFUN_INDEX_PRINT: case LFUN_INDEX_PRINT:
case LFUN_NOMENCL_PRINT:
case LFUN_TOC_INSERT: case LFUN_TOC_INSERT:
case LFUN_HFILL_INSERT: case LFUN_HFILL_INSERT:
case LFUN_LINE_INSERT: case LFUN_LINE_INSERT:
@ -1550,6 +1557,8 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
code = InsetBase::INCLUDE_CODE; code = InsetBase::INCLUDE_CODE;
else if (cmd.argument() == "index") else if (cmd.argument() == "index")
code = InsetBase::INDEX_CODE; code = InsetBase::INDEX_CODE;
else if (cmd.argument() == "nomenclature")
code = InsetBase::NOMENCL_CODE;
else if (cmd.argument() == "label") else if (cmd.argument() == "label")
code = InsetBase::LABEL_CODE; code = InsetBase::LABEL_CODE;
else if (cmd.argument() == "note") else if (cmd.argument() == "note")
@ -1632,6 +1641,12 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
case LFUN_INDEX_PRINT: case LFUN_INDEX_PRINT:
code = InsetBase::INDEX_PRINT_CODE; code = InsetBase::INDEX_PRINT_CODE;
break; break;
case LFUN_NOMENCL_INSERT:
code = InsetBase::NOMENCL_CODE;
break;
case LFUN_NOMENCL_PRINT:
code = InsetBase::NOMENCL_PRINT_CODE;
break;
case LFUN_TOC_INSERT: case LFUN_TOC_INSERT:
code = InsetBase::TOC_CODE; code = InsetBase::TOC_CODE;
break; break;