From: Uwe Stöhr Date: Sun, 2 Mar 2008 17:12:22 +0000 (+0000) Subject: fileformat incremented to 317: X-Git-Tag: 1.6.10~5944 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3db3b9930ad6939127d182181a19920a6ef447a3;p=features.git fileformat incremented to 317: support for floating placement settings for wrap floats git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23394 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/development/FORMAT b/development/FORMAT index 1c8ea98d84..eced9bc155 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,8 +1,11 @@ LyX file-format changes ----------------------- -2008-03-01 Jürgen Spitzmüller - * Format incremented to 316: support for subfloats (subfig package). +2008-03-02 Uwe Stöhr + * Format incremented to 317: support floating placements for wrap floats + +2008-03-02 Jürgen Spitzmüller + * Format incremented to 316: support for subfloats (subfig package) 2008-02-18 Richard Heck * Format incremented to 315: support for column separation in page margins @@ -30,7 +33,7 @@ LyX file-format changes * Format incremented to 308: support for Serbian (Latin) 2007-12-05 Jürgen Spitzmüller - * Format incremented to 307: support for \slash and \nobreakdash. + * Format incremented to 307: support for \slash and \nobreakdash 2007-12-05 Uwe Stöhr * Format incremented to 306: support for Interlingua @@ -89,7 +92,7 @@ LyX file-format changes * Format incremented to 291: Support for Vietnamese. 2007-10-03 Uwe Stöhr - * Format incremented to 290: Add table wrap floats. + * Format incremented to 290: Add table wrap floats 2007-10-03 Martin Vermeer * Format incremented to 289: make Index a collapsable inset. @@ -107,7 +110,7 @@ LyX file-format changes of its options. 2007-09-11 Bo Peng - * Format incremented to 285: Tweaks to embedded file format. + * Format incremented to 285: Tweaks to embedded file format Remove inzip parameter from graphics insets. 2007-09-09 Helge Hafting @@ -130,7 +133,7 @@ LyX file-format changes 2007-08-29 Richard Heck - * format incremented to 281: allow modules for layout files. + * format incremented to 281: allow modules for layout files 2007-08-17 Martin Vermeer diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 99e8399f39..1a2f0c7ea6 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)), ("1_3", [221], minor_versions("1.3" , 7)), ("1_4", range(222,246), minor_versions("1.4" , 5)), ("1_5", range(246,277), minor_versions("1.5" , 2)), - ("1_6", range(277,317), minor_versions("1.6" , 0))] # jspitzm: subfig + ("1_6", range(277,318), minor_versions("1.6" , 0))] # Uwe: wrap placement def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 28dc0bce6a..7c67513330 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -1362,6 +1362,24 @@ def revert_subfig(document): i = i + 1 +def revert_wrapplacement(document): + "Revert placement options wrap floats (wrapfig)." + i = 0 + while True: + i = find_token(document.body, "lines", i) + if i == -1: + return + j = find_token(document.body, "placement", i+1) + if j != i + 1: + document.warning("Malformed LyX document: Couldn't find placement parameter of wrap float.") + return + document.body[j] = document.body[j].replace("placement O", "placement o") + document.body[j] = document.body[j].replace("placement I", "placement i") + document.body[j] = document.body[j].replace("placement L", "placement l") + document.body[j] = document.body[j].replace("placement R", "placement r") + i = i + 1 + + ## # Conversion hub # @@ -1406,10 +1424,12 @@ convert = [[277, [fix_wrong_tables]], [313, [convert_module_names]], [314, []], [315, []], - [316, [convert_subfig]] + [316, [convert_subfig]], + [317, []] ] -revert = [[315, [revert_subfig]], +revert = [[316, [revert_wrapplacement]], + [315, [revert_subfig]], [314, [revert_colsep]], [313, []], [312, [revert_module_names]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 4519737d6b..cf8d6a0124 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -117,7 +117,7 @@ namespace os = support::os; namespace { -int const LYX_FORMAT = 316; // JSpitzm: subfig support +int const LYX_FORMAT = 317; // Uwe Stöhr: float placement support for wrap floats typedef map DepClean; typedef map > RefCache; diff --git a/src/frontends/qt4/GuiWrap.cpp b/src/frontends/qt4/GuiWrap.cpp index 7b6106bd17..253c042d84 100644 --- a/src/frontends/qt4/GuiWrap.cpp +++ b/src/frontends/qt4/GuiWrap.cpp @@ -40,12 +40,14 @@ GuiWrap::GuiWrap(GuiView & lv) connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); + connect(valignCO, SIGNAL(highlighted(QString)), + this, SLOT(change_adaptor())); + connect(floatCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); connect(widthED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); connect(widthUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SLOT(change_adaptor())); - connect(valignCO, SIGNAL(highlighted(QString)), - this, SLOT(change_adaptor())); connect(overhangCB, SIGNAL(stateChanged(int)), this, SLOT(change_adaptor())); connect(overhangED, SIGNAL(textChanged(QString)), @@ -68,9 +70,10 @@ GuiWrap::GuiWrap(GuiView & lv) bc().setApply(applyPB); bc().setCancel(closePB); + bc().addReadOnly(valignCO); + bc().addReadOnly(floatCB); bc().addReadOnly(widthED); bc().addReadOnly(widthUnitLC); - bc().addReadOnly(valignCO); bc().addReadOnly(overhangCB); bc().addReadOnly(overhangED); bc().addReadOnly(overhangUnitLC); @@ -116,18 +119,33 @@ void GuiWrap::applyView() // in InsetWrap.cpp params_.lines = 0; + bool floatOn = false; + if (floatCB->checkState() == Qt::Checked) + floatOn = true; switch (valignCO->currentIndex()) { case 0: - params_.placement = "o"; + if (floatOn) + params_.placement = "O"; + else + params_.placement = "o"; break; case 1: - params_.placement = "i"; + if (floatOn) + params_.placement = "I"; + else + params_.placement = "i"; break; case 2: - params_.placement = "l"; + if (floatOn) + params_.placement = "L"; + else + params_.placement = "l"; break; case 3: - params_.placement = "r"; + if (floatOn) + params_.placement = "R"; + else + params_.placement = "r"; break; } } @@ -156,14 +174,18 @@ void GuiWrap::updateContents() linesCB->setCheckState(Qt::Checked); int item = 0; - if (params_.placement == "i") + if (params_.placement == "i" || params_.placement == "I") item = 1; - else if (params_.placement == "l") + else if (params_.placement == "l" || params_.placement == "L") item = 2; - else if (params_.placement == "r") + else if (params_.placement == "r" || params_.placement == "R") item = 3; valignCO->setCurrentIndex(item); + + if (params_.placement == "O" || params_.placement == "I" + || params_.placement == "L" || params_.placement == "R") + floatCB->setCheckState(Qt::Checked); } diff --git a/src/frontends/qt4/ui/WrapUi.ui b/src/frontends/qt4/ui/WrapUi.ui index 48723ed7fb..e7223e4870 100644 --- a/src/frontends/qt4/ui/WrapUi.ui +++ b/src/frontends/qt4/ui/WrapUi.ui @@ -16,10 +16,22 @@ true - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 @@ -58,9 +70,7 @@ - - 3 - 0 + 0 0 @@ -92,9 +102,7 @@ - - 1 - 0 + 0 0 @@ -106,12 +114,21 @@ - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -235,9 +252,7 @@ false - - 1 - 0 + 0 0 @@ -253,9 +268,7 @@ false - - 13 - 13 + 0 0 @@ -274,6 +287,16 @@ + + + + by checking this the placement can float + + + &float + + + @@ -285,6 +308,7 @@ valignCO + floatCB widthED widthUnitLC overhangCB @@ -292,10 +316,10 @@ overhangUnitLC linesCB linesSB - restorePB okPB - closePB applyPB + closePB + restorePB qt_helpers.h @@ -345,8 +369,8 @@ 93 - 164 - 101 + 132 + 108