>>>>> "Bernhard" == Bernhard Roider <[EMAIL PROTECTED]> writes:

Bernhard> Hello, with the attached patch lyx loads all
Bernhard> external_template definitions from 1. user_lyxdir 2.
Bernhard> build_lyxdir 3. system_lyxdir

I'd rather not do it right now. We have to decide what is our policy
for handling stuff in system dir vs stuff in .lyx. We cannot decide
file by file whether in one case the system version is read, but not
in the other. The behaviour should be predictable. Since we did not
have complaints about the way user templates work besides this crash,
I'd rather not change it.

Bernhard> If there are template or preamble definitions with the same
Bernhard> name from different sources then lyx prints a warning
Bernhard> message to the console and the first definition (in the
Bernhard> above order) is used.

I am not sure this is needed.

What about a different idea: since the problem is the hardcoding of
RasterImage, we could replace it by code like the following.

JMarc

Index: src/insets/InsetExternal.cpp
===================================================================
--- src/insets/InsetExternal.cpp	(révision 18996)
+++ src/insets/InsetExternal.cpp	(copie de travail)
@@ -59,7 +59,7 @@ lyx::external::DisplayType const default
 
 unsigned int const defaultLyxScale = 100;
 
-string defaultTemplateName = "RasterImage";
+string defaultTemplateName;
 
 } // namespace anon
 
@@ -132,9 +132,15 @@ Translator<DisplayType, string> const & 
 InsetExternalParams::InsetExternalParams()
 	: display(defaultDisplayType),
 	  lyxscale(defaultLyxScale),
-	  draft(false),
-	  templatename_(defaultTemplateName)
-{}
+	  draft(false)
+{
+	if (defaultTemplateName.empty()) {
+		external::TemplateManager const & etm =
+			external::TemplateManager::get();
+		templatename_ = etm.getTemplates().begin()->first;
+	} else
+		templatename_ = defaultTemplateName;
+}
 
 
 namespace {

Reply via email to