From 17112f655d155870934bf70732c947f807dd8fd6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Sun, 9 Sep 2007 23:47:22 +0000 Subject: [PATCH] Helge's wrapfig patch: - Format incremented to 284 - LaTeX-package wrapfig is now used instead of flotflt for wrap floats (this allows us to implement now also a table wrap float) (the optional overhang argument of wrapfig will be implemented later) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20185 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/FORMAT | 9 +++++ lib/chkconfig.ltx | 2 +- lib/doc/LaTeXConfig.lyx.in | 70 ++++++++++++++++------------------ lib/lyx2lyx/LyX.py | 2 +- lib/lyx2lyx/lyx_1_6.py | 4 +- src/Buffer.cpp | 2 +- src/LaTeXFeatures.cpp | 2 +- src/factory.cpp | 2 +- src/frontends/qt4/GuiWrap.cpp | 21 +++++----- src/frontends/qt4/ui/WrapUi.ui | 21 +++++----- src/insets/InsetWrap.cpp | 9 +++-- 11 files changed, 74 insertions(+), 70 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 3f1a1aed07..52d1c85e68 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -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 @@ -831,3 +839,4 @@ renamed as "size_kind" and "lyxsize_kind" respectively. \end_inset + diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 7b106aa17c..76399b4dd7 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -230,7 +230,7 @@ \TestPackage{esint} \TestPackage{fancybox} \TestPackage{fancyhdr} -\TestPackage{floatflt} +\TestPackage{wrapfig} \TestPackage{framed} \TestPackage{geometry} \TestPackage{jurabib} diff --git a/lib/doc/LaTeXConfig.lyx.in b/lib/doc/LaTeXConfig.lyx.in index 516bebb7ab..2770e2afff 100644 --- a/lib/doc/LaTeXConfig.lyx.in +++ b/lib/doc/LaTeXConfig.lyx.in @@ -1,5 +1,5 @@ -#LyX 1.5.0rc1 created this file. For more info see http://www.lyx.org/ -\lyxformat 271 +#LyX 1.6.0svn created this file. For more info see http://www.lyx.org/ +\lyxformat 284 \begin_document \begin_header \textclass article @@ -33,9 +33,8 @@ \paperpagestyle plain \tracking_changes false \output_changes false -\author "Jürgen Spitzmüller" -\author "usti" -\author "Jean-Marc Lasgouttes" +\author "" +\author "" \end_header \begin_body @@ -2913,38 +2912,6 @@ fancy It provides alternate headers and footers to your pages. \end_layout -\begin_layout Subsection -floatflt -\end_layout - -\begin_layout Description -Found: @chk_floatflt@ -\end_layout - -\begin_layout Description -CTAN: -\family typewriter -macros/latex/contrib/floatflt/ -\end_layout - -\begin_layout Description -Notes: The package -\family sans -floatflt -\family default - (an extension of -\family sans -floatfig -\family default -) is used by LyX if you select the ``floatflt'' type in -\family sans -Layout->Paragraph->ExtraOpt -\family default - in the paragraph of a figure float. - It allows you to create a figure float which is narrower than the full - page and wrap the text around it. -\end_layout - \begin_layout Subsection jurabib \end_layout @@ -3230,6 +3197,35 @@ url is needed by LyX to be able to output url's corrently. \end_layout +\begin_layout Subsection +wrapfig +\end_layout + +\begin_layout Description +Found: @chk_wrapfig@ +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +macros/latex/contrib/wrapfig/ +\end_layout + +\begin_layout Description +Notes: The package +\family typewriter +wrapfig +\family default + is used by LyX if you insert text wrap floats (menu +\family sans +Insert\SpecialChar \menuseparator +Float) +\family default +. + It allows you to create a figure float which is narrower than the full + page and wrap the text around it. +\end_layout + \begin_layout Subsection xcolor \end_layout diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 447f954428..8b8fddb38e 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -78,7 +78,7 @@ format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)), ("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(): diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 51f077cc34..93e275b478 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -187,10 +187,12 @@ convert = [ [280, [axe_show_label]], [281, []], [282, []], - [283, [convert_flex]] + [283, [convert_flex]], + [284, []] ] revert = [ + [283, []], [282, [revert_flex]], [281, []], [280, [revert_begin_modules]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index a7bca7bd37..404efdf6fb 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -142,7 +142,7 @@ namespace fs = boost::filesystem; namespace { -int const LYX_FORMAT = 283; +int const LYX_FORMAT = 284; } // namespace anon diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 44811fcfec..4fee7fdf1e 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -397,7 +397,7 @@ char const * simplefeatures[] = { "latexsym", "pifont", "subfigure", - "floatflt", + "wrapfig", "varioref", "prettyref", "float", diff --git a/src/factory.cpp b/src/factory.cpp index 3e63e0e896..681b8e5fbc 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -173,7 +173,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd) 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; } diff --git a/src/frontends/qt4/GuiWrap.cpp b/src/frontends/qt4/GuiWrap.cpp index 943c7c5aac..28fb5a86d0 100644 --- a/src/frontends/qt4/GuiWrap.cpp +++ b/src/frontends/qt4/GuiWrap.cpp @@ -35,7 +35,7 @@ GuiWrapDialog::GuiWrapDialog(LyXView & lv) : GuiDialog(lv, "wrap") { setupUi(this); - setViewTitle(_("Text Wrap Settings")); + setViewTitle(_("Wrap Float Settings")); setController(new ControlWrap(*this)); connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); @@ -94,16 +94,16 @@ void GuiWrapDialog::applyView() switch (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; } } @@ -112,10 +112,9 @@ void GuiWrapDialog::applyView() static string const numtostr(double val) { string a = convert(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. } @@ -128,11 +127,11 @@ void GuiWrapDialog::update_contents() 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; valignCO->setCurrentIndex(item); diff --git a/src/frontends/qt4/ui/WrapUi.ui b/src/frontends/qt4/ui/WrapUi.ui index dd8ff3121b..22c6bd4378 100644 --- a/src/frontends/qt4/ui/WrapUi.ui +++ b/src/frontends/qt4/ui/WrapUi.ui @@ -47,22 +47,22 @@ - Default (outer) + Outer (default) - Left + Inner - Right + Left - Outer + Right @@ -78,7 +78,7 @@ - + 3 @@ -221,17 +221,11 @@ - - - qt_helpers.h - LengthCombo - + QWidget
LengthCombo.h
- 0 -
@@ -243,6 +237,9 @@ applyPB closePB + + qt_helpers.h + diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp index 8c72fc8571..1d0eea89ed 100644 --- a/src/insets/InsetWrap.cpp +++ b/src/insets/InsetWrap.cpp @@ -175,7 +175,7 @@ void InsetWrap::read(Buffer const & buf, Lexer & lex) void InsetWrap::validate(LaTeXFeatures & features) const { - features.require("floatflt"); + features.require("wrapfig"); InsetCollapsable::validate(features); } @@ -195,12 +195,13 @@ docstring const InsetWrap::editMessage() const 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; } -- 2.39.5