This is (mostly) about LaTeX output. Finally using those parameters in the 
layout files.

Soon to be committed.

- Martin
Index: InsetCharStyle.h
===================================================================
--- InsetCharStyle.h	(revision 19642)
+++ InsetCharStyle.h	(working copy)
@@ -69,9 +69,6 @@
 	virtual Decoration decoration() const { return Conglomerate; }
 
 	///
-	int latex(Buffer const &, odocstream &,
-		  OutputParams const &) const;
-	///
 	int plaintext(Buffer const &, odocstream &,
 		      OutputParams const &) const;
 	///
Index: InsetNote.cpp
===================================================================
--- InsetNote.cpp	(revision 19655)
+++ InsetNote.cpp	(working copy)
@@ -232,14 +232,6 @@
 	case LFUN_INSET_DIALOG_UPDATE:
 		InsetNoteMailer(*this).updateDialog(&cur.bv());
 		break;
-
-	case LFUN_MOUSE_RELEASE:
-		if (cmd.button() == mouse_button::button3 && hitButton(cmd))
-			InsetNoteMailer(*this).showDialog(&cur.bv());
-		else
-			InsetCollapsable::doDispatch(cur, cmd);
-		break;
-
 	default:
 		InsetCollapsable::doDispatch(cur, cmd);
 		break;
@@ -285,10 +277,7 @@
 	} 
 
 	odocstringstream ss;
-	//ss << "%\n\\begin{" << from_ascii(type) << "}\n";
-	ss << "%\n\\begin{" << from_ascii(layout_.latexname) << "}\n";
-	InsetText::latex(buf, ss, runparams);
-	ss << "\n\\end{" << from_ascii(layout_.latexname) << "}\n";
+	InsetCollapsable::latex(buf, ss, runparams);
 	// the space after the comment in 'a[comment] b' will be eaten by the
 	// comment environment since the space before b is ignored with the
 	// following latex output:
Index: InsetCharStyle.cpp
===================================================================
--- InsetCharStyle.cpp	(revision 19654)
+++ InsetCharStyle.cpp	(working copy)
@@ -204,23 +204,6 @@
 }
 
 
-int InsetCharStyle::latex(Buffer const & buf, odocstream & os,
-			  OutputParams const & runparams) const
-{
-	if (!undefined()) {
-		// FIXME UNICODE
-		os << '\\' << from_utf8(layout_.latexname);
-		if (!layout_.latexparam.empty())
-			os << from_utf8(layout_.latexparam);
-		os << '{';
-	}
-	int i = InsetText::latex(buf, os, runparams);
-	if (!undefined())
-		os << "}";
-	return i;
-}
-
-
 int InsetCharStyle::plaintext(Buffer const & buf, odocstream & os,
 			      OutputParams const & runparams) const
 {
@@ -262,7 +245,7 @@
 void InsetCharStyle::validate(LaTeXFeatures & features) const
 {
 	// Force inclusion of preamble snippet in layout file
-	features.require(params_.name);
+	features.require(layout_.latexname);
 	InsetText::validate(features);
 }
 
Index: InsetCollapsable.cpp
===================================================================
--- InsetCollapsable.cpp	(revision 19654)
+++ InsetCollapsable.cpp	(working copy)
@@ -618,4 +618,37 @@
 }
 
 
+
+int InsetCollapsable::latex(Buffer const & buf, odocstream & os,
+			  OutputParams const & runparams) const
+{
+	// This implements the standard way of handling the LaTeX output of
+	// a collapsable inset, either a command or an environment. Standard 
+	// collapsable insets should not redefine this, non-standard ones may
+	// call this.
+	if (!layout_.latexname.empty()) {
+		if (layout_.latextype == "command") {
+			// FIXME UNICODE
+			os << '\\' << from_utf8(layout_.latexname);
+			if (!layout_.latexparam.empty())
+				os << from_utf8(layout_.latexparam);
+			os << '{';
+		} else if (layout_.latextype == "environment") {
+			os << "%\n\\begin{" << from_utf8(layout_.latexname) << "}\n";
+			if (!layout_.latexparam.empty())
+				os << from_utf8(layout_.latexparam);
+		}
+	}
+	int i = InsetText::latex(buf, os, runparams);
+	if (!layout_.latexname.empty())
+		if (layout_.latextype == "command") {
+			os << "}";
+		} else if (layout_.latextype == "environment") {
+			os << "\n\\end{" << from_utf8(layout_.latexname) << "}\n";
+			i += 4;
+		}
+	return i;
+}
+
+
 } // namespace lyx
Index: InsetCollapsable.h
===================================================================
--- InsetCollapsable.h	(revision 19648)
+++ InsetCollapsable.h	(working copy)
@@ -130,6 +130,9 @@
 	void setStatus(Cursor & cur, CollapseStatus st);
 	///
 	bool setMouseHover(bool mouse_hover);
+	///
+	int latex(Buffer const &, odocstream &,
+		  OutputParams const &) const;
 
 protected:
 	///

Reply via email to