From: Jean-Marc Lasgouttes Date: Wed, 24 Apr 2002 21:45:29 +0000 (+0000) Subject: fix bug #342 X-Git-Tag: 1.6.10~19345 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7bfe746bab13c5bf3bf7c129266b94cce3d6e973;p=features.git fix bug #342 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4062 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 7f1f7babea..8faa08f87c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2002-04-24 Jean-Marc Lasgouttes + + * CutAndPaste.C (SwitchLayoutsBetweenClasses): when converting a + non-existing layout, do not complain if it was the default layout + of the original class (bug #342) + 2002-04-24 Juergen Vigna * BufferView_pimpl.C (workAreaButtonPress): fix handling of mouse-wheel diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index e3fabf53e6..b7727b4040 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -408,24 +408,18 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1, if (!par || c1 == c2) return ret; + LyXTextClass const & tclass1 = textclasslist[c1]; + LyXTextClass const & tclass2 = textclasslist[c2]; ParIterator end = ParIterator(); for (ParIterator it = ParIterator(par); it != end; ++it) { par = *it; string const name = par->layout(); - LyXTextClass const & tclass = textclasslist[c2]; + bool hasLayout = tclass2.hasLayout(name); - bool hasLayout = tclass.hasLayout(name); + if (!hasLayout) + par->layout(tclass2.defaultLayoutName()); - string lay = tclass.defaultLayoutName(); - if (hasLayout) { - lay = name; - } else { - // not found: use default layout - lay = tclass.defaultLayoutName(); - } - par->layout(lay); - - if (name != par->layout()) { + if (!hasLayout && name != tclass1.defaultLayoutName()) { ++ret; string const s = _("Layout had to be changed from\n") + name + _(" to ")