]> git.lyx.org Git - features.git/commitdiff
Properly fix http://bugzilla.lyx.org/show_bug.cgi?id=5285 by using lfun machinery...
authorAbdelrazak Younes <younes@lyx.org>
Mon, 29 Sep 2008 10:18:37 +0000 (10:18 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 29 Sep 2008 10:18:37 +0000 (10:18 +0000)
Also fixes dialog view in case of multipar selection.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26617 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiParagraph.cpp
src/frontends/qt4/GuiParagraph.h

index 835bd520ebc4b57eaada06c7e1221d1e963ffc71..c991025e3122ce9593cc58a7b1d8dfc8d7dd0668 100644 (file)
@@ -196,9 +196,15 @@ void GuiParagraph::on_restorePB_clicked()
 
 void GuiParagraph::applyView()
 {
-       ParagraphParameters & pp = params();
+       if (haveMultiParSelection()) {
+               // FIXME: in case of multi-paragraph selection, it would be nice to
+               // initialise the parameters that are common to all paragraphs.
+               params_ = ParagraphParameters();
+       } else {
+               params_ = bufferview()->cursor().innerParagraph().params();
+       }
 
-       pp.align(getAlignmentFromDialog());
+       params_.align(getAlignmentFromDialog());
 
        // get spacing
        Spacing::Space ls = Spacing::Default;
@@ -223,12 +229,12 @@ void GuiParagraph::applyView()
        }
 
        Spacing const spacing(ls, other);
-       pp.spacing(spacing);
+       params_.spacing(spacing);
 
        // label width
-       pp.labelWidthString(qstring_to_ucs4(labelWidth->text()));
+       params_.labelWidthString(qstring_to_ucs4(labelWidth->text()));
        // indendation
-       pp.noindent(!indentCB->isChecked());
+       params_.noindent(!indentCB->isChecked());
 
        dispatchParams();
 }
@@ -307,42 +313,28 @@ void GuiParagraph::enableView(bool enable)
 }
 
 
-ParagraphParameters & GuiParagraph::params()
+ParagraphParameters const & GuiParagraph::params() const
 {
        if (haveMultiParSelection()) {
-               multiparsel_ = ParagraphParameters();
-               // FIXME: It would be nice to initialise the parameters that
-               // are common to all paragraphs.
-               return multiparsel_;
+               // FIXME: in case of multi-paragraph selection, it would be nice to
+               // initialise the parameters that are common to all paragraphs.
+               params_ = ParagraphParameters();
+               return params_;
        }
-
-       return bufferview()->cursor().innerParagraph().params();
-}
-
-
-ParagraphParameters const & GuiParagraph::params() const
-{
        return bufferview()->cursor().innerParagraph().params();
 }
 
 
 void GuiParagraph::dispatchParams()
 {
-       if (haveMultiParSelection()) {
-               ostringstream data;
-               multiparsel_.write(data);
-               FuncRequest const fr(getLfun(), data.str());
-               dispatch(fr);
-               return;
-       }
-
-       bufferview()->updateMetrics();
-       bufferview()->buffer().changed();
-       bufferview()->buffer().markDirty();
+       ostringstream data;
+       params_.write(data);
+       FuncRequest const fr(getLfun(), data.str());
+       dispatch(fr);
 }
 
 
-bool GuiParagraph::haveMultiParSelection()
+bool GuiParagraph::haveMultiParSelection() const
 {
        Cursor const & cur = bufferview()->cursor();
        return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit();
index 429284fc4dacda794336b6170bf86cae5a9968ab..42677f560308c0f7e4820ade4fea02a4a5763938 100644 (file)
@@ -59,11 +59,9 @@ private:
        ///
        LyXAlignment getAlignmentFromDialog();
        ///
-       ParagraphParameters & params();
-       ///
        ParagraphParameters const & params() const;
        ///
-       bool haveMultiParSelection();
+       bool haveMultiParSelection() const;
        ///
        bool canIndent() const;
        ///
@@ -96,7 +94,7 @@ private:
        ///
        QString alignDefaultLabel_;
        ///
-       ParagraphParameters multiparsel_;
+       mutable ParagraphParameters params_;
 };
 
 } // namespace frontend