]> git.lyx.org Git - features.git/commitdiff
fix bug #342
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 24 Apr 2002 21:45:29 +0000 (21:45 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 24 Apr 2002 21:45:29 +0000 (21:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4062 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/CutAndPaste.C

index 7f1f7babead510123f317bbf32d7dafeb17d02f9..8faa08f87c0d52e42696ded0388ec0b783c6eba0 100644 (file)
@@ -1,3 +1,9 @@
+2002-04-24  Jean-Marc Lasgouttes  <lasgouttes@freesurf.fr>
+
+       * 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  <jug@sad.it>
 
        * BufferView_pimpl.C (workAreaButtonPress): fix handling of mouse-wheel
index e3fabf53e66de5abdd9ec0f6949c53ab401482c3..b7727b40406afd6785089fe6c7d001adc0b084f5 100644 (file)
@@ -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 ")