The attached patch backports the patch to use wrapfig instead of floatflt to 
branch.

The patch is exactly to this SVN revision:
http://www.lyx.org/trac/changeset/20185
, except of the UI file because I upgraded my Designer and Qt from Qt 4.2.x to 
4.3.x.

It works fine here, please test if it also does so on your system.

regards Uwe
Index: factory.cpp
===================================================================
--- factory.cpp	(revision 22813)
+++ factory.cpp	(working copy)
@@ -176,7 +176,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: frontends/qt4/QWrap.cpp
===================================================================
--- frontends/qt4/QWrap.cpp	(revision 22813)
+++ frontends/qt4/QWrap.cpp	(working copy)
@@ -80,7 +80,7 @@
 typedef QController<ControlWrap, QView<QWrapDialog> > wrap_base_class;
 
 QWrap::QWrap(Dialog & parent)
-	: wrap_base_class(parent, _("Text Wrap Settings"))
+	: wrap_base_class(parent, _("Wrap Float Settings"))
 {
 }
 
@@ -113,16 +113,16 @@
 
 	switch (dialog_->valignCO->currentIndex()) {
 	case 0:
-		params.placement.erase();
+		params.placement = "o";
 		break;
 	case 1:
-		params.placement = "l";
+		params.placement = "i";
 		break;
 	case 2:
-		params.placement = "r";
+		params.placement = "l";
 		break;
 	case 3:
-		params.placement = "p";
+		params.placement = "r";
 		break;
 	}
 }
@@ -131,12 +131,9 @@
 static string const numtostr(double val)
 {
 	string a = convert<string>(val);
-#ifdef WITH_WARNINGS
-#warning Will this test ever trigger? (Lgb)
-#endif
-	if (a == "0")
-		a.erase();
 	return a;
+	//0pt is a legal width now, it yields a 
+	//wrapfloat just wide enough for the contents.
 }
 
 
@@ -149,11 +146,11 @@
 	dialog_->unitsLC->setCurrentItem(len.unit());
 
 	int item = 0;
-	if (params.placement == "l")
+	if (params.placement == "i")
 		item = 1;
-	else if (params.placement == "r")
+	else if (params.placement == "l")
 		item = 2;
-	else if (params.placement == "p")
+	else if (params.placement == "r")
 		item = 3;
 
 	dialog_->valignCO->setCurrentIndex(item);
Index: frontends/qt4/ui/WrapUi.ui
===================================================================
--- frontends/qt4/ui/WrapUi.ui	(revision 22813)
+++ frontends/qt4/ui/WrapUi.ui	(working copy)
@@ -1,7 +1,4 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>QWrapUi</class>
  <widget class="QDialog" name="QWrapUi" >
   <property name="geometry" >
@@ -19,20 +16,41 @@
    <bool>true</bool>
   </property>
   <layout class="QVBoxLayout" >
-   <property name="margin" >
-    <number>11</number>
-   </property>
    <property name="spacing" >
     <number>6</number>
    </property>
+   <property name="leftMargin" >
+    <number>11</number>
+   </property>
+   <property name="topMargin" >
+    <number>11</number>
+   </property>
+   <property name="rightMargin" >
+    <number>11</number>
+   </property>
+   <property name="bottomMargin" >
+    <number>11</number>
+   </property>
    <item>
     <layout class="QGridLayout" >
-     <property name="margin" >
+     <property name="leftMargin" >
       <number>0</number>
      </property>
-     <property name="spacing" >
+     <property name="topMargin" >
+      <number>0</number>
+     </property>
+     <property name="rightMargin" >
+      <number>0</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>0</number>
+     </property>
+     <property name="horizontalSpacing" >
       <number>6</number>
      </property>
+     <property name="verticalSpacing" >
+      <number>6</number>
+     </property>
      <item row="0" column="0" >
       <widget class="QLabel" name="widthLA" >
        <property name="text" >
@@ -50,22 +68,22 @@
        </property>
        <item>
         <property name="text" >
-         <string>Default (outer)</string>
+         <string>Outer (default)</string>
         </property>
        </item>
        <item>
         <property name="text" >
-         <string>Left</string>
+         <string>Inner</string>
         </property>
        </item>
        <item>
         <property name="text" >
-         <string>Right</string>
+         <string>Left</string>
         </property>
        </item>
        <item>
         <property name="text" >
-         <string>Outer</string>
+         <string>Right</string>
         </property>
        </item>
       </widget>
@@ -81,11 +99,9 @@
       </widget>
      </item>
      <item row="1" column="1" >
-      <widget class="LengthCombo" name="unitsLC" >
+      <widget class="LengthCombo" native="1" name="unitsLC" >
        <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>3</hsizetype>
-         <vsizetype>0</vsizetype>
+        <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -107,9 +123,7 @@
      <item row="1" column="0" >
       <widget class="QLineEdit" name="widthED" >
        <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>1</hsizetype>
-         <vsizetype>0</vsizetype>
+        <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
@@ -149,12 +163,21 @@
    </item>
    <item>
     <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
      <property name="spacing" >
       <number>6</number>
      </property>
+     <property name="leftMargin" >
+      <number>0</number>
+     </property>
+     <property name="topMargin" >
+      <number>0</number>
+     </property>
+     <property name="rightMargin" >
+      <number>0</number>
+     </property>
+     <property name="bottomMargin" >
+      <number>0</number>
+     </property>
      <item>
       <widget class="QPushButton" name="restorePB" >
        <property name="toolTip" >
@@ -224,17 +247,11 @@
    </item>
   </layout>
  </widget>
- <pixmapfunction></pixmapfunction>
- <includes>
-  <include location="local" >qt_helpers.h</include>
- </includes>
  <customwidgets>
   <customwidget>
    <class>LengthCombo</class>
-   <extends></extends>
+   <extends>QWidget</extends>
    <header>LengthCombo.h</header>
-   <container>0</container>
-   <pixmap></pixmap>
   </customwidget>
  </customwidgets>
  <tabstops>
@@ -246,6 +263,9 @@
   <tabstop>applyPB</tabstop>
   <tabstop>closePB</tabstop>
  </tabstops>
+ <includes>
+  <include location="local" >qt_helpers.h</include>
+ </includes>
  <resources/>
  <connections/>
 </ui>
Index: insets/InsetWrap.cpp
===================================================================
--- insets/InsetWrap.cpp	(revision 22813)
+++ insets/InsetWrap.cpp	(working copy)
@@ -160,7 +160,7 @@
 
 void InsetWrap::validate(LaTeXFeatures & features) const
 {
-	features.require("floatflt");
+	features.require("wrapfig");
 	InsetCollapsable::validate(features);
 }
 
@@ -180,12 +180,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: LaTeXFeatures.cpp
===================================================================
--- LaTeXFeatures.cpp	(revision 22813)
+++ LaTeXFeatures.cpp	(working copy)
@@ -415,7 +415,7 @@
 	"latexsym",
 	"pifont",
 	"subfigure",
-	"floatflt",
+	"wrapfig",
 	"varioref",
 	"prettyref",
 	"float",

Reply via email to