mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
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:
parent
1c76b4b11d
commit
14875e5e31
@ -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()
|
||||
{
|
||||
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
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user