]> git.lyx.org Git - features.git/commitdiff
* cosmetic for loops with deep if nestings
authorStefan Schimanski <sts@lyx.org>
Sun, 23 Dec 2007 01:28:03 +0000 (01:28 +0000)
committerStefan Schimanski <sts@lyx.org>
Sun, 23 Dec 2007 01:28:03 +0000 (01:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22276 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/MathMacroTemplate.cpp

index 26018e1e7533a8126bf468c2b590e80dc623b3fb..e8ba817715a7535345da4f32801805db6d5efa57 100644 (file)
@@ -600,18 +600,19 @@ void fixMacroInstancesAddRemove(Cursor const & from, docstring const & name, int
 
                // in front of macro instance?
                Inset * inset = dit.nextInset();
-               if (inset) {
-                       InsetMath * insetMath = inset->asInsetMath();
-                       if (insetMath) {
-                               MathMacro * macro = insetMath->asMacro();
-                               if (macro && macro->name() == name && macro->folded()) {
-                                       // found macro instance
-                                       if (insert)
-                                               macro->insertArgument(n);
-                                       else
-                                               macro->removeArgument(n);
-                               }
-                       }
+               if (!inset)
+                       continue;
+               InsetMath * insetMath = inset->asInsetMath();
+               if (!insetMath)
+                       continue;
+
+               MathMacro * macro = insetMath->asMacro();
+               if (macro && macro->name() == name && macro->folded()) {
+                       // found macro instance
+                       if (insert)
+                               macro->insertArgument(n);
+                       else
+                               macro->removeArgument(n);
                }
        }
 }
@@ -631,15 +632,15 @@ void fixMacroInstancesOptional(Cursor const & from, docstring const & name, int
 
                // in front of macro instance?
                Inset * inset = dit.nextInset();
-               if (inset) {
-                       InsetMath * insetMath = inset->asInsetMath();
-                       if (insetMath) {
-                               MathMacro * macro = insetMath->asMacro();
-                               if (macro && macro->name() == name && macro->folded()) {
-                                       // found macro instance
-                                       macro->setOptionals(optionals);
-                               }
-                       }
+               if (!inset)
+                       continue;
+               InsetMath * insetMath = inset->asInsetMath();
+               if (!insetMath)
+                       continue;
+               MathMacro * macro = insetMath->asMacro();
+               if (macro && macro->name() == name && macro->folded()) {
+                       // found macro instance
+                       macro->setOptionals(optionals);
                }
        }
 }
@@ -661,14 +662,14 @@ void fixMacroInstancesFunctional(Cursor const & from,
 
                // in front of macro instance?
                Inset * inset = dit.nextInset();
-               if (inset) {
-                       InsetMath * insetMath = inset->asInsetMath();
-                       if (insetMath) {
-                               MathMacro * macro = insetMath->asMacro();
-                               if (macro && macro->name() == name && macro->folded())
-                                       F(macro);
-                       }
-               }
+               if (!inset)
+                       continue;
+               InsetMath * insetMath = inset->asInsetMath();
+               if (!insetMath)
+                       continue;
+               MathMacro * macro = insetMath->asMacro();
+               if (macro && macro->name() == name && macro->folded())
+                       F(macro);
        }
 }