Abdelrazak Younes <[EMAIL PROTECTED]> writes:
> That is not a question of smartness but of efficiency. At the time I
> didn't want to trigger to make a full copy of the current parameter
> set each cursor move. That was not to avoid the dispatch of an LFUN
> which can still be done easily with current code.
>
>> So, when we have several paragraphs, the dirty flag is correctly set,
>> but when there is only one, nothing correct happens.
>
> That's an incorrect comment.
That was the case before the recently added makeDirty, wasn't it?
>> I think this chage should be reverted and GuiParagraph should be changed
>> to work through LyXFunc.
>
> I'll do that.
Would the attached patch make sense?
JMarc
svndiff src/frontends/qt4/GuiParagraph.cpp src/frontends/qt4/GuiParagraph.h
Index: src/frontends/qt4/GuiParagraph.cpp
===================================================================
--- src/frontends/qt4/GuiParagraph.cpp (revision 26615)
+++ src/frontends/qt4/GuiParagraph.cpp (working copy)
@@ -135,7 +135,7 @@ void GuiParagraph::alignmentToRadioButto
}
-LyXAlignment GuiParagraph::getAlignmentFromDialog()
+LyXAlignment GuiParagraph::getAlignmentFromDialog() const
{
LyXAlignment alignment = LYX_ALIGN_NONE;
RadioMap::const_iterator it = radioMap_.begin();
@@ -196,9 +196,9 @@ void GuiParagraph::on_restorePB_clicked(
void GuiParagraph::applyView()
{
- ParagraphParameters & pp = params();
+ params_ = params();
- pp.align(getAlignmentFromDialog());
+ params_.align(getAlignmentFromDialog());
// get spacing
Spacing::Space ls = Spacing::Default;
@@ -223,12 +223,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 +307,26 @@ void GuiParagraph::enableView(bool enabl
}
-ParagraphParameters & GuiParagraph::params()
+ParagraphParameters GuiParagraph::params() const
{
- if (haveMultiParSelection()) {
- multiparsel_ = ParagraphParameters();
+ if (haveMultiParSelection())
// 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
-{
+ return ParagraphParameters();
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: src/frontends/qt4/GuiParagraph.h
===================================================================
--- src/frontends/qt4/GuiParagraph.h (revision 26615)
+++ src/frontends/qt4/GuiParagraph.h (working copy)
@@ -57,13 +57,11 @@ private:
///
void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
///
- LyXAlignment getAlignmentFromDialog();
+ LyXAlignment getAlignmentFromDialog() const;
///
- ParagraphParameters & params();
+ ParagraphParameters params() const;
///
- ParagraphParameters const & params() const;
- ///
- bool haveMultiParSelection();
+ bool haveMultiParSelection() const;
///
bool canIndent() const;
///
@@ -96,7 +94,7 @@ private:
///
QString alignDefaultLabel_;
///
- ParagraphParameters multiparsel_;
+ ParagraphParameters params_;
};
} // namespace frontend