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
This commit is contained in:
Jürgen Vigna 2002-04-18 14:14:06 +00:00
parent 763fbc6f1b
commit a5e70bd5ef
3 changed files with 31 additions and 9 deletions

View File

@ -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,

View File

@ -1,5 +1,12 @@
2002-04-18 Juergen Vigna <jug@sad.it>
* 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!

View File

@ -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;
}