]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiParagraph.cpp
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / GuiParagraph.cpp
index b840f54ae183ec1f65340b241c1b3a3ab4550edd..49465a7ef06ec5cd53bf8536cc5fa179425a6fcd 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "GuiParagraph.h"
 
+#include "qt_helpers.h"
+
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.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>
 
@@ -110,7 +110,7 @@ void GuiParagraph::checkAlignmentRadioButtons()
                LyXAlignment const align = it->first;
                it->second->setEnabled(align & alignPossible());
        }
-       if (haveMulitParSelection())
+       if (haveMultiParSelection())
                alignDefaultRB->setText(alignDefaultLabel);
        else
                alignDefaultRB->setText(alignDefaultLabel + " ("
@@ -122,8 +122,6 @@ void GuiParagraph::alignmentToRadioButtons(LyXAlignment align)
 {
        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);
@@ -263,9 +261,25 @@ void GuiParagraph::updateView()
 }
 
 
+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.
@@ -284,10 +298,10 @@ ParagraphParameters const & GuiParagraph::params() const
 
 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;
        }
@@ -297,7 +311,7 @@ void GuiParagraph::dispatchParams()
 }
 
 
-bool GuiParagraph::haveMulitParSelection()
+bool GuiParagraph::haveMultiParSelection()
 {
        Cursor cur = bufferview()->cursor();
        return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit();
@@ -325,16 +339,6 @@ LyXAlignment GuiParagraph::alignDefault() const
 
 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);
 }