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
This commit is contained in:
Uwe Stöhr 2008-03-02 17:12:22 +00:00
parent 132003aac5
commit 3db3b9930a
6 changed files with 110 additions and 41 deletions

View File

@ -1,8 +1,11 @@
LyX file-format changes
-----------------------
2008-03-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* Format incremented to 316: support for subfloats (subfig package).
2008-03-02 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 317: support floating placements for wrap floats
2008-03-02 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* Format incremented to 316: support for subfloats (subfig package)
2008-02-18 Richard Heck <rgheck@comcast.net>
* 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 <j.spitzmueller@gmx.de>
* Format incremented to 307: support for \slash and \nobreakdash.
* Format incremented to 307: support for \slash and \nobreakdash
2007-12-05 Uwe Stöhr <uwestoehr@web.de>
* 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 <uwestoehr@web.de>
* Format incremented to 290: Add table wrap floats.
* Format incremented to 290: Add table wrap floats
2007-10-03 Martin Vermeer <martin.vermeer@tkk.fi>
* 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 <ben.bob@gmail.com>
* 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 <helge.hafting@aitel.hist.no>
@ -130,7 +133,7 @@ LyX file-format changes
2007-08-29 Richard Heck <rgheck@comcast.net>
* format incremented to 281: allow modules for layout files.
* format incremented to 281: allow modules for layout files
2007-08-17 Martin Vermeer <martin.vermeer@tkk.fi>

View File

@ -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():

View File

@ -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]],

View File

@ -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<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;

View File

@ -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);
}

View File

@ -16,10 +16,22 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="3" column="2" >
@ -58,9 +70,7 @@
<item row="1" column="3" >
<widget class="LengthCombo" name="widthUnitLC" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>3</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -92,9 +102,7 @@
<item row="1" column="1" colspan="2" >
<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>
@ -106,12 +114,21 @@
</item>
<item row="4" column="0" colspan="4" >
<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" >
@ -235,9 +252,7 @@
<bool>false</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -253,9 +268,7 @@
<bool>false</bool>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>13</hsizetype>
<vsizetype>13</vsizetype>
<sizepolicy vsizetype="Ignored" hsizetype="Ignored" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -274,6 +287,16 @@
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QCheckBox" name="floatCB" >
<property name="toolTip" >
<string>by checking this the placement can float</string>
</property>
<property name="text" >
<string>&amp;float</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
@ -285,6 +308,7 @@
</customwidgets>
<tabstops>
<tabstop>valignCO</tabstop>
<tabstop>floatCB</tabstop>
<tabstop>widthED</tabstop>
<tabstop>widthUnitLC</tabstop>
<tabstop>overhangCB</tabstop>
@ -292,10 +316,10 @@
<tabstop>overhangUnitLC</tabstop>
<tabstop>linesCB</tabstop>
<tabstop>linesSB</tabstop>
<tabstop>restorePB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>closePB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
<tabstop>restorePB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_helpers.h</include>
@ -345,8 +369,8 @@
<y>93</y>
</hint>
<hint type="destinationlabel" >
<x>164</x>
<y>101</y>
<x>132</x>
<y>108</y>
</hint>
</hints>
</connection>