Richard Heck wrote:
I haven't tested, but I know you'll need to add a do-nothing reversion as well. And the format number went to 283 earlier, so:
Thanks. Here is the patch again, with version 284 and do-nothing reversion.

I don't think I have the power to commit such things, so
I hope someone else can do that - provided the patch is ok of course.

Helge Hafting
Index: src/insets/InsetWrap.cpp
===================================================================
--- src/insets/InsetWrap.cpp	(revisjon 20164)
+++ src/insets/InsetWrap.cpp	(arbeidskopi)
@@ -175,7 +175,7 @@
 
 void InsetWrap::validate(LaTeXFeatures & features) const
 {
-	features.require("floatflt");
+	features.require("wrapfig");
 	InsetCollapsable::validate(features);
 }
 
@@ -195,12 +195,13 @@
 int InsetWrap::latex(Buffer const & buf, odocstream & os,
 		     OutputParams const & runparams) const
 {
-	os << "\\begin{floating" << from_ascii(params_.type) << '}';
+	os << "\\begin{wrap" << from_ascii(params_.type) << '}';
 	if (!params_.placement.empty())
-		os << '[' << from_ascii(params_.placement) << ']';
+		os << '{' << from_ascii(params_.placement) << '}';
+		else os << "{o}"; //Outer is default in the current UI
 	os << '{' << from_ascii(params_.width.asLatexString()) << "}%\n";
 	int const i = InsetText::latex(buf, os, runparams);
-	os << "\\end{floating" << from_ascii(params_.type) << "}%\n";
+	os << "\\end{wrap" << from_ascii(params_.type) << "}%\n";
 	return i + 2;
 }
 
Index: src/frontends/qt4/GuiWrap.cpp
===================================================================
--- src/frontends/qt4/GuiWrap.cpp	(revisjon 20164)
+++ src/frontends/qt4/GuiWrap.cpp	(arbeidskopi)
@@ -103,7 +103,7 @@
 		params.placement = "r";
 		break;
 	case 3:
-		params.placement = "p";
+		params.placement = "o";
 		break;
 	}
 }
@@ -112,10 +112,9 @@
 static string const numtostr(double val)
 {
 	string a = convert<string>(val);
-	// FIXME: Will this test ever trigger? (Lgb)
-	if (a == "0")
-		a.erase();
 	return a;
+	//0pt is a legal width now, it yields a
+	//wrapfloat just wide enough for the contents.
 }
 
 
@@ -132,7 +131,7 @@
 		item = 1;
 	else if (params.placement == "r")
 		item = 2;
-	else if (params.placement == "p")
+	else if (params.placement == "o")
 		item = 3;
 
 	valignCO->setCurrentIndex(item);
Index: src/factory.cpp
===================================================================
--- src/factory.cpp	(revisjon 20164)
+++ src/factory.cpp	(arbeidskopi)
@@ -173,7 +173,7 @@
 			string const argument = to_utf8(cmd.argument());
 			if (argument == "figure")
 				return new InsetWrap(params, argument);
-			lyxerr << "Non-existent floatflt type: " << argument << endl;
+			lyxerr << "Non-existent wrapfig type: " << argument << endl;
 			return 0;
 		}
 
Index: src/LaTeXFeatures.cpp
===================================================================
--- src/LaTeXFeatures.cpp	(revisjon 20164)
+++ src/LaTeXFeatures.cpp	(arbeidskopi)
@@ -397,7 +397,7 @@
 	"latexsym",
 	"pifont",
 	"subfigure",
-	"floatflt",
+	"wrapfig",
 	"varioref",
 	"prettyref",
 	"float",
Index: src/Buffer.cpp
===================================================================
--- src/Buffer.cpp	(revisjon 20164)
+++ src/Buffer.cpp	(arbeidskopi)
@@ -142,7 +142,7 @@
 
 namespace {
 
-int const LYX_FORMAT = 283;
+int const LYX_FORMAT = 284;
 
 } // namespace anon
 
Index: lib/lyx2lyx/LyX.py
===================================================================
--- lib/lyx2lyx/LyX.py	(revisjon 20164)
+++ lib/lyx2lyx/LyX.py	(arbeidskopi)
@@ -78,7 +78,7 @@
                    ("1_3",     [221], generate_minor_versions("1.3" , 7)),
                    ("1_4", range(222,246), generate_minor_versions("1.4" , 5)),
                    ("1_5", range(246,277), generate_minor_versions("1.5" , 1)),
-                   ("1_6", range(277,284), generate_minor_versions("1.6" , 0))]
+                   ("1_6", range(277,285), generate_minor_versions("1.6" , 0))]
 
 
 def formats_list():
Index: lib/lyx2lyx/lyx_1_6.py
===================================================================
--- lib/lyx2lyx/lyx_1_6.py	(revisjon 20164)
+++ lib/lyx2lyx/lyx_1_6.py	(arbeidskopi)
@@ -187,10 +187,12 @@
            [280, [axe_show_label]],
            [281, []],
            [282, []],
-           [283, [convert_flex]]
+           [283, [convert_flex]],
+	   [284, []]
           ]
 
 revert =  [
+           [283, []],
            [282, [revert_flex]],
            [281, []],
            [280, [revert_begin_modules]],
Index: lib/chkconfig.ltx
===================================================================
--- lib/chkconfig.ltx	(revisjon 20164)
+++ lib/chkconfig.ltx	(arbeidskopi)
@@ -230,7 +230,7 @@
 \TestPackage{esint}
 \TestPackage{fancybox}
 \TestPackage{fancyhdr}
-\TestPackage{floatflt}
+\TestPackage{wrapfig}
 \TestPackage{framed}
 \TestPackage{geometry}
 \TestPackage{jurabib}
Index: development/FORMAT
===================================================================
--- development/FORMAT	(revisjon 20164)
+++ development/FORMAT	(arbeidskopi)
@@ -1,6 +1,14 @@
 LyX file-format changes
 -----------------------
 
+2007-09-09 Helge Hafting
+	* Format incremented to 284: LyX now implements wrapped figures
+	  using wrapfig.sty instead of floatflt.sty. The latter
+	  is rather buggy, the former also has more options.
+	  No conversion as the .lyx doesn't change.
+	  The .tex export is slightly different, necessitating the
+	  format increase.
+
 2007-09-08 Martin Vermeer
 
 	* format incremented to 283: CharStyle insets are now 

Reply via email to