Properly fix http://bugzilla.lyx.org/show_bug.cgi?id=5285 by using lfun machinery in all cases.

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
This commit is contained in:
Abdelrazak Younes 2008-09-29 10:18:37 +00:00
parent 1c76b4b11d
commit 14875e5e31
2 changed files with 24 additions and 34 deletions

View File

@ -196,9 +196,15 @@ void GuiParagraph::on_restorePB_clicked()
void GuiParagraph::applyView() 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 // get spacing
Spacing::Space ls = Spacing::Default; Spacing::Space ls = Spacing::Default;
@ -223,12 +229,12 @@ void GuiParagraph::applyView()
} }
Spacing const spacing(ls, other); Spacing const spacing(ls, other);
pp.spacing(spacing); params_.spacing(spacing);
// label width // label width
pp.labelWidthString(qstring_to_ucs4(labelWidth->text())); params_.labelWidthString(qstring_to_ucs4(labelWidth->text()));
// indendation // indendation
pp.noindent(!indentCB->isChecked()); params_.noindent(!indentCB->isChecked());
dispatchParams(); dispatchParams();
} }
@ -307,42 +313,28 @@ void GuiParagraph::enableView(bool enable)
} }
ParagraphParameters & GuiParagraph::params()
{
if (haveMultiParSelection()) {
multiparsel_ = ParagraphParameters();
// FIXME: It would be nice to initialise the parameters that
// are common to all paragraphs.
return multiparsel_;
}
return bufferview()->cursor().innerParagraph().params();
}
ParagraphParameters const & GuiParagraph::params() const 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.
params_ = ParagraphParameters();
return params_;
}
return bufferview()->cursor().innerParagraph().params(); return bufferview()->cursor().innerParagraph().params();
} }
void GuiParagraph::dispatchParams() void GuiParagraph::dispatchParams()
{ {
if (haveMultiParSelection()) { ostringstream data;
ostringstream data; params_.write(data);
multiparsel_.write(data); FuncRequest const fr(getLfun(), data.str());
FuncRequest const fr(getLfun(), data.str()); dispatch(fr);
dispatch(fr);
return;
}
bufferview()->updateMetrics();
bufferview()->buffer().changed();
bufferview()->buffer().markDirty();
} }
bool GuiParagraph::haveMultiParSelection() bool GuiParagraph::haveMultiParSelection() const
{ {
Cursor const & cur = bufferview()->cursor(); Cursor const & cur = bufferview()->cursor();
return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit(); return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit();

View File

@ -59,11 +59,9 @@ private:
/// ///
LyXAlignment getAlignmentFromDialog(); LyXAlignment getAlignmentFromDialog();
/// ///
ParagraphParameters & params();
///
ParagraphParameters const & params() const; ParagraphParameters const & params() const;
/// ///
bool haveMultiParSelection(); bool haveMultiParSelection() const;
/// ///
bool canIndent() const; bool canIndent() const;
/// ///
@ -96,7 +94,7 @@ private:
/// ///
QString alignDefaultLabel_; QString alignDefaultLabel_;
/// ///
ParagraphParameters multiparsel_; mutable ParagraphParameters params_;
}; };
} // namespace frontend } // namespace frontend