mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Fix some UI bugs related to the paragraph settings dialog. The default
checkbox has been changed to a radio button, so that other alignments can be chosen without the user's having to uncheck "Default". There was some disagreement about the interface here. See, for example, this thread: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg121328.html For now, this will do. The interface here is not fully functional. At present, if the Default happens to be Justified, then checking Justified is simply equivalent to checking Default. This is due to the behavior of Text::setParagraph(), and it should be changed if this interface is retained. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18860 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e077e53a13
commit
1a3daacc5f
@ -50,7 +50,7 @@ QParagraphDialog::QParagraphDialog(QParagraph * form)
|
||||
connect(applyPB, SIGNAL(clicked()), form_, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
|
||||
connect(restorePB, SIGNAL(clicked()), form_, SLOT(slotRestore()));
|
||||
connect(alignDefaultCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignDefaultRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignJustRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignLeftRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(alignRightRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
@ -77,10 +77,17 @@ QParagraphDialog::QParagraphDialog(QParagraph * form)
|
||||
" items is used."
|
||||
));
|
||||
|
||||
radioMap[LYX_ALIGN_LAYOUT] = alignDefaultRB;
|
||||
radioMap[LYX_ALIGN_BLOCK] = alignJustRB;
|
||||
radioMap[LYX_ALIGN_LEFT] = alignLeftRB;
|
||||
radioMap[LYX_ALIGN_RIGHT] = alignRightRB;
|
||||
radioMap[LYX_ALIGN_CENTER] = alignCenterRB;
|
||||
|
||||
/* labelMap[LYX_ALIGN_LAYOUT] = "Default";
|
||||
labelMap[LYX_ALIGN_BLOCK] = "Justified";
|
||||
labelMap[LYX_ALIGN_LEFT] = "Left";
|
||||
labelMap[LYX_ALIGN_RIGHT] = "Right";
|
||||
labelMap[LYX_ALIGN_CENTER] = "Center"; */
|
||||
}
|
||||
|
||||
|
||||
@ -105,35 +112,37 @@ void QParagraphDialog::enableLinespacingValue(int)
|
||||
|
||||
|
||||
void QParagraphDialog::checkAlignmentRadioButtons() {
|
||||
if (alignDefaultCB->isChecked()) {
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it)
|
||||
it->second->setDisabled(true);
|
||||
} else {
|
||||
LyXAlignment alignPossible = form_->controller().alignPossible();
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it)
|
||||
it->second->setEnabled(it->first & alignPossible);
|
||||
LyXAlignment const alignPossible = form_->controller().alignPossible();
|
||||
//LyXAlignment const defaultAlignment = form_->controller().alignDefault();
|
||||
QPRadioMap::iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it) {
|
||||
LyXAlignment const align = it->first;
|
||||
it->second->setEnabled((align & alignPossible) ||
|
||||
(align == LYX_ALIGN_LAYOUT));
|
||||
/* string label = labelMap[align];
|
||||
if (align == LYX_ALIGN_LAYOUT)
|
||||
label += "()" + labelMap[defaultAlignment] + ")";
|
||||
it->second->setText(qt_(label));*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::on_alignDefaultCB_toggled(bool)
|
||||
{
|
||||
checkAlignmentRadioButtons();
|
||||
alignmentToRadioButtons();
|
||||
}
|
||||
|
||||
|
||||
void QParagraphDialog::alignmentToRadioButtons(LyXAlignment align)
|
||||
{
|
||||
if (align == LYX_ALIGN_LAYOUT)
|
||||
align = form_->controller().alignDefault();
|
||||
LyXAlignment const defaultAlignment = form_->controller().alignDefault();
|
||||
if (align == LYX_ALIGN_LAYOUT || align == defaultAlignment) {
|
||||
alignDefaultRB->blockSignals(true);
|
||||
alignDefaultRB->setChecked(true);
|
||||
alignDefaultRB->blockSignals(false);
|
||||
return;
|
||||
}
|
||||
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (;it != radioMap.end(); ++it) {
|
||||
if (align == it->first) {
|
||||
it->second->blockSignals(true);
|
||||
it->second->setChecked(true);
|
||||
it->second->blockSignals(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -145,8 +154,6 @@ void QParagraphDialog::alignmentToRadioButtons(LyXAlignment align)
|
||||
|
||||
LyXAlignment QParagraphDialog::getAlignmentFromDialog()
|
||||
{
|
||||
if (alignDefaultCB->isChecked())
|
||||
return LYX_ALIGN_LAYOUT;
|
||||
LyXAlignment alignment = LYX_ALIGN_NONE;
|
||||
QPRadioMap::const_iterator it = radioMap.begin();
|
||||
for (; it != radioMap.end(); ++it) {
|
||||
@ -155,8 +162,6 @@ LyXAlignment QParagraphDialog::getAlignmentFromDialog()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (alignment == form_->controller().alignDefault())
|
||||
return LYX_ALIGN_LAYOUT;
|
||||
return alignment;
|
||||
}
|
||||
|
||||
@ -243,15 +248,8 @@ void QParagraph::update_contents()
|
||||
}
|
||||
|
||||
// alignment
|
||||
LyXAlignment newAlignment = params.align();
|
||||
LyXAlignment defaultAlignment = controller().alignDefault();
|
||||
bool alignmentIsDefault =
|
||||
newAlignment == LYX_ALIGN_LAYOUT || newAlignment == defaultAlignment;
|
||||
dialog_->alignDefaultCB->blockSignals(true);
|
||||
dialog_->alignDefaultCB->setChecked(alignmentIsDefault);
|
||||
dialog_->alignDefaultCB->blockSignals(false);
|
||||
dialog_->checkAlignmentRadioButtons();
|
||||
dialog_->alignmentToRadioButtons(newAlignment);
|
||||
dialog_->alignmentToRadioButtons(params.align());
|
||||
|
||||
//indentation
|
||||
bool const canindent = controller().canIndent();
|
||||
|
@ -44,13 +44,14 @@ private:
|
||||
QParagraph * form_;
|
||||
typedef std::map<LyXAlignment, QRadioButton *> QPRadioMap;
|
||||
QPRadioMap radioMap;
|
||||
// typedef std::map<LyXAlignment, std::string> QPAlignmentLabels;
|
||||
// QPAlignmentLabels labelMap;
|
||||
|
||||
protected Q_SLOTS:
|
||||
///
|
||||
void change_adaptor();
|
||||
///
|
||||
void enableLinespacingValue(int);
|
||||
///
|
||||
void on_alignDefaultCB_toggled(bool);
|
||||
};
|
||||
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>373</width>
|
||||
<height>203</height>
|
||||
<width>387</width>
|
||||
<height>245</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
@ -36,6 +36,212 @@
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item rowspan="4" row="0" column="0" >
|
||||
<widget class="QGroupBox" name="aligmentGB" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Alignment</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QRadioButton" name="alignCenterRB" >
|
||||
<property name="text" >
|
||||
<string>&Center</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QRadioButton" name="alignRightRB" >
|
||||
<property name="text" >
|
||||
<string>&Right</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QRadioButton" name="alignLeftRB" >
|
||||
<property name="text" >
|
||||
<string>&Left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QRadioButton" name="alignJustRB" >
|
||||
<property name="text" >
|
||||
<string>&Justified</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QRadioButton" name="alignDefaultRB" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Use the default alignment for this paragraph, whatever it is.</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="linespacingL" >
|
||||
<property name="text" >
|
||||
<string>L&ine spacing:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>linespacing</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="linespacing" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Single</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1.5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Double</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="linespacingValue" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>249</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="indentCB" >
|
||||
<property name="text" >
|
||||
<string>Indent &Paragraph</string>
|
||||
</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>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QGroupBox" name="labelwidthGB" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Label Width</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="labelWidth" >
|
||||
<property name="toolTip" >
|
||||
<string>This text defines the width of the paragraph label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="TextLabel2" >
|
||||
<property name="toolTip" >
|
||||
<string>This text defines the width of the paragraph label</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Longest label</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>labelWidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
@ -105,204 +311,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QGroupBox" name="labelwidthGB" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Label Width</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="labelWidth" >
|
||||
<property name="toolTip" >
|
||||
<string>This text defines the width of the paragraph label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="TextLabel2" >
|
||||
<property name="toolTip" >
|
||||
<string>This text defines the width of the paragraph label</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Longest label</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>labelWidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="indentCB" >
|
||||
<property name="text" >
|
||||
<string>Indent &Paragraph</string>
|
||||
</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>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>249</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="linespacingL" >
|
||||
<property name="text" >
|
||||
<string>L&ine spacing:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>linespacing</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="linespacing" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Single</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>1.5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Double</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="linespacingValue" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item rowspan="4" row="0" column="0" >
|
||||
<widget class="QGroupBox" name="aligmentGB" >
|
||||
<property name="title" >
|
||||
<string>Alignment</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="alignDefaultCB" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<italic>true</italic>
|
||||
<bold>false</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="alignJustRB" >
|
||||
<property name="text" >
|
||||
<string>&Justified</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="alignLeftRB" >
|
||||
<property name="text" >
|
||||
<string>&Left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="alignRightRB" >
|
||||
<property name="text" >
|
||||
<string>&Right</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="alignCenterRB" >
|
||||
<property name="text" >
|
||||
<string>&Center</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
Loading…
Reference in New Issue
Block a user