From: Jürgen Vigna Date: Thu, 18 Apr 2002 14:14:06 +0000 (+0000) Subject: Change the layout also for the last selected paragraph and also if one of X-Git-Tag: 1.6.10~19381 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a5e70bd5efcd8b44cd5c2021068ee734a8649577;p=features.git Change the layout also for the last selected paragraph and also if one of the selected paragraphs does have a different layout. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4025 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index c1c04f4c1e..e0e0556d80 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1789,8 +1789,21 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument) break; } - if (current_layout != layout) { - LyXText * lt = bv_->getLyXText(); + bool change_layout = (current_layout != layout); + LyXText * lt = bv_->getLyXText(); + if (!change_layout && lt->selection.set() && + lt->selection.start.par() != lt->selection.end.par()) + { + Paragraph * spar = lt->selection.start.par(); + Paragraph * epar = lt->selection.end.par()->next(); + while(spar != epar) { + if (spar->layout() != current_layout) { + change_layout = true; + break; + } + } + } + if (change_layout) { hideCursor(); current_layout = layout; update(lt, diff --git a/src/ChangeLog b/src/ChangeLog index 72a63796f6..c3af7757ed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2002-04-18 Juergen Vigna + * BufferView_pimpl.C (Dispatch): fixed to change layout also if one + of the selected paragraph does not have the selected layout also if + the last one had! + + * text2.C (setLayout): fixed bug which did not change last selected + paragraph. + * tabular.C (OldFormatRead): check also for \\end_inset as Lars changed the read and substituted \\end_float with \\end_inset! diff --git a/src/text2.C b/src/text2.C index 2e5d93d03d..bec3b8529f 100644 --- a/src/text2.C +++ b/src/text2.C @@ -500,14 +500,16 @@ Paragraph * LyXText::setLayout(BufferView * bview, // ok we have a selection. This is always between sstart_cur // and sel_end cursor cur = sstart_cur; + Paragraph * par = sstart_cur.par(); + Paragraph * epar = send_cur.par()->next(); LyXLayout const & lyxlayout = textclasslist[bview->buffer()->params.textclass][layout]; do { - cur.par()->applyLayout(layout); - makeFontEntriesLayoutSpecific(bview->buffer(), cur.par()); - Paragraph * fppar = cur.par(); + par->applyLayout(layout); + makeFontEntriesLayoutSpecific(bview->buffer(), par); + Paragraph * fppar = par; fppar->params().spaceTop(lyxlayout.fill_top ? VSpace(VSpace::VFILL) : VSpace(VSpace::NONE)); @@ -515,15 +517,15 @@ Paragraph * LyXText::setLayout(BufferView * bview, VSpace(VSpace::VFILL) : VSpace(VSpace::NONE)); if (lyxlayout.margintype == MARGIN_MANUAL) - cur.par()->setLabelWidthString(lyxlayout.labelstring()); + par->setLabelWidthString(lyxlayout.labelstring()); if (lyxlayout.labeltype != LABEL_BIBLIO && fppar->bibkey) { delete fppar->bibkey; fppar->bibkey = 0; } - if (cur.par() != send_cur.par()) - cur.par(cur.par()->next()); - } while (cur.par() != send_cur.par()); + cur.par(par); + par = par->next(); + } while (par != epar); return endpar; }