* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
- * \author Richard Heck
+ * \author Richard Kimberly Heck
* \author Abdelrazak Younes
* \author Angus Leeming
*
#include "Cursor.h"
#include "FuncRequest.h"
#include "GuiView.h"
-#include "Lexer.h"
+#include "Layout.h"
#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "Spacing.h"
#include "support/debug.h"
-#include "support/gettext.h"
+#include "support/Lexer.h"
#include <QCheckBox>
#include <QDialogButtonBox>
connect(linespacing, SIGNAL(activated(int)), this, SLOT(changed()));
connect(linespacingValue, SIGNAL(textChanged(QString)),
this, SLOT(changed()));
- connect(indentCB, SIGNAL(clicked()), this, SLOT(changed()));
+ connect(noindentCB, SIGNAL(clicked()), this, SLOT(changed()));
connect(labelWidth, SIGNAL(textChanged(QString)),
this, SLOT(changed()));
synchronizedViewCB->setChecked(false);
#endif
- on_synchronizedViewCB_toggled();
+ setButtons(synchronizedViewCB->isChecked());
QDoubleValidator * val = new QDoubleValidator(linespacingValue);
val->setNotation(QDoubleValidator::StandardNotation);
linespacingValue->setValidator(val);
}
-void GuiParagraph::on_synchronizedViewCB_toggled()
+void GuiParagraph::on_synchronizedViewCB_stateChanged(int state)
+{
+ bool in_sync = state == Qt::Checked;
+ setButtons(in_sync);
+
+ // Apply pending changes
+ if (in_sync)
+ changed();
+}
+
+
+void GuiParagraph::setButtons(bool const in_sync)
{
- bool in_sync = synchronizedViewCB->isChecked();
buttonBox->button(QDialogButtonBox::Reset)->setEnabled(!in_sync);
buttonBox->button(QDialogButtonBox::Apply)->setEnabled(!in_sync);
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!in_sync);
- if (!in_sync)
- buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Cancel"));
- else
+ if (in_sync)
buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Close"));
+ else
+ buttonBox->button(QDialogButtonBox::Cancel)->setText(qt_("&Cancel"));
}
// label width
params_.labelWidthString(qstring_to_ucs4(labelWidth->text()));
// indentation
- params_.noindent(!indentCB->isChecked());
+ params_.noindent(noindentCB->isChecked());
dispatchParams();
}
void GuiParagraph::updateView()
{
- on_synchronizedViewCB_toggled();
+ setButtons(synchronizedViewCB->isChecked());
ParagraphParameters const & pp = params();
//indentation
bool const canindent = canIndent();
- indentCB->setEnabled(canindent);
- indentCB->setChecked(canindent && !pp.noindent());
+ noindentCB->setEnabled(canindent);
+ noindentCB->setChecked(canindent && pp.noindent());
// linespacing
int ls;
void GuiParagraph::enableView(bool enable)
{
- indentCB->setEnabled(enable);
+ noindentCB->setEnabled(canIndent() && enable);
linespacing->setEnabled(enable);
labelWidth->setEnabled(enable);
synchronizedViewCB->setEnabled(enable);
}
-Dialog * createGuiParagraph(GuiView & lv)
-{
- return new GuiParagraph(lv);
-}
-
-
} // namespace frontend
} // namespace lyx