]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfind.C
Indentation change + small #ifndef NEW_INSETS fix.
[lyx.git] / src / lyxfind.C
index ae521a65e079c33bf1b431dc5de32bcfa8e1b66a..70c9de2c51b98763d5052204542ee52b7ed22ac0 100644 (file)
@@ -20,7 +20,7 @@ int LyXReplace(BufferView * bv,
                bool const & casesens,
                bool const & matchwrd,
                bool const & forward,
-               bool const & replaceall=false)
+               bool const & replaceall)
 {
    int replace_count = 0;
  
@@ -110,15 +110,19 @@ bool LyXFind(BufferView * bv,
 
 // returns true if the specified string is at the specified position
 bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
-                   string const & str, bool const & cs = true,
-                   bool const & mw = false)
+                   string const & str, bool const & cs,
+                   bool const & mw)
 {
        if (!par)
                return false;
    
        string::size_type size = str.length();
        LyXParagraph::size_type i = 0;
+#ifndef NEW_INSETS
        while (((pos + i) < par->Last())
+#else
+       while (((pos + i) < par->size())
+#endif
               && (string::size_type(i) < size)
               && (cs ? (str[i] == par->GetChar(pos + i))
                   : (toupper(str[i]) == toupper(par->GetChar(pos + i)))))
@@ -129,7 +133,11 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
          // if necessary, check whether string matches word
          if (!mw || 
              (mw && ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos - 1)))
+#ifndef NEW_INSETS
                      && (pos + size >= par->Last()
+#else
+                     && (pos + size >= par->size()
+#endif
                          || !IsLetterCharOrDigit(par->GetChar(pos + size))))
               )
              )
@@ -142,17 +150,21 @@ bool IsStringInText(LyXParagraph * par, LyXParagraph::size_type pos,
 // if the string can be found: return true and set the cursor to
 // the new position, cs = casesensitive, mw = matchword
 bool SearchForward(BufferView * bv, string const & str,
-                  bool const & cs = true, bool const & mw = false)
+                  bool const & cs, bool const & mw)
 {
        LyXParagraph * par = bv->text->cursor.par();
        LyXParagraph::size_type pos = bv->text->cursor.pos();
    
        while (par && !IsStringInText(par, pos, str, cs, mw)) {
+#ifndef NEW_INSETS
                if (pos < par->Last() - 1)
+#else
+               if (pos < par->size() - 1)
+#endif
                        ++pos;
                else {
                        pos = 0;
-                       par = par->Next();
+                       par = par->next();
                }
        }
        if (par) {
@@ -168,7 +180,7 @@ bool SearchForward(BufferView * bv, string const & str,
 // if the string can be found: return true and set the cursor to
 // the new position, cs = casesensitive, mw = matchword
 bool SearchBackward(BufferView * bv, string const & str,
-                   bool const & cs = true, bool const & mw = false)
+                   bool const & cs, bool const & mw)
 {
        LyXParagraph * par = bv->text->cursor.par();
        LyXParagraph::size_type pos = bv->text->cursor.pos();
@@ -179,9 +191,13 @@ bool SearchBackward(BufferView * bv, string const & str,
                else {
                        // We skip empty paragraphs (Asger)
                        do {
-                               par = par->Previous();
+                               par = par->previous();
                                if (par)
+#ifndef NEW_INSETS
                                        pos = par->Last() - 1;
+#else
+                                       pos = par->size() - 1;
+#endif
                        } while (par && pos < 0);
                }
        } while (par && !IsStringInText(par, pos, str, cs, mw));