GuiBox.cpp: fix update of height checkbox

BoxUi.ui: fix the ui according to r20727
InsetBox.cpp: fix that e.g. "1\width" wasn't output to TeX

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20739 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-10-05 00:36:38 +00:00
parent ae0f514870
commit a2fe099fc0
4 changed files with 54 additions and 18 deletions

View File

@ -72,7 +72,6 @@ GuiBoxDialog::GuiBoxDialog(LyXView & lv)
connect(restorePB, SIGNAL(clicked()), this, SLOT(restoreClicked())); connect(restorePB, SIGNAL(clicked()), this, SLOT(restoreClicked()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int))); connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
connect(heightCB, SIGNAL(stateChanged(int)), this, SLOT(heightChecked(int)));
connect(halignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(halignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(ialignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(ialignCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(innerBoxCO, SIGNAL(activated(const QString&)), connect(innerBoxCO, SIGNAL(activated(const QString&)),
@ -157,17 +156,6 @@ void GuiBoxDialog::typeChanged(int index)
} }
void GuiBoxDialog::heightChecked(int checkState)
{
if (checkState == Qt::Unchecked) {
heightED->setEnabled(false);
heightUnitsLC->setEnabled(false);
} else {
heightED->setEnabled(true);
heightUnitsLC->setEnabled(true);
}
}
void GuiBoxDialog::restoreClicked() void GuiBoxDialog::restoreClicked()
{ {
setInnerType(true, 2); setInnerType(true, 2);
@ -235,7 +223,7 @@ void GuiBoxDialog::updateContents()
lengthToWidgets(heightED, heightUnitsLC, lengthToWidgets(heightED, heightUnitsLC,
(controller().params().height).asString(), default_unit); (controller().params().height).asString(), default_unit);
string const height_special = controller().params().height_special; string const height_special = controller().params().height_special;
if (!height_special.empty() && height_special != "none") { if (!height_special.empty() && height_special != "none") {
QString hspc; QString hspc;
@ -250,6 +238,14 @@ void GuiBoxDialog::updateContents()
} }
} }
} }
// set no optional height when the value is the default "1\height"
// (special units like \height are handled as "in",
if (height_special == "totalheight" &&
controller().params().height == Length("1in"))
heightCB->setCheckState(Qt::Unchecked);
else
heightCB->setCheckState(Qt::Checked);
heightCB->setEnabled(ibox); heightCB->setEnabled(ibox);
} }

View File

@ -33,7 +33,6 @@ private Q_SLOTS:
void change_adaptor(); void change_adaptor();
void innerBoxChanged(const QString &); void innerBoxChanged(const QString &);
void typeChanged(int); void typeChanged(int);
void heightChecked(int);
void restoreClicked(); void restoreClicked();
private: private:

View File

@ -132,7 +132,7 @@
<string>&amp;Height (optional):</string> <string>&amp;Height (optional):</string>
</property> </property>
<property name="checked" > <property name="checked" >
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="tristate" > <property name="tristate" >
<bool>false</bool> <bool>false</bool>
@ -141,6 +141,9 @@
</item> </item>
<item> <item>
<widget class="QLineEdit" name="heightED" > <widget class="QLineEdit" name="heightED" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy>
<hsizetype>1</hsizetype> <hsizetype>1</hsizetype>
@ -155,7 +158,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="LengthCombo" name="heightUnitsLC" /> <widget class="LengthCombo" name="heightUnitsLC" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -431,5 +438,38 @@
<include location="local" >qt_helpers.h</include> <include location="local" >qt_helpers.h</include>
</includes> </includes>
<resources/> <resources/>
<connections/> <connections>
<connection>
<sender>heightCB</sender>
<signal>toggled(bool)</signal>
<receiver>heightED</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>75</x>
<y>83</y>
</hint>
<hint type="destinationlabel" >
<x>171</x>
<y>83</y>
</hint>
</hints>
</connection>
<connection>
<sender>heightCB</sender>
<signal>toggled(bool)</signal>
<receiver>heightUnitsLC</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>86</x>
<y>100</y>
</hint>
<hint type="destinationlabel" >
<x>283</x>
<y>100</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

View File

@ -340,7 +340,8 @@ int InsetBox::latex(Buffer const & buf, odocstream & os,
// (special units like \height are handled as "in") // (special units like \height are handled as "in")
// but when the user has chosen a non-default inner_pos, the height // but when the user has chosen a non-default inner_pos, the height
// must be given: \minipage[pos][height][inner-pos]{width} // must be given: \minipage[pos][height][inner-pos]{width}
if (params_.height != Length("1in") || if ((params_.height != Length("1in") ||
params_.height_special != "totalheight") ||
params_.inner_pos != params_.pos) { params_.inner_pos != params_.pos) {
// FIXME UNICODE // FIXME UNICODE
os << "[" << params_.height.value() os << "[" << params_.height.value()