*
* \author John Levon
* \author Edwin Leuven
+ * \author Richard Heck
*
* Full author contact details are available in file CREDITS.
*/
#include <QCloseEvent>
#include "qt_helpers.h"
+#include "frontends/controllers/ControlParagraph.h"
+
+#include "debug.h"
+
+#include <map>
namespace lyx {
namespace frontend {
form_, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()),
form_, SLOT(slotClose()));
- connect(align, SIGNAL( activated(int) ),
+ connect(restorePB, SIGNAL(clicked()),
+ form_, SLOT(slotRestore()));
+ connect(alignDefaultCB, 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() ) );
+ connect(alignCenterRB, SIGNAL( clicked() ),
this, SLOT( change_adaptor() ) );
connect(linespacing, SIGNAL( activated(int) ),
this, SLOT( change_adaptor() ) );
" items is used. But if you need to, you can"
" change it here."
));
+
+ radioMap[LYX_ALIGN_BLOCK] = alignJustRB;
+ radioMap[LYX_ALIGN_LEFT] = alignLeftRB;
+ radioMap[LYX_ALIGN_RIGHT] = alignRightRB;
+ radioMap[LYX_ALIGN_CENTER] = alignCenterRB;
}
linespacingValue->setEnabled(enable);
}
+
+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);
+ }
+}
+
+
+void QParagraphDialog::on_alignDefaultCB_toggled(bool)
+{
+ checkAlignmentRadioButtons();
+ alignmentToRadioButtons();
+}
+
+
+void QParagraphDialog::alignmentToRadioButtons(LyXAlignment align)
+{
+ if (align == LYX_ALIGN_LAYOUT)
+ align = form_->controller().alignDefault();
+
+ QPRadioMap::const_iterator it = radioMap.begin();
+ for (;it != radioMap.end(); ++it) {
+ if (align == it->first) {
+ it->second->setChecked(true);
+ return;
+ }
+ }
+
+ lyxerr << BOOST_CURRENT_FUNCTION << "Unknown alignment "
+ << align << std::endl;
+}
+
+
+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) {
+ if (it->second->isChecked()) {
+ alignment = it->first;
+ break;
+ }
+ }
+ if (alignment == form_->controller().alignDefault())
+ return LYX_ALIGN_LAYOUT;
+ else return alignment;
+}
+
+
} // namespace frontend
} // namespace lyx
<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
<class>QParagraphUi</class>
<widget class="QDialog" name="QParagraphUi" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
- <width>396</width>
- <height>237</height>
+ <width>493</width>
+ <height>334</height>
</rect>
</property>
+ <property name="focusPolicy" >
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="windowTitle" >
<string/>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>11</number>
- </property>
- <property name="spacing" >
- <number>6</number>
+ <widget class="QWidget" name="layoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>468</width>
+ <height>301</height>
+ </rect>
</property>
- <item row="1" column="1" >
- <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 row="1" column="0" >
- <widget class="QLabel" name="linespacingL" >
- <property name="text" >
- <string>L&ine spacing:</string>
- </property>
- <property name="buddy" >
- <cstring>linespacing</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QComboBox" name="align" >
- <item>
- <property name="text" >
- <string>Justified</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Left</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>Right</string>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
</property>
- </item>
- <item>
- <property name="text" >
- <string>Center</string>
+ <property name="spacing" >
+ <number>6</number>
</property>
- </item>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="alignL" >
- <property name="text" >
- <string>Alig&nment:</string>
- </property>
- <property name="buddy" >
- <cstring>align</cstring>
- </property>
- </widget>
- </item>
- <item rowspan="2" row="0" column="2" >
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <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="QLineEdit" name="linespacingValue" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0" colspan="3" >
- <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>In&dent 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="0" colspan="3" >
- <widget class="QGroupBox" name="labelwidthGB" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="title" >
- <string>Label Width</string>
- </property>
- <layout class="QGridLayout" >
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <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>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <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>
+ <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>
+ <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>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
<property name="margin" >
- <number>11</number>
+ <number>0</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>
+ <item>
+ <widget class="QPushButton" name="restorePB" >
+ <property name="text" >
+ <string>&Restore</string>
+ </property>
+ <property name="autoDefault" >
+ <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="text" >
+ <string>&OK</string>
+ </property>
+ <property name="autoDefault" >
+ <bool>false</bool>
+ </property>
+ <property name="default" >
+ <bool>true</bool>
</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>
+ <item>
+ <widget class="QPushButton" name="applyPB" >
+ <property name="text" >
+ <string>&Apply</string>
+ </property>
+ <property name="autoDefault" >
+ <bool>false</bool>
</property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closePB" >
<property name="text" >
- <string>&Longest label</string>
+ <string>&Close</string>
</property>
- <property name="buddy" >
- <cstring>labelWidth</cstring>
+ <property name="autoDefault" >
+ <bool>false</bool>
</property>
</widget>
</item>
</layout>
- </widget>
- </item>
- <item row="4" column="2" >
- <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>
- </item>
- <item row="5" column="0" colspan="3" >
- <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="text" >
- <string>&Restore</string>
- </property>
- <property name="autoDefault" >
- <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="text" >
- <string>&OK</string>
- </property>
- <property name="autoDefault" >
- <bool>false</bool>
- </property>
- <property name="default" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="applyPB" >
- <property name="text" >
- <string>&Apply</string>
- </property>
- <property name="autoDefault" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="closePB" >
- <property name="text" >
- <string>&Close</string>
- </property>
- <property name="autoDefault" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
+ </item>
+ </layout>
+ </widget>
</widget>
- <pixmapfunction></pixmapfunction>
- <includes>
- <include location="local" >qt_helpers.h</include>
- </includes>
<tabstops>
- <tabstop>align</tabstop>
<tabstop>linespacing</tabstop>
<tabstop>linespacingValue</tabstop>
<tabstop>indentCB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
+ <includes>
+ <include location="local" >qt_helpers.h</include>
+ </includes>
<resources/>
<connections/>
</ui>