mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Fileformat increased to 287: support for optional arguments of package wrapfig that is used for wrap floats
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20462 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
63d05dbff4
commit
b7d0510502
@ -1,6 +1,10 @@
|
||||
LyX file-format changes
|
||||
-----------------------
|
||||
|
||||
2007-09-24 Uwe Stöhr <uwestoehr@web.de>
|
||||
* Format incremented to 287: Add missing optional parameters
|
||||
for wrapped figures.
|
||||
|
||||
2007-09-21 Pavel Sanda <ps@twin.jikos.cz>
|
||||
* Format incremented to 286: LyX now supports hyperref and some
|
||||
of its options.
|
||||
|
@ -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" , 1)),
|
||||
("1_6", range(277,287), minor_versions("1.6" , 0))]
|
||||
("1_6", range(277,288), minor_versions("1.6" , 0))]
|
||||
|
||||
|
||||
def formats_list():
|
||||
|
@ -258,6 +258,23 @@ def remove_inzip_options(document):
|
||||
i = i + 1
|
||||
|
||||
|
||||
def revert_wrapfig_options(document):
|
||||
"Revert optional options for wrap floats (wrapfig). "
|
||||
i = 0
|
||||
while True:
|
||||
i = find_tokens(document.body, "lines", i)
|
||||
if i == -1:
|
||||
return
|
||||
del document.body[i]
|
||||
j = find_tokens(document.body, "overhang", i+1)
|
||||
if j != i + 1 and j != -1:
|
||||
document.warning("Malformed LyX document: Couldn't find overhang parameter of wrap float.")
|
||||
if j == -1:
|
||||
return
|
||||
del document.body[j]
|
||||
i = i + 1
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -273,10 +290,12 @@ convert = [
|
||||
[283, [convert_flex]],
|
||||
[284, []],
|
||||
[285, []], # an empty manifest is automatically added
|
||||
[286, []]
|
||||
[286, []],
|
||||
[287, []]
|
||||
]
|
||||
|
||||
revert = [
|
||||
[286, [revert_wrapfig_options]],
|
||||
[285, [revert_pdf_options]],
|
||||
[284, [remove_manifest, remove_inzip_options]],
|
||||
[283, []],
|
||||
|
@ -143,7 +143,7 @@ namespace fs = boost::filesystem;
|
||||
|
||||
namespace {
|
||||
|
||||
int const LYX_FORMAT = 286;
|
||||
int const LYX_FORMAT = 287;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "ControlWrap.h"
|
||||
#include "LengthCombo.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "Validator.h"
|
||||
|
||||
#include "insets/InsetWrap.h"
|
||||
|
||||
@ -44,10 +45,21 @@ GuiWrapDialog::GuiWrapDialog(LyXView & lv)
|
||||
|
||||
connect(widthED, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(unitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
||||
connect(widthUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(valignCO, SIGNAL(highlighted(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(overhangED, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(overhangUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(linesSB, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
widthED->setValidator(unsignedLengthValidator(widthED));
|
||||
// FIXME:
|
||||
// overhang can be negative, but the unsignedLengthValidator allows this
|
||||
overhangED->setValidator(unsignedLengthValidator(overhangED));
|
||||
|
||||
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
||||
bc().setRestore(restorePB);
|
||||
@ -56,8 +68,15 @@ GuiWrapDialog::GuiWrapDialog(LyXView & lv)
|
||||
bc().setCancel(closePB);
|
||||
|
||||
bc().addReadOnly(widthED);
|
||||
bc().addReadOnly(unitsLC);
|
||||
bc().addReadOnly(widthUnitLC);
|
||||
bc().addReadOnly(valignCO);
|
||||
bc().addReadOnly(overhangED);
|
||||
bc().addReadOnly(overhangUnitLC);
|
||||
bc().addReadOnly(linesSB);
|
||||
|
||||
// initialize the length validator
|
||||
bc().addCheckedLineEdit(widthED, widthLA);
|
||||
bc().addCheckedLineEdit(overhangED, overhangLA);
|
||||
}
|
||||
|
||||
|
||||
@ -82,14 +101,20 @@ void GuiWrapDialog::change_adaptor()
|
||||
|
||||
void GuiWrapDialog::applyView()
|
||||
{
|
||||
double const value = widthED->text().toDouble();
|
||||
Length::UNIT unit = unitsLC->currentLengthItem();
|
||||
double const width_value = widthED->text().toDouble();
|
||||
Length::UNIT widthUnit = widthUnitLC->currentLengthItem();
|
||||
if (widthED->text().isEmpty())
|
||||
unit = Length::UNIT_NONE;
|
||||
widthUnit = Length::UNIT_NONE;
|
||||
double const overhang_value = overhangED->text().toDouble();
|
||||
Length::UNIT overhangUnit = overhangUnitLC->currentLengthItem();
|
||||
if (overhangED->text().isEmpty())
|
||||
overhangUnit = Length::UNIT_NONE;
|
||||
|
||||
InsetWrapParams & params = controller().params();
|
||||
|
||||
params.width = Length(value, unit);
|
||||
params.width = Length(width_value, widthUnit);
|
||||
params.overhang = Length(overhang_value, overhangUnit);
|
||||
params.lines = linesSB->value();
|
||||
|
||||
switch (valignCO->currentIndex()) {
|
||||
case 0:
|
||||
@ -112,11 +137,15 @@ void GuiWrapDialog::updateContents()
|
||||
{
|
||||
InsetWrapParams & params = controller().params();
|
||||
|
||||
Length len(params.width);
|
||||
//0pt is a legal width now, it yields a
|
||||
//wrapfloat just wide enough for the contents.
|
||||
widthED->setText(QString::number(len.value()));
|
||||
unitsLC->setCurrentItem(len.unit());
|
||||
Length len_w(params.width);
|
||||
widthED->setText(QString::number(len_w.value()));
|
||||
widthUnitLC->setCurrentItem(len_w.unit());
|
||||
Length len_o(params.overhang);
|
||||
overhangED->setText(QString::number(len_o.value()));
|
||||
overhangUnitLC->setCurrentItem(len_o.unit());
|
||||
linesSB->setValue(params.lines);
|
||||
|
||||
int item = 0;
|
||||
if (params.placement == "i")
|
||||
|
@ -5,8 +5,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>369</width>
|
||||
<height>111</height>
|
||||
<width>411</width>
|
||||
<height>199</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
@ -15,222 +15,342 @@
|
||||
<property name="sizeGripEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>11</number>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>110</y>
|
||||
<width>221</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="nlinesLA" >
|
||||
<property name="text" >
|
||||
<string>&Number of needed lines (optional):</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>valignCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="linesSB" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>392</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>390</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="restorePB" >
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Restore</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okPB" >
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="applyPB" >
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Apply</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closePB" >
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valignLA" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>292</x>
|
||||
<y>11</y>
|
||||
<width>98</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Placement:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>valignCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="valignCO" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>292</x>
|
||||
<y>32</y>
|
||||
<width>98</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Vertical alignment</string>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="widthLA" >
|
||||
<property name="text" >
|
||||
<string>&Width:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>widthED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QComboBox" name="valignCO" >
|
||||
<property name="toolTip" >
|
||||
<string>Vertical alignment</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Outer (default)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Inner</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLabel" name="valignLA" >
|
||||
<property name="text" >
|
||||
<string>&Placement:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>valignCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="LengthCombo" native="1" name="unitsLC" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Units of width value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLineEdit" name="widthED" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Width value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="unitsLA" >
|
||||
<property name="text" >
|
||||
<string>&Units:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>unitsLC</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<property name="text" >
|
||||
<string>Outer (default)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="text" >
|
||||
<string>Inner</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="restorePB" >
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Restore</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okPB" >
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="applyPB" >
|
||||
<property name="toolTip" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Apply</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closePB" >
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<property name="text" >
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</item>
|
||||
</layout>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>271</width>
|
||||
<height>88</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLineEdit" name="widthED" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Width value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="widthLA" >
|
||||
<property name="text" >
|
||||
<string>&Width:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>widthED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLabel" name="overhangUnitLA" >
|
||||
<property name="text" >
|
||||
<string>&Unit:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>widthUnitLC</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLineEdit" name="overhangED" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Width value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="overhangLA" >
|
||||
<property name="text" >
|
||||
<string>&Overhang (optional):</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>widthED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="LengthCombo" name="widthUnitLC" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Units of width value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="widthUnitLA" >
|
||||
<property name="text" >
|
||||
<string>&Unit:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>widthUnitLC</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="LengthCombo" name="overhangUnitLC" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>13</hsizetype>
|
||||
<vsizetype>13</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Units of width value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LengthCombo</class>
|
||||
<extends>QWidget</extends>
|
||||
<extends>QComboBox</extends>
|
||||
<header>LengthCombo.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>widthED</tabstop>
|
||||
<tabstop>unitsLC</tabstop>
|
||||
<tabstop>widthUnitLC</tabstop>
|
||||
<tabstop>valignCO</tabstop>
|
||||
<tabstop>restorePB</tabstop>
|
||||
<tabstop>okPB</tabstop>
|
||||
|
@ -52,6 +52,9 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
|
||||
font.setColor(Color::collapsable);
|
||||
setLabelFont(font);
|
||||
params_.type = type;
|
||||
params_.lines = 0;
|
||||
params_.placement = "o";
|
||||
params_.overhang = Length(0, Length::PCW);
|
||||
params_.width = Length(50, Length::PCW);
|
||||
}
|
||||
|
||||
@ -68,8 +71,10 @@ void InsetWrap::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetWrapParams params;
|
||||
InsetWrapMailer::string2params(to_utf8(cmd.argument()), params);
|
||||
params_.lines = params.lines;
|
||||
params_.placement = params.placement;
|
||||
params_.width = params.width;
|
||||
params_.overhang = params.overhang;
|
||||
params_.width = params.width;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -126,10 +131,9 @@ void InsetWrap::updateLabels(Buffer const & buf, ParIterator const & it)
|
||||
void InsetWrapParams::write(ostream & os) const
|
||||
{
|
||||
os << "Wrap " << type << '\n';
|
||||
|
||||
if (!placement.empty())
|
||||
os << "placement " << placement << "\n";
|
||||
|
||||
os << "lines " << lines << "\n";
|
||||
os << "placement " << placement << "\n";
|
||||
os << "overhang " << overhang.asString() << "\n";
|
||||
os << "width \"" << width.asString() << "\"\n";
|
||||
}
|
||||
|
||||
@ -137,11 +141,35 @@ void InsetWrapParams::write(ostream & os) const
|
||||
void InsetWrapParams::read(Lexer & lex)
|
||||
{
|
||||
string token;
|
||||
|
||||
lex >> token;
|
||||
if (token == "lines")
|
||||
lex >> lines;
|
||||
else {
|
||||
lyxerr << "InsetWrap::Read:: Missing 'lines'-tag!"
|
||||
<< endl;
|
||||
// take countermeasures
|
||||
lex.pushToken(token);
|
||||
}
|
||||
if (!lex)
|
||||
return;
|
||||
lex >> token;
|
||||
if (token == "placement")
|
||||
lex >> placement;
|
||||
else {
|
||||
// take countermeasures
|
||||
lyxerr << "InsetWrap::Read:: Missing 'placement'-tag!"
|
||||
<< endl;
|
||||
lex.pushToken(token);
|
||||
}
|
||||
if (!lex)
|
||||
return;
|
||||
lex >> token;
|
||||
if (token == "overhang") {
|
||||
lex.next();
|
||||
overhang = Length(lex.getString());
|
||||
} else {
|
||||
lyxerr << "InsetWrap::Read:: Missing 'overhang'-tag!"
|
||||
<< endl;
|
||||
lex.pushToken(token);
|
||||
}
|
||||
if (!lex)
|
||||
@ -153,7 +181,6 @@ void InsetWrapParams::read(Lexer & lex)
|
||||
} else {
|
||||
lyxerr << "InsetWrap::Read:: Missing 'width'-tag!"
|
||||
<< endl;
|
||||
// take countermeasures
|
||||
lex.pushToken(token);
|
||||
}
|
||||
}
|
||||
@ -196,9 +223,14 @@ int InsetWrap::latex(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
os << "\\begin{wrap" << from_ascii(params_.type) << '}';
|
||||
if (!params_.placement.empty())
|
||||
os << '{' << from_ascii(params_.placement) << '}';
|
||||
else os << "{o}"; //Outer is default in the current UI
|
||||
// no optional argument when lines are zero
|
||||
if (params_.lines != 0)
|
||||
os << '[' << params_.lines << ']';
|
||||
os << '{' << from_ascii(params_.placement) << '}';
|
||||
Length over(params_.overhang);
|
||||
// no optional argument when the value is zero
|
||||
if (over.value() != 0)
|
||||
os << '[' << from_ascii(params_.overhang.asLatexString()) << ']';
|
||||
os << '{' << from_ascii(params_.width.asLatexString()) << "}%\n";
|
||||
int const i = InsetText::latex(buf, os, runparams);
|
||||
os << "\\end{wrap" << from_ascii(params_.type) << "}%\n";
|
||||
|
@ -30,8 +30,12 @@ public:
|
||||
///
|
||||
std::string type;
|
||||
///
|
||||
int lines;
|
||||
///
|
||||
std::string placement;
|
||||
///
|
||||
Length overhang;
|
||||
///
|
||||
Length width;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user