]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiParagraph.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / GuiParagraph.cpp
index 9fa34c6c2f45617c9ecd6acb331a2309babe97ea..975b6512b46d51e4ed90fed7412829238eec338b 100644 (file)
@@ -218,7 +218,7 @@ void GuiParagraph::applyView()
                break;
        case 4:
                ls = Spacing::Other;
-               other = fromqstr(linespacingValue->text());
+               other = widgetToDoubleStr(linespacingValue);
                break;
        }
 
@@ -227,7 +227,7 @@ void GuiParagraph::applyView()
 
        // label width
        params_.labelWidthString(qstring_to_ucs4(labelWidth->text()));
-       // indendation
+       // indentation
        params_.noindent(!indentCB->isChecked());
 
        dispatchParams();
@@ -242,8 +242,7 @@ void GuiParagraph::updateView()
 
        // label width
        docstring const & labelwidth = pp.labelWidthString();
-       // FIXME We should not compare translated strings
-       if (labelwidth != _("Senseless with this layout!")) {
+       if (hasLabelwidth()) {
                labelwidthGB->setEnabled(true);
                labelWidth->setText(toqstr(labelwidth));
        } else {
@@ -282,7 +281,7 @@ void GuiParagraph::updateView()
        }
        linespacing->setCurrentIndex(ls);
        if (space.getSpace() == Spacing::Other) {
-               linespacingValue->setText(toqstr(space.getValueAsString()));
+               doubleToWidget(linespacingValue, space.getValue());
                linespacingValue->setEnabled(true);
        } else {
                linespacingValue->setText(QString());
@@ -312,7 +311,7 @@ ParagraphParameters const & GuiParagraph::params() const
        if (haveMultiParSelection()) {
                // FIXME: in case of multi-paragraph selection, it would be nice to
                // initialise the parameters that are common to all paragraphs.
-               static ParagraphParameters empty;
+               static ParagraphParameters const empty;
                return empty;
        }
        return bufferview()->cursor().innerParagraph().params();
@@ -337,8 +336,11 @@ bool GuiParagraph::haveMultiParSelection() const
        
 bool GuiParagraph::canIndent() const
 {
-       return buffer().params().paragraph_separation
-               == BufferParams::ParagraphIndentSeparation;
+       Layout const lay = bufferview()->cursor().innerParagraph().layout();
+       if (buffer().params().paragraph_separation
+               == BufferParams::ParagraphIndentSeparation)
+               return (lay.toggle_indent != ITOGGLE_NEVER);
+       return (lay.toggle_indent == ITOGGLE_ALWAYS);
 }
 
 
@@ -354,6 +356,14 @@ LyXAlignment GuiParagraph::alignDefault() const
 }
 
 
+bool GuiParagraph::hasLabelwidth() const
+{
+       Layout layout = bufferview()->cursor().innerParagraph().layout();
+       return (layout.margintype == MARGIN_MANUAL
+               || layout.latextype == LATEX_BIB_ENVIRONMENT);
+}
+
+
 void GuiParagraph::saveSession() const
 {
        Dialog::saveSession();
@@ -380,4 +390,4 @@ Dialog * createGuiParagraph(GuiView & lv)
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiParagraph_moc.cpp"
+#include "moc_GuiParagraph.cpp"