diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index c52381bcaf..40a4917419 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -491,6 +491,16 @@ InsetLayout Caption:Standard End +InsetLayout Caption:LongTableNoNumber + CopyStyle Caption:Standard + LatexName caption* + Argument 1 + LabelString "Long Table Caption (unnumbered)" + Tooltip "The caption as it appears in the list of tables" + EndArgument +End + + InsetLayout Preview LabelString Preview Decoration minimalistic diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index a7c78f6242..8b51b2e203 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -3161,7 +3161,6 @@ def convert_captioninsets(document): return document.body[i] = "\\begin_inset Caption Standard" i = i + 1 - def revert_captioninsets(document): @@ -3178,7 +3177,7 @@ def revert_captioninsets(document): def convert_captionlayouts(document): " Convert caption layouts to caption insets. " - + caption_dict = { "Captionabove": "Above", "Captionbelow": "Below", @@ -3187,7 +3186,7 @@ def convert_captionlayouts(document): "CenteredCaption" : "Centered", "Bicaption" : "Bicaption", } - + i = 0 while True: i = find_token(document.body, "\\begin_layout", i) @@ -4080,6 +4079,20 @@ def revert_mbox_fbox(document): i = i + 1 +def revert_starred_caption(document): + " Reverts unnumbered longtable caption insets " + + i = 0 + while True: + i = find_token(document.body, "\\begin_inset Caption LongTableNoNumber", i) + if i == -1: + return + # This is not equivalent, but since the caption inset is a full blown + # text inset a true conversion to ERT is too difficult. + document.body[i] = "\\begin_inset Caption Standard" + i = i + 1 + + ## # Conversion hub # @@ -4140,10 +4153,12 @@ convert = [ [465, [convert_lyxframes, remove_endframes]], [466, []], [467, []], - [468, []] + [468, []], + [469, []] ] revert = [ + [468, [revert_starred_caption]], [467, [revert_mbox_fbox]], [466, [revert_iwona_fonts]], [465, [revert_powerdot_flexes, revert_powerdot_pause, revert_powerdot_itemargs, revert_powerdot_columns]], diff --git a/src/Text3.cpp b/src/Text3.cpp index fad451c728..b87cf2904a 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -2527,13 +2527,12 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, } case LFUN_CAPTION_INSERT: { code = CAPTION_CODE; - bool varia = true; - if (cur.depth() > 0) { - if (&cur[cur.depth() - 1].inset() - && !cur[cur.depth() - 1].inset().allowsCaptionVariation()) - varia = false; - } string arg = cmd.getArg(0); + bool varia = arg != "LongTableNoNumber"; + if (cur.depth() > 0) { + if (&cur[cur.depth() - 1].inset()) + varia = cur[cur.depth() - 1].inset().allowsCaptionVariation(arg); + } // not allowed in description items, // and in specific insets enable = !inDescriptionItem(cur) diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index cd7518b481..0985a9d2c5 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -1634,16 +1634,18 @@ void MenuDefinition::expandCaptions(Buffer const * buf, bool switchcap) docstring const type = split(*cit, dummy, ':'); docstring const trtype = translateIfPossible(type); docstring const cmitem = bformat(_("Caption (%1$s)"), trtype); - if (switchcap) - addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cmitem), - FuncRequest(LFUN_INSET_MODIFY, - from_ascii("changetype ") - + type), QString(), true)); - else - captions.addWithStatusCheck(MenuItem(MenuItem::Command, - toqstr(trtype), - FuncRequest(LFUN_CAPTION_INSERT, - type), QString(), true)); + // make menu item optional, otherwise we would also see + // forbidden caption types + if (switchcap) + addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(cmitem), + FuncRequest(LFUN_INSET_MODIFY, + from_ascii("changetype ") + + type), QString(), true)); + else + captions.addWithStatusCheck(MenuItem(MenuItem::Command, + toqstr(trtype), + FuncRequest(LFUN_CAPTION_INSERT, + type), QString(), true)); } if (!captions.empty()) { MenuItem item(MenuItem::Submenu, qt_("Caption")); @@ -1796,7 +1798,7 @@ struct Menus::Impl { /** The entries with the following kind are expanded to a sequence of Command MenuItems: Lastfiles, Documents, ViewFormats, ExportFormats, UpdateFormats, Branches, - Indices, Arguments, SwitchArguments, Captions, Switchcaptions + Indices, Arguments, SwitchArguments, Captions, SwitchCaptions */ void expand(MenuDefinition const & frommenu, MenuDefinition & tomenu, BufferView const *) const; diff --git a/src/insets/Inset.h b/src/insets/Inset.h index 36a0f929d8..4b450c10dd 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -351,7 +351,7 @@ public: /// can we click at the specified position ? virtual bool clickable(int, int) const { return false; } /// Move one cell backwards - virtual bool allowsCaptionVariation() const { return false; } + virtual bool allowsCaptionVariation(std::string const &) const { return false; } /// does this contain text that can be change track marked in DVI? virtual bool canTrackChanges() const { return false; } diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index 035a5feda0..4c7cd74e4e 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -229,12 +229,11 @@ bool InsetCaption::getStatus(Cursor & cur, FuncRequest const & cmd, if (first_arg == "changetype") { string const type = cmd.getArg(1); status.setOnOff(type == type_); - bool varia = true; + bool varia = type != "LongTableNoNumber"; // check if the immediate parent inset allows caption variation if (cur.depth() > 1) { - if (&cur[cur.depth() - 2].inset() - && !cur[cur.depth() - 2].inset().allowsCaptionVariation()) - varia = false; + if (&cur[cur.depth() - 2].inset()) + varia = cur[cur.depth() - 2].inset().allowsCaptionVariation(type); } status.setEnabled(varia && buffer().params().documentClass().hasInsetLayout( diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index bd465fbc3e..5121d7263f 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -470,6 +470,12 @@ void InsetFloat::setNewLabel() } +bool InsetFloat::allowsCaptionVariation(std::string const & newtype) const +{ + return !params_.subfloat && newtype != "LongTableNoNumber"; +} + + docstring InsetFloat::getCaption(OutputParams const & runparams) const { if (paragraphs().empty()) diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index f254bc48db..6cff108975 100644 --- a/src/insets/InsetFloat.h +++ b/src/insets/InsetFloat.h @@ -68,7 +68,7 @@ public: /// InsetFloatParams const & params() const { return params_; } /// - bool allowsCaptionVariation() const { return !params_.subfloat; } + bool allowsCaptionVariation(std::string const &) const; private: /// docstring layoutName() const; diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 379d296344..2c9967013e 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3480,6 +3480,13 @@ bool InsetTabular::insetAllowed(InsetCode code) const } +bool InsetTabular::allowsCaptionVariation(std::string const & newtype) const +{ + return tabular.is_long_tabular && + (newtype == "Standard" || newtype == "LongTableNoNumber"); +} + + void InsetTabular::write(ostream & os) const { os << "Tabular" << endl; diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index e4651a3b8f..178060e86a 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -854,6 +854,8 @@ public: insets that may contain several paragraphs */ bool inheritFont() const { return false; } /// + bool allowsCaptionVariation(std::string const &) const; + /// DisplayType display() const; /// void latex(otexstream &, OutputParams const &) const; diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index 97b4ae7747..17979db985 100644 --- a/src/tex2lyx/TODO.txt +++ b/src/tex2lyx/TODO.txt @@ -88,8 +88,6 @@ Format LaTeX feature LyX feature \usepackage[scale|scaled=$val]{biolinum-type1} \font_sans \font_sf_scale -463 -465 466 Powerdot updates: \pause[] layout Pause \onslide{}{} InsetFlex, InsetArgument @@ -100,6 +98,7 @@ Format LaTeX feature LyX feature \begin{enumerate|itemize|...}[] InsetArgument 467 support for iwona math font (the other iwona fonts are already supported) + General * Use the language information provided by Language.cpp and the languages file (for babel/lyx/polyglossia name, quote style etc.) diff --git a/src/tex2lyx/test/CJK.lyx.lyx b/src/tex2lyx/test/CJK.lyx.lyx index c288615a0c..0c3968a676 100644 --- a/src/tex2lyx/test/CJK.lyx.lyx +++ b/src/tex2lyx/test/CJK.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/CJKutf8.lyx.lyx b/src/tex2lyx/test/CJKutf8.lyx.lyx index 6792280f1f..d62a98a966 100644 --- a/src/tex2lyx/test/CJKutf8.lyx.lyx +++ b/src/tex2lyx/test/CJKutf8.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/Dummy Document.lyx b/src/tex2lyx/test/Dummy Document.lyx index bbae1d6b6d..f5f506eb92 100644 --- a/src/tex2lyx/test/Dummy Document.lyx +++ b/src/tex2lyx/test/Dummy Document.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/DummyDocument.lyx b/src/tex2lyx/test/DummyDocument.lyx index 63abd7ec05..9cdbd3bfa8 100644 --- a/src/tex2lyx/test/DummyDocument.lyx +++ b/src/tex2lyx/test/DummyDocument.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/Dummy~Document.lyx b/src/tex2lyx/test/Dummy~Document.lyx index 5243c6c9c1..22e3d7fb56 100644 --- a/src/tex2lyx/test/Dummy~Document.lyx +++ b/src/tex2lyx/test/Dummy~Document.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx index 5abbf753d9..5561d4bf9b 100644 --- a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx +++ b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx index 081df6b19f..720143a253 100644 --- a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx +++ b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 468 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/test-insets.lyx.lyx b/src/tex2lyx/test/test-insets.lyx.lyx index 43506536d9..6e79b6af51 100644 --- a/src/tex2lyx/test/test-insets.lyx.lyx +++ b/src/tex2lyx/test/test-insets.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article @@ -1369,7 +1369,7 @@ clearpage} \begin_layout Standard \begin_inset Tabular - + @@ -1547,11 +1547,46 @@ Second \end_layout +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard + +\begin_inset Caption LongTableNoNumber + +\begin_layout Standard + +\begin_inset Argument 1 +status collapsed + +\begin_layout Standard +An optional table foot caption (used in the list of tables) +\end_layout + +\end_inset + +standard foot +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + \end_inset - + \begin_inset Text \begin_layout Standard @@ -1560,13 +1595,44 @@ This goes at the \end_inset - + \begin_inset Text \begin_layout Standard bottom. \end_layout +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard + +\begin_inset Caption LongTableNoNumber + +\begin_layout Standard + +\begin_inset Argument 1 +status collapsed + +\end_inset + +(last foot) +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + \end_inset diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex index 0feb452c06..bb5844a1fa 100644 --- a/src/tex2lyx/test/test-insets.tex +++ b/src/tex2lyx/test/test-insets.tex @@ -277,10 +277,14 @@ KILLED & LINE!!!! \kill \textbf{First}&\textbf{Second}\\ \hline\hline \endhead +\caption* +[An optional table foot caption (used in the list of tables)] +{standard foot}\\ \hline This goes at the&bottom.\\ \hline \endfoot +\caption*[]{(last foot)}\\ \hline These lines will&appear\\ in place of the & usual foot\\ diff --git a/src/tex2lyx/test/test-modules.lyx.lyx b/src/tex2lyx/test/test-modules.lyx.lyx index 749b458713..40bab95199 100644 --- a/src/tex2lyx/test/test-modules.lyx.lyx +++ b/src/tex2lyx/test/test-modules.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass amsart diff --git a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx index 2e96425a8c..c072e31b23 100644 --- a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx +++ b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass book diff --git a/src/tex2lyx/test/test-structure.lyx.lyx b/src/tex2lyx/test/test-structure.lyx.lyx index 621d9d6486..cbddc69888 100644 --- a/src/tex2lyx/test/test-structure.lyx.lyx +++ b/src/tex2lyx/test/test-structure.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/test.lyx.lyx b/src/tex2lyx/test/test.lyx.lyx index 7cffee07e6..b86ec8fb69 100644 --- a/src/tex2lyx/test/test.lyx.lyx +++ b/src/tex2lyx/test/test.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/test/verbatim.lyx.lyx b/src/tex2lyx/test/verbatim.lyx.lyx index 7099d8dc13..9e13dccdca 100644 --- a/src/tex2lyx/test/verbatim.lyx.lyx +++ b/src/tex2lyx/test/verbatim.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.1.0dev -\lyxformat 467 +\lyxformat 469 \begin_document \begin_header \textclass article diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 3898fb63a2..2206e00370 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -2792,10 +2792,18 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, } else if (t.cs() == "caption") { + bool starred = false; + if (p.next_token().asInput() == "*") { + p.get_token(); + starred = true; + } p.skip_spaces(); context.check_layout(os); p.skip_spaces(); - begin_inset(os, "Caption Standard\n"); + if (starred) + begin_inset(os, "Caption LongTableNoNumber\n"); + else + begin_inset(os, "Caption Standard\n"); Context newcontext(true, context.textclass, 0, 0, context.font); newcontext.check_layout(os); // FIXME InsetArgument is now properly implemented in InsetLayout diff --git a/src/version.h b/src/version.h index fcf348a214..0aee452a27 100644 --- a/src/version.h +++ b/src/version.h @@ -30,8 +30,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 468 // uwestoehr: mbox/fbox support -#define LYX_FORMAT_TEX2LYX 468 // uwestoehr: mbox/fbox support +#define LYX_FORMAT_LYX 469 // gb: \caption*{} +#define LYX_FORMAT_TEX2LYX 469 // gb: \caption*{} #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER