#include "GuiParagraph.h"
+#include "qt_helpers.h"
+
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-//#include "DialogView.h"
-//#include "DockView.h"
#include "FuncRequest.h"
#include "GuiView.h"
#include "Lexer.h"
#include "Paragraph.h"
#include "ParagraphParameters.h"
-#include "qt_helpers.h"
#include "Spacing.h"
#include "support/debug.h"
#include "support/gettext.h"
#include <QCheckBox>
-#include <QCloseEvent>
#include <QLineEdit>
#include <QPushButton>
namespace frontend {
GuiParagraph::GuiParagraph(GuiView & lv)
- : DialogView(lv, "paragraph")
+ : DialogView(lv, "paragraph", qt_("Paragraph Settings"))
{
setupUi(this);
- setWindowTitle(qt_("Paragraph Settings"));
connect(alignDefaultRB, SIGNAL(clicked()), this, SLOT(changed()));
connect(alignJustRB, SIGNAL(clicked()), this, SLOT(changed()));
connect(labelWidth, SIGNAL(textChanged(QString)),
this, SLOT(changed()));
-
+#ifdef Q_WS_MACX
+ // On Mac it's common to have tool windows which are always in the
+ // foreground and are hidden when the main window is not focused.
+ setWindowFlags(Qt::Tool);
+ synchronizedViewCB->setChecked(true);
+#else
synchronizedViewCB->setChecked(false);
+#endif
+
on_synchronizedViewCB_toggled();
linespacingValue->setValidator(new QDoubleValidator(linespacingValue));
LyXAlignment const align = it->first;
it->second->setEnabled(align & alignPossible());
}
- if (haveMulitParSelection())
+ if (haveMultiParSelection())
alignDefaultRB->setText(alignDefaultLabel);
else
alignDefaultRB->setText(alignDefaultLabel + " ("
{
RadioMap::const_iterator it = radioMap.begin();
for (;it != radioMap.end(); ++it) {
- if (!it->second->isEnabled())
- continue;
it->second->blockSignals(true);
it->second->setChecked(align == it->first);
it->second->blockSignals(false);
}
-void GuiParagraph::enableView(bool enable)
-{
-}
-
-
void GuiParagraph::updateView()
{
on_synchronizedViewCB_toggled();
}
+void GuiParagraph::enableView(bool enable)
+{
+ indentCB->setEnabled(enable);
+ linespacing->setEnabled(enable);
+ labelWidth->setEnabled(enable);
+ synchronizedViewCB->setEnabled(enable);
+ applyPB->setEnabled(enable);
+ restorePB->setEnabled(enable);
+ if (!enable)
+ synchronizedViewCB->setChecked(true);
+ RadioMap::const_iterator it = radioMap.begin();
+ for (; it != radioMap.end(); ++it)
+ it->second->setEnabled(enable);
+}
+
+
ParagraphParameters & GuiParagraph::params()
{
- if (haveMulitParSelection()) {
+ if (haveMultiParSelection()) {
multiparsel_ = ParagraphParameters();
// FIXME: It would be nice to initialise the parameters that
// are common to all paragraphs.
void GuiParagraph::dispatchParams()
{
- if (haveMulitParSelection()) {
+ if (haveMultiParSelection()) {
ostringstream data;
multiparsel_.write(data);
- FuncRequest const fr(LFUN_PARAGRAPH_PARAMS_APPLY, data.str());
+ FuncRequest const fr(getLfun(), data.str());
dispatch(fr);
return;
}
}
-bool GuiParagraph::haveMulitParSelection()
+bool GuiParagraph::haveMultiParSelection()
{
Cursor cur = bufferview()->cursor();
return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit();
Dialog * createGuiParagraph(GuiView & lv)
{
-#if 0
- GuiView & guiview = static_cast<GuiView &>(lv);
-#ifdef USE_DOCK_WIDGET
- return new DockView<ControlParagraph, GuiParagraph>(guiview, "paragraph",
- Qt::TopDockWidgetArea);
-#else
- return new DialogView<ControlParagraph, GuiParagraph>(guiview, "paragraph");
-#endif
-#endif
-
return new GuiParagraph(lv);
}