mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
Enhance LyX by fixing bug 5587. We add a new ContentAsLabel tag to
InsetLayout, per Jurgen's suggestion, so that insets can be told to display an abbreviated form of their content when closed. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32575 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e1ed39f8b4
commit
08b63ad3c6
@ -1,5 +1,5 @@
|
||||
#LyX 2.0.0svn created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 372
|
||||
\lyxformat 373
|
||||
\begin_document
|
||||
\begin_header
|
||||
\textclass scrbook
|
||||
@ -12868,6 +12868,43 @@ src/ColorCode.h
|
||||
\begin_inset Flex CharStyle:Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
ContentAsLabel
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
[
|
||||
\begin_inset Flex CharStyle:Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\emph on
|
||||
0
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
,
|
||||
\begin_inset Flex CharStyle:Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
1
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
] Whether to use the content of the inset as the label, when the inset is
|
||||
closed.
|
||||
Default is false.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex CharStyle:Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
CopyStyle
|
||||
\end_layout
|
||||
@ -13121,6 +13158,7 @@ status collapsed
|
||||
|
||||
] Indicates whether the PlainLayout should be used or, instead, the user
|
||||
can change the paragraph style used in the inset.
|
||||
Default is false.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
@ -13141,6 +13179,7 @@ reference "des:FreeSpacing"
|
||||
\end_inset
|
||||
|
||||
).
|
||||
Default is false.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
@ -13201,6 +13240,7 @@ reference "des:KeepEmpty"
|
||||
\end_inset
|
||||
|
||||
).
|
||||
Default is false.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
@ -13409,13 +13449,43 @@ status collapsed
|
||||
\end_inset
|
||||
|
||||
] Whether multiple paragraphs are permitted in this inset.
|
||||
This will also set CustomPars to the same value and ForcePlain to the opposite
|
||||
value.
|
||||
This will also set
|
||||
\begin_inset Flex CharStyle:Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
CustomPars
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
to the same value and
|
||||
\begin_inset Flex CharStyle:Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
ForcePlain
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
to the opposite value.
|
||||
These can be reset to other values, if they are used
|
||||
\emph on
|
||||
after
|
||||
\emph default
|
||||
MultiPar.
|
||||
|
||||
\begin_inset Flex CharStyle:Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
MultiPar
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
Default is true.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
@ -13467,7 +13537,7 @@ protect
|
||||
\emph on
|
||||
not
|
||||
\emph default
|
||||
whether the command should itself be protected.)
|
||||
whether the command should itself be protected.) Default is false.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
@ -13504,12 +13574,13 @@ status collapsed
|
||||
|
||||
] As with paragraph styles (see page
|
||||
\begin_inset CommandInset ref
|
||||
LatexCommand ref
|
||||
LatexCommand pageref
|
||||
reference "des:PathThru"
|
||||
|
||||
\end_inset
|
||||
|
||||
).
|
||||
Default is false.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -305,6 +305,7 @@ InsetLayout URL
|
||||
LyXType standard
|
||||
Decoration classic
|
||||
LabelString URL
|
||||
ContentAsLabel true
|
||||
LatexName url
|
||||
LatexType command
|
||||
Requires url
|
||||
|
@ -73,10 +73,13 @@ import os, re, string, sys
|
||||
# Incremented to format 19, 17 November 2009 by rgh
|
||||
# Added InPreamble tag.
|
||||
|
||||
# Incremented to format 20, 17 December 2009 by rgh
|
||||
# Added ContentAsLabel tag.
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
currentFormat = 19
|
||||
currentFormat = 20
|
||||
|
||||
|
||||
def usage(prog_name):
|
||||
@ -245,7 +248,7 @@ def convert(lines):
|
||||
continue
|
||||
|
||||
# This just involved new features, not any changes to old ones
|
||||
if format == 14 or format == 15 or format == 16 or format == 17 or format == 18:
|
||||
if format >= 14 and format <= 19:
|
||||
i += 1
|
||||
continue
|
||||
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
};
|
||||
|
||||
// Keep the changes documented in the Customization manual.
|
||||
int const FORMAT = 19;
|
||||
int const FORMAT = 20;
|
||||
|
||||
|
||||
bool layout2layout(FileName const & filename, FileName const & tempfile)
|
||||
|
@ -573,10 +573,14 @@ void InsetCollapsable::setLabel(docstring const & l)
|
||||
}
|
||||
|
||||
|
||||
docstring const InsetCollapsable::buttonLabel(BufferView const &) const
|
||||
docstring const InsetCollapsable::buttonLabel(BufferView const & bv) const
|
||||
{
|
||||
return labelstring_.empty() ?
|
||||
docstring const label = labelstring_.empty() ?
|
||||
translateIfPossible(getLayout().labelstring()) : labelstring_;
|
||||
InsetLayout const & il = getLayout();
|
||||
if (!il.contentaslabel() || geometry(bv) != ButtonOnly)
|
||||
return label;
|
||||
return getNewLabel(label);
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,8 +31,8 @@ namespace lyx {
|
||||
|
||||
InsetLayout::InsetLayout() :
|
||||
name_(from_ascii("undefined")), lyxtype_(STANDARD),
|
||||
labelstring_(from_ascii("UNDEFINED")), decoration_(DEFAULT),
|
||||
latextype_(NOLATEXTYPE), font_(sane_font),
|
||||
labelstring_(from_ascii("UNDEFINED")), contentaslabel_(false),
|
||||
decoration_(DEFAULT), latextype_(NOLATEXTYPE), font_(sane_font),
|
||||
labelfont_(sane_font), bgcolor_(Color_error),
|
||||
htmlforcecss_ (false), htmlisblock_(true),
|
||||
multipar_(true), custompars_(true), forceplain_(false),
|
||||
@ -74,6 +74,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
{
|
||||
enum {
|
||||
IL_BGCOLOR,
|
||||
IL_CONTENTASLABEL,
|
||||
IL_COPYSTYLE,
|
||||
IL_COUNTER,
|
||||
IL_CUSTOMPARS,
|
||||
@ -110,6 +111,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
|
||||
LexerKeyword elementTags[] = {
|
||||
{ "bgcolor", IL_BGCOLOR },
|
||||
{ "contentaslabel", IL_CONTENTASLABEL },
|
||||
{ "copystyle", IL_COPYSTYLE },
|
||||
{ "counter", IL_COUNTER},
|
||||
{ "custompars", IL_CUSTOMPARS },
|
||||
@ -240,6 +242,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass)
|
||||
case IL_NEEDPROTECT:
|
||||
lex >> needprotect_;
|
||||
break;
|
||||
case IL_CONTENTASLABEL:
|
||||
lex >> contentaslabel_;
|
||||
break;
|
||||
case IL_COPYSTYLE: { // initialize with a known style
|
||||
docstring style;
|
||||
lex >> style;
|
||||
|
@ -66,6 +66,8 @@ public:
|
||||
///
|
||||
docstring labelstring() const { return labelstring_; }
|
||||
///
|
||||
bool contentaslabel() const { return contentaslabel_; }
|
||||
///
|
||||
InsetDecoration decoration() const { return decoration_; }
|
||||
///
|
||||
InsetLaTeXType latextype() const { return latextype_; }
|
||||
@ -143,6 +145,8 @@ private:
|
||||
///
|
||||
docstring labelstring_;
|
||||
///
|
||||
bool contentaslabel_;
|
||||
///
|
||||
InsetDecoration decoration_;
|
||||
///
|
||||
InsetLaTeXType latextype_;
|
||||
|
Loading…
Reference in New Issue
Block a user