commit da8b73244367c3c6c6ddd489222b030928740493
Author: Uwe Stöhr <[email protected]>
Date: Tue Apr 25 03:01:39 2017 +0200
Move mathindent from text layout to math settings as discussed
---
src/frontends/qt4/GuiDocument.cpp | 116 +++++++++++++++---------------
src/frontends/qt4/ui/MathsUi.ui | 131 +++++++++++++++++++++++++++++++---
src/frontends/qt4/ui/TextLayoutUi.ui | 84 +---------------------
3 files changed, 182 insertions(+), 149 deletions(-)
diff --git a/src/frontends/qt4/GuiDocument.cpp
b/src/frontends/qt4/GuiDocument.cpp
index 353cd32..3b2fd56 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -724,27 +724,6 @@ GuiDocument::GuiDocument(GuiView & lv)
connect(textLayoutModule->justCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
- connect(textLayoutModule->MathIndentCB, SIGNAL(toggled(bool)),
- this, SLOT(change_adaptor()));
- connect(textLayoutModule->MathIndentCB, SIGNAL(toggled(bool)),
- this, SLOT(allowMathIndent()));
- connect(textLayoutModule->MathIndentCO, SIGNAL(activated(int)),
- this, SLOT(change_adaptor()));
- connect(textLayoutModule->MathIndentCO, SIGNAL(activated(int)),
- this, SLOT(setMathIndent(int)));
- connect(textLayoutModule->MathIndentLE, SIGNAL(textChanged(const
QString &)),
- this, SLOT(change_adaptor()));
- connect(textLayoutModule->MathIndentLengthCO, SIGNAL(activated(int)),
- this, SLOT(change_adaptor()));
-
-
- textLayoutModule->MathIndentCO->addItem(qt_("Default"));
- textLayoutModule->MathIndentCO->addItem(qt_("Custom"));
- textLayoutModule->MathIndentLE->setValidator(new LengthValidator(
- textLayoutModule->MathIndentLE));
- // initialize the length validator
- bc().addCheckedLineEdit(textLayoutModule->MathIndentLE);
-
textLayoutModule->lspacingLE->setValidator(new QDoubleValidator(
textLayoutModule->lspacingLE));
textLayoutModule->indentLE->setValidator(new LengthValidator(
@@ -1282,6 +1261,26 @@ GuiDocument::GuiDocument(GuiView & lv)
connect(mathsModule->MathNumberingPosCO, SIGNAL(activated(int)),
this, SLOT(change_adaptor()));
+ connect(mathsModule->MathIndentCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(mathsModule->MathIndentCB, SIGNAL(toggled(bool)),
+ this, SLOT(allowMathIndent()));
+ connect(mathsModule->MathIndentCO, SIGNAL(activated(int)),
+ this, SLOT(change_adaptor()));
+ connect(mathsModule->MathIndentCO, SIGNAL(activated(int)),
+ this, SLOT(setMathIndent(int)));
+ connect(mathsModule->MathIndentLE, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+ connect(mathsModule->MathIndentLengthCO, SIGNAL(activated(int)),
+ this, SLOT(change_adaptor()));
+
+
+ mathsModule->MathIndentCO->addItem(qt_("Default"));
+ mathsModule->MathIndentCO->addItem(qt_("Custom"));
+ mathsModule->MathIndentLE->setValidator(new LengthValidator(
+ mathsModule->MathIndentLE));
+ // initialize the length validator
+ bc().addCheckedLineEdit(mathsModule->MathIndentLE);
mathsModule->MathNumberingPosCO->addItem(qt_("Before"));
mathsModule->MathNumberingPosCO->addItem(qt_("After"));
mathsModule->MathNumberingPosCO->setCurrentIndex(2);
@@ -1619,14 +1618,14 @@ void GuiDocument::enableSkip(bool skip)
void GuiDocument::allowMathIndent() {
// only disable when not checked, checked does not always allow enabling
- if (!textLayoutModule->MathIndentCB->isChecked()) {
- textLayoutModule->MathIndentLE->setEnabled(false);
- textLayoutModule->MathIndentLengthCO->setEnabled(false);
+ if (!mathsModule->MathIndentCB->isChecked()) {
+ mathsModule->MathIndentLE->setEnabled(false);
+ mathsModule->MathIndentLengthCO->setEnabled(false);
}
- if (textLayoutModule->MathIndentCB->isChecked()
- && textLayoutModule->MathIndentCO->currentIndex() == 1) {
- textLayoutModule->MathIndentLE->setEnabled(true);
- textLayoutModule->MathIndentLengthCO->setEnabled(true);
+ if (mathsModule->MathIndentCB->isChecked()
+ && mathsModule->MathIndentCO->currentIndex() == 1) {
+ mathsModule->MathIndentLE->setEnabled(true);
+ mathsModule->MathIndentLengthCO->setEnabled(true);
}
isValid();
}
@@ -1634,8 +1633,8 @@ void GuiDocument::allowMathIndent() {
void GuiDocument::setMathIndent(int item)
{
bool const enable = (item == 1);
- textLayoutModule->MathIndentLE->setEnabled(enable);
- textLayoutModule->MathIndentLengthCO->setEnabled(enable);
+ mathsModule->MathIndentLE->setEnabled(enable);
+ mathsModule->MathIndentLengthCO->setEnabled(enable);
isValid();
}
@@ -2921,13 +2920,31 @@ void GuiDocument::applyView()
if (rb->isChecked())
bp_.use_package(it->first, BufferParams::package_off);
}
- bp_.is_math_indent = textLayoutModule->MathIndentCB->isChecked();
+ bp_.is_math_indent = mathsModule->MathIndentCB->isChecked();
// if math is indented
if (bp_.is_math_indent) {
- Length
mathindent(widgetsToLength(textLayoutModule->MathIndentLE,
-
textLayoutModule->MathIndentLengthCO));
+ Length mathindent(widgetsToLength(mathsModule->MathIndentLE,
+
mathsModule->MathIndentLengthCO));
bp_.setMathIndent(mathindent);
}
+ if (mathsModule->MathIndentCB->isChecked()) {
+ // if formulas are indented
+ switch (mathsModule->MathIndentCO->currentIndex()) {
+ case 0:
+ bp_.setMathIndent(Length());
+ break;
+ case 1: {
+ Length
mathindent(widgetsToLength(mathsModule->MathIndentLE,
+
mathsModule->MathIndentLengthCO));
+ bp_.setMathIndent(mathindent);
+ break;
+ }
+ default:
+ // this should never happen
+ bp_.setMathIndent(Length());
+ break;
+ }
+ }
switch (mathsModule->MathNumberingPosCO->currentIndex()) {
case 0:
bp_.math_number_before = true;
@@ -3026,25 +3043,6 @@ void GuiDocument::applyView()
}
}
- if (textLayoutModule->MathIndentCB->isChecked()) {
- // if formulas are indented
- switch (textLayoutModule->MathIndentCO->currentIndex()) {
- case 0:
- bp_.setMathIndent(Length());
- break;
- case 1: {
- Length
mathindent(widgetsToLength(textLayoutModule->MathIndentLE,
-
textLayoutModule->MathIndentLengthCO));
- bp_.setMathIndent(mathindent);
- break;
- }
- default:
- // this should never happen
- bp_.setMathIndent(Length());
- break;
- }
- }
-
bp_.options =
fromqstr(latexModule->optionsLE->text());
@@ -3410,16 +3408,16 @@ void GuiDocument::paramsToDialog()
// math
if (bp_.is_math_indent) {
- textLayoutModule->MathIndentCB->setChecked(bp_.is_math_indent);
+ mathsModule->MathIndentCB->setChecked(bp_.is_math_indent);
Length const mathindent = bp_.getMathIndent();
int indent = 0;
if (!mathindent.empty()) {
- lengthToWidgets(textLayoutModule->MathIndentLE,
- textLayoutModule->MathIndentLengthCO,
+ lengthToWidgets(mathsModule->MathIndentLE,
+ mathsModule->MathIndentLengthCO,
mathindent, default_unit);
indent = 1;
}
- textLayoutModule->MathIndentCO->setCurrentIndex(indent);
+ mathsModule->MathIndentCO->setCurrentIndex(indent);
setMathIndent(indent);
}
if (bp_.math_number_before)
@@ -4094,11 +4092,11 @@ bool GuiDocument::isValid()
) &&
(
// if we're asking for indentation
- !textLayoutModule->MathIndentCB->isChecked() ||
+ !mathsModule->MathIndentCB->isChecked() ||
// then either we haven't chosen custom
- textLayoutModule->MathIndentCO->currentIndex() != 1 ||
+ mathsModule->MathIndentCO->currentIndex() != 1 ||
// or else a length has been given
- !textLayoutModule->MathIndentLE->text().isEmpty()
+ !mathsModule->MathIndentLE->text().isEmpty()
);
}
diff --git a/src/frontends/qt4/ui/MathsUi.ui b/src/frontends/qt4/ui/MathsUi.ui
index ec3e8c4..e776e78 100644
--- a/src/frontends/qt4/ui/MathsUi.ui
+++ b/src/frontends/qt4/ui/MathsUi.ui
@@ -21,28 +21,109 @@
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2">
+ <item row="1" column="1">
<widget class="QPushButton" name="allPackagesAutoPB">
<property name="text">
<string>Load A&utomatically</string>
</property>
</widget>
</item>
- <item row="1" column="3">
+ <item row="1" column="2">
<widget class="QPushButton" name="allPackagesAlwaysPB">
<property name="text">
<string>Load Alwa&ys</string>
</property>
</widget>
</item>
- <item row="1" column="4" colspan="2">
+ <item row="1" column="3">
<widget class="QPushButton" name="allPackagesNotPB">
<property name="text">
<string>Do &Not Load</string>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="2">
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="MathIndentCB">
+ <property name="toolTip">
+ <string>Indent displayed formulas instead of centering</string>
+ </property>
+ <property name="text">
+ <string>Indent &Formulas</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="MathIndentCO">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Size of the indentation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" colspan="2">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>234</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="MathIndentLE">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="lyx::frontend::LengthCombo" name="MathIndentLengthCO">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>153</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0">
<widget class="QLabel" name="MathNumberingPosL">
<property name="minimumSize">
<size>
@@ -55,30 +136,36 @@
</property>
</widget>
</item>
- <item row="2" column="2" colspan="2">
+ <item row="4" column="1">
<widget class="QComboBox" name="MathNumberingPosCO">
<property name="enabled">
<bool>true</bool>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="toolTip">
<string>Size of the indentation</string>
</property>
</widget>
</item>
- <item row="2" column="5">
+ <item row="4" column="2" colspan="2">
<spacer name="horizontalSpacer_1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>268</width>
- <height>20</height>
+ <width>234</width>
+ <height>17</height>
</size>
</property>
</spacer>
</item>
- <item row="0" column="0" colspan="6">
+ <item row="0" column="0" colspan="4">
<widget class="QTableWidget" name="packagesTW">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -103,9 +190,33 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>lyx::frontend::LengthCombo</class>
+ <extends>QComboBox</extends>
+ <header>LengthCombo.h</header>
+ </customwidget>
+ </customwidgets>
<includes>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>MathIndentCB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MathIndentCO</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>66</x>
+ <y>291</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>164</x>
+ <y>290</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
diff --git a/src/frontends/qt4/ui/TextLayoutUi.ui
b/src/frontends/qt4/ui/TextLayoutUi.ui
index 59f0639..f300bb5 100644
--- a/src/frontends/qt4/ui/TextLayoutUi.ui
+++ b/src/frontends/qt4/ui/TextLayoutUi.ui
@@ -14,7 +14,7 @@
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0" colspan="4">
+ <item row="0" column="0" colspan="3">
<widget class="QGroupBox" name="separateGB">
<property name="title">
<string>Paragraph Separation</string>
@@ -185,7 +185,7 @@
</layout>
</widget>
</item>
- <item row="1" column="0" colspan="4">
+ <item row="1" column="0" colspan="3">
<widget class="QGroupBox" name="spacingGB">
<property name="minimumSize">
<size>
@@ -285,66 +285,7 @@
</property>
</widget>
</item>
- <item row="4" column="1">
- <widget class="QComboBox" name="MathIndentCO">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Size of the indentation</string>
- </property>
- </widget>
- </item>
- <item row="4" column="2" colspan="2">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>203</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="5" column="1">
- <widget class="QLineEdit" name="MathIndentLE">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string/>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="lyx::frontend::LengthCombo" name="MathIndentLengthCO">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string/>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>79</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="6" column="0" colspan="4">
+ <item row="5" column="0" colspan="3">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -385,22 +326,5 @@
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
- <connections>
- <connection>
- <sender>MathIndentCB</sender>
- <signal>toggled(bool)</signal>
- <receiver>MathIndentCO</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>59</x>
- <y>274</y>
- </hint>
- <hint type="destinationlabel">
- <x>182</x>
- <y>270</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>