Any thoughts?

rh

Index: src/insets/InsetLayout.cpp
===================================================================
--- src/insets/InsetLayout.cpp	(revision 32554)
+++ src/insets/InsetLayout.cpp	(working copy)
@@ -31,8 +31,8 @@
 
 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 @@
 {
 	enum {
 		IL_BGCOLOR,
+		IL_CONTENTASLABEL,
 		IL_COPYSTYLE,
 		IL_COUNTER,
 		IL_CUSTOMPARS,
@@ -110,6 +111,7 @@
 
 	LexerKeyword elementTags[] = {
 		{ "bgcolor", IL_BGCOLOR },
+		{ "contentaslabel", IL_CONTENTASLABEL },
 		{ "copystyle", IL_COPYSTYLE }, 
 		{ "counter", IL_COUNTER},
 		{ "custompars", IL_CUSTOMPARS },
@@ -240,6 +242,9 @@
 		case IL_NEEDPROTECT:
 			lex >> needprotect_;
 			break;
+		case IL_CONTENTASLABEL:
+			lex >> contentaslabel_;
+			break;
 		case IL_COPYSTYLE: {     // initialize with a known style
 			docstring style;
 			lex >> style;
Index: src/insets/InsetLayout.h
===================================================================
--- src/insets/InsetLayout.h	(revision 32554)
+++ src/insets/InsetLayout.h	(working copy)
@@ -66,6 +66,8 @@
 	///
 	docstring labelstring() const { return labelstring_; }
 	///
+	bool contentaslabel() const { return contentaslabel_; }
+	///
 	InsetDecoration decoration() const { return decoration_; }
 	///
 	InsetLaTeXType latextype() const { return latextype_; }
@@ -143,6 +145,8 @@
 	///
 	docstring labelstring_;
 	///
+	bool contentaslabel_;
+	///
 	InsetDecoration decoration_;
 	///
 	InsetLaTeXType latextype_;
Index: src/insets/InsetCollapsable.cpp
===================================================================
--- src/insets/InsetCollapsable.cpp	(revision 32554)
+++ src/insets/InsetCollapsable.cpp	(working copy)
@@ -573,10 +573,14 @@
 }
 
 
-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);
 }
 
 
Index: lib/layouts/stdinsets.inc
===================================================================
--- lib/layouts/stdinsets.inc	(revision 32554)
+++ lib/layouts/stdinsets.inc	(working copy)
@@ -305,6 +305,7 @@
 	LyXType               standard
 	Decoration            classic
 	LabelString           URL
+	ContentAsLabel        true
 	LatexName             url
 	LatexType             command
 	Requires              url

Reply via email to