LyX file-format changes
-----------------------
-2009-04-26 Jürgen Spitzmüller <spitz@lyx.org>
+2009-05-22 Jürgen Spitzmüller <spitz@lyx.org>
+ * Format incremented to 360: param width for nomencl_print
+ CommandInset.
+
+2009-05-22 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 359: param set_width for nomencl_print
CommandInset.
GuiPrefs.h
GuiPrint.h
GuiPrintindex.h
+ GuiPrintNomencl.h
GuiRef.h
GuiSearch.h
GuiSelection.h
GuiPrefs.cpp
GuiPrint.cpp
GuiPrintindex.cpp
+ GuiPrintNomencl.cpp
GuiRef.cpp
GuiSearch.cpp
GuiSelection.cpp
PrefsUi.ui
PrintUi.ui
PrintindexUi.ui
+ PrintNomenclUi.ui
RefUi.ui
SearchUi.ui
SendtoUi.ui
i = i + 1
+def revert_nomencl_cwidth(document):
+ " Remove width param from nomencl_print "
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_inset CommandInset nomencl_print", i)
+ if i == -1:
+ break
+ j = find_end_of_inset(document.body, i)
+ l = find_token(document.body, "width", i, j)
+ if l == -1:
+ document.warning("Can't find width option for nomencl_print!")
+ i = j
+ continue
+ width = get_value(document.body, "width", i, j).strip('"')
+ del document.body[l]
+ add_to_preamble(document, ["\\setlength{\\nomlabelwidth}{" + width + "}"])
+ i = i + 1
+
+
##
# Conversion hub
#
[356, []],
[357, []],
[358, []],
- [359, [convert_nomencl_width]]
+ [359, [convert_nomencl_width]],
+ [360, []]
]
-revert = [[358, [revert_nomencl_width]],
+revert = [[359, [revert_nomencl_cwidth]],
+ [358, [revert_nomencl_width]],
[357, [revert_custom_processors]],
[356, [revert_ulinelatex]],
[355, [revert_uulinewave]],
Item "Eqnarray Environment|E" "math-mutate eqnarray"
Submenu "AMS Environment|A" "ams_environment"
Separator
- OptItem "Number whole Formula|N" "math-number-toggle"\r
+ OptItem "Number whole Formula|N" "math-number-toggle"
OptItem "Number this Line|u" "math-number-line-toggle"
OptItem "Equation Label|L" "label-insert"
OptItem "Copy as Reference|R" "copy-label-as-reference"
OptItem "Settings...|S" "inset-settings"
End
+#
+# Nomencl List context menu
+#
+
+ Menu "context-nomenclprint"
+ OptItem "Settings...|S" "inset-settings"
+ End
+
#
# Toc Changes context menu
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-int const LYX_FORMAT = 359; // jspitzm: nomencl auto calculation
+int const LYX_FORMAT = 360; // jspitzm: nomencl custom width
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
* \li Params: <NAME>: aboutlyx|bibitem|bibtex|box|branch|changes|character|citation|\n
document|errorlist|ert|external|file|findreplace|findreplaceadv|float|graphics|\n
href|include|index|index_print|info|label|listings|log|mathdelimiter|\n
- mathmatrix|mathspace|nomenclature|note|paragraph|phantom|prefs|print|ref|\n
- sendto|space|spellchecker|symbols|tabular|tabularcreate|thesaurus|texinfo|\n
- toc|view-source|vspace|wrap|<SPECIAL> \n
+ mathmatrix|mathspace|nomenclature|note|paragraph|phantom|prefs|print|\n
+ nomencl_print|ref|sendto|space|spellchecker|symbols|tabular|tabularcreate|\n
+ thesaurus|texinfo|toc|view-source|vspace|wrap|<SPECIAL> \n
<SPECIAL>: latexlog|vclog \n
<DATA>: data, usually settings for the given dialog. Use debug mode for the
details.
case INDEX_CODE:
case LABEL_CODE:
case NOMENCL_CODE:
+ case NOMENCL_PRINT_CODE:
case REF_CODE:
case TOC_CODE:
case HYPERLINK_CODE: {
dispatch(cur, fr);
break;
}
-
+
case LFUN_NOMENCL_PRINT:
case LFUN_TOC_INSERT:
case LFUN_LINE_INSERT:
code = INDEX_PRINT_CODE;
else if (cmd.argument() == "nomenclature")
code = NOMENCL_CODE;
+ else if (cmd.argument() == "nomencl_print")
+ code = NOMENCL_PRINT_CODE;
else if (cmd.argument() == "label")
code = LABEL_CODE;
else if (cmd.argument() == "note")
// The name passed with LFUN_INSET_APPLY is also the name
// used to identify the mailer.
InsetCommand::string2params("index_print", data, params_);
+ paramsToDialog(params_);
return true;
}
"findreplaceadv", "float", "graphics", "href", "include", "index",
"index_print", "info", "listings", "label", "log", "mathdelimiter",
"mathmatrix", "mathspace", "nomenclature", "note", "paragraph", "phantom",
-"prefs", "print", "ref", "sendto", "space", "spellchecker", "symbols",
-"tabular", "tabularcreate", "thesaurus", "texinfo", "toc", "view-source",
-"vspace", "wrap" };
+"prefs", "print", "nomencl_print", "ref", "sendto", "space", "spellchecker",
+"symbols", "tabular", "tabularcreate", "thesaurus", "texinfo", "toc",
+"view-source", "vspace", "wrap" };
char const * const * const end_dialognames =
dialognames + (sizeof(dialognames) / sizeof(char *));
Dialog * createGuiPreferences(GuiView & lv);
Dialog * createGuiPrint(GuiView & lv);
Dialog * createGuiPrintindex(GuiView & lv);
+Dialog * createGuiPrintNomencl(GuiView & lv);
Dialog * createGuiRef(GuiView & lv);
Dialog * createGuiSearch(GuiView & lv);
Dialog * createGuiSearchAdv(GuiView & lv);
return createGuiPreferences(*this);
if (name == "print")
return createGuiPrint(*this);
+ if (name == "nomencl_print")
+ return createGuiPrintNomencl(*this);
if (name == "ref")
return createGuiRef(*this);
if (name == "sendto")
GuiPrefs.cpp \
GuiPrint.cpp \
GuiPrintindex.cpp \
+ GuiPrintNomencl.cpp \
GuiRef.cpp \
GuiSearch.cpp \
GuiSelection.cpp \
GuiPrefs.h \
GuiPrint.h \
GuiPrintindex.h \
+ GuiPrintNomencl.h \
GuiRef.h \
GuiSearch.h \
GuiSelection.h \
PrefUi.ui \
PrintUi.ui \
PrintindexUi.ui \
+ PrintNomenclUi.ui \
RefUi.ui \
SearchUi.ui \
SendtoUi.ui \
#include "DispatchResult.h"
#include "Font.h"
#include "FuncRequest.h"
+#include "FuncStatus.h"
#include "InsetIterator.h"
#include "InsetList.h"
#include "LaTeXFeatures.h"
+#include "Length.h"
#include "MetricsInfo.h"
#include "sgml.h"
/////////////////////////////////////////////////////////////////////
InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
- : InsetCommand(p, "printnomenclature")
+ : InsetCommand(p, "nomencl_print")
{}
static ParamInfo param_info_;
if (param_info_.empty()) {
// how is the width set?
- // values: none|auto
+ // values: none|auto|custom
param_info_.add("set_width", ParamInfo::LYX_INTERNAL);
+ // custom width
+ param_info_.add("width", ParamInfo::LYX_INTERNAL);
}
return param_info_;
}
}
+void InsetPrintNomencl::doDispatch(Cursor & cur, FuncRequest & cmd)
+{
+ switch (cmd.action) {
+
+ case LFUN_INSET_MODIFY: {
+ InsetCommandParams p(NOMENCL_PRINT_CODE);
+ // FIXME UNICODE
+ InsetCommand::string2params("nomencl_print",
+ to_utf8(cmd.argument()), p);
+ if (p.getCmdName().empty()) {
+ cur.noUpdate();
+ break;
+ }
+ setParams(p);
+ break;
+ }
+
+ default:
+ InsetCommand::doDispatch(cur, cmd);
+ break;
+ }
+}
+
+
+bool InsetPrintNomencl::getStatus(Cursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+{
+ switch (cmd.action) {
+
+ case LFUN_INSET_DIALOG_UPDATE:
+ case LFUN_INSET_MODIFY:
+ status.setEnabled(true);
+ return true;
+
+ default:
+ return InsetCommand::getStatus(cur, cmd, status);
+ }
+}
+
+
+
int InsetPrintNomencl::docbook(odocstream & os, OutputParams const &) const
{
os << "<glossary>\n";
os << " {}\n";
lines += 5;
}
+ } else if (getParam("set_width") == "custom") {
+ // custom length as optional arg of \printnomenclature
+ string const width =
+ Length(to_ascii(getParam("width"))).asLatexString();
+ os << '\\'
+ << from_ascii(getCmdName())
+ << '['
+ << from_ascii(width)
+ << "]{}";
+ return lines;
}
// output the command \printnomenclature
os << getCommand();
}
+docstring InsetPrintNomencl::contextMenu(BufferView const &, int, int) const
+{
+ return from_ascii("context-nomenclprint");
+}
+
+
} // namespace lyx
///
InsetCode lyxCode() const;
///
+ bool hasSettings() const { return true; }
+ ///
DisplayType display() const { return AlignCenter; }
///
docstring screenLabel() const;
{ return s == "printnomenclature"; }
///
int latex(odocstream &, OutputParams const &) const;
+ ///
+ docstring contextMenu(BufferView const & bv, int x, int y) const;
+protected:
+ ///
+ void doDispatch(Cursor & cur, FuncRequest & cmd);
+ ///
+ bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
Inset * clone() const { return new InsetPrintNomencl(*this); }
};