We're getting closer and closer to really useful customizable insets ;-)

Goes in if nobody sees a problem.

- Martin
Index: src/insets/InsetCharStyle.h
===================================================================
--- src/insets/InsetCharStyle.h	(revision 19665)
+++ src/insets/InsetCharStyle.h	(working copy)
@@ -76,8 +76,6 @@
 		    OutputParams const &) const;
 	/// the string that is passed to the TOC
 	virtual void textString(Buffer const &, odocstream &) const;
-	///
-	void validate(LaTeXFeatures &) const;
 
 	///
 	InsetCharStyleParams const & params() const { return params_; }
Index: src/insets/InsetCollapsable.h
===================================================================
--- src/insets/InsetCollapsable.h	(revision 19665)
+++ src/insets/InsetCollapsable.h	(working copy)
@@ -133,6 +133,8 @@
 	///
 	int latex(Buffer const &, odocstream &,
 		  OutputParams const &) const;
+	///
+	void validate(LaTeXFeatures &) const;
 
 protected:
 	///
Index: src/insets/InsetCharStyle.cpp
===================================================================
--- src/insets/InsetCharStyle.cpp	(revision 19665)
+++ src/insets/InsetCharStyle.cpp	(working copy)
@@ -22,7 +22,6 @@
 #include "FuncStatus.h"
 #include "Cursor.h"
 #include "gettext.h"
-#include "LaTeXFeatures.h"
 #include "Color.h"
 #include "Lexer.h"
 #include "Text.h"
@@ -242,14 +241,6 @@
 }
 
 
-void InsetCharStyle::validate(LaTeXFeatures & features) const
-{
-	// Force inclusion of preamble snippet in layout file
-	features.require(layout_.latexname);
-	InsetText::validate(features);
-}
-
-
 void InsetCharStyleParams::write(ostream & os) const
 {
 	os << "CharStyle " << name << "\n";
Index: src/insets/InsetCollapsable.cpp
===================================================================
--- src/insets/InsetCollapsable.cpp	(revision 19665)
+++ src/insets/InsetCollapsable.cpp	(working copy)
@@ -24,6 +24,7 @@
 #include "FuncStatus.h"
 #include "gettext.h"
 #include "Color.h"
+#include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "FuncRequest.h"
 #include "MetricsInfo.h"
@@ -651,4 +652,12 @@
 }
 
 
+void InsetCollapsable::validate(LaTeXFeatures & features) const
+{
+	// Force inclusion of preamble snippet in layout file
+	features.addPreambleSnippet(layout_.preamble);
+	InsetText::validate(features);
+}
+
+
 } // namespace lyx
Index: lib/layouts/stdcharstyles.inc
===================================================================
--- lib/layouts/stdcharstyles.inc	(revision 19656)
+++ lib/layouts/stdcharstyles.inc	(working copy)
@@ -2,7 +2,7 @@
 # Author : Martin vermeer <[EMAIL PROTECTED]>
 # Character Styles definition
 
-Format 4
+Format 5
 InsetLayout CharStyle:Noun
 	LyxType               charstyle
 	LabelString           noun
@@ -11,6 +11,9 @@
 	Font
 	  Shape               Smallcaps
 	EndFont
+	Preamble
+	\newcommand{\noun}[1]{\textsc{#1}}
+	EndPreamble
 End
 
 

Reply via email to