diff --git a/ChangeLog b/ChangeLog index 4438a2737d..a6ed3c5622 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2001-06-24 The LyX Project + + * src/lyxlex_pimpl.C (compare_tags): use compare_ascii_no_case instead + of compare_no_case + + * src/support/lstrings.C (compare_ascii_no_case): version of + compare_no_case which only considers case of ascii characters + + * src/support/lyxstring.C (replace): a new version of replace(), + to help with compatibility with in gcc 2.95.3. + +2001-06-24 The LyX Project + + * src/insets/insettabular.C (getMaxWidth): We cache a mapping from + inset to cell in order to speed this method up. + +2001-06-23 The LyX Project + + * lib/templates/dinbrief.lyx: remove obsolete \cursor statement + 2001-06-18 Jean-Marc Lasgouttes * lib/tex/cv.cls: diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index d276ba00a2..ef60934080 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -207,9 +207,7 @@ dnl Check the version of g++ 2.95.2) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; 2.95.*) CXXFLAGS="-g $lyx_opt -fno-exceptions";; 2.96*) CXXFLAGS="-g $lyx_opt -fno-exceptions";; - 2.97*) CXXFLAGS="-g $lyx_opt -fvtable-thunks -fno-builtin -ffunction-sections -fdata-sections" - CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE=1";; - 3.0*) CXXFLAGS="-g $lyx_opt -fvtable-thunks -fno-builtin -ffunction-sections -fdata-sections";; + 3.0*) CXXFLAGS="-g $lyx_opt";; *2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; *) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; esac diff --git a/lib/templates/dinbrief.lyx b/lib/templates/dinbrief.lyx index 8b19b12ebf..2711b0e2d2 100644 --- a/lib/templates/dinbrief.lyx +++ b/lib/templates/dinbrief.lyx @@ -37,7 +37,6 @@ \newline \layout Stadt -\cursor 17 \layout Datum diff --git a/src/LaTeX.C b/src/LaTeX.C index b558e4ddc9..442b846c9c 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -607,7 +607,7 @@ void LaTeX::deplog(DepTable & head) // files used by the LaTeX run. The files are then entered into the // dependency file. - string logfile = OnlyFilename(ChangeExtension(file, ".log")); + string const logfile = OnlyFilename(ChangeExtension(file, ".log")); LRegex reg1("\\)* *\\(([^ )]+).*"); LRegex reg2("File: ([^ ]+).*"); diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 7426004eb0..e0ff2b01c0 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1857,12 +1857,28 @@ int InsetTabular::GetMaxWidthOfCell(Painter &, int cell) const int InsetTabular::getMaxWidth(Painter & pain, UpdatableInset const * inset) const { - int const n = tabular->GetNumberOfCells(); - int cell = 0; - for (; cell < n; ++cell) { - if (tabular->GetCellInset(cell) == inset) - break; + typedef std::map Cache; + static Cache cache; + + int cell = -1; + Cache::const_iterator ci = cache.find(inset); + if (ci != cache.end()) { + cell = (*ci).second; + if (tabular->GetCellInset(cell) != inset) { + cell = -1; + } } + + int const n = tabular->GetNumberOfCells(); + if (cell == -1) { + cell = 0; + for (; cell < n; ++cell) { + if (tabular->GetCellInset(cell) == inset) + break; + } + cache[inset] = cell; + } + if (cell >= n) return -1; int w = GetMaxWidthOfCell(pain, cell); diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index 94a268f171..08e919d17c 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -22,7 +22,7 @@ struct compare_tags { // used by lower_bound, sort and sorted inline int operator()(keyword_item const & a, keyword_item const & b) const { - return compare_no_case(a.tag, b.tag) < 0; + return compare_ascii_no_case(a.tag, b.tag) < 0; } }; // } // end of anon namespace diff --git a/src/mathed/math_panel.C b/src/mathed/math_panel.C index 74fb923a4b..54153c6fc7 100644 --- a/src/mathed/math_panel.C +++ b/src/mathed/math_panel.C @@ -241,7 +241,7 @@ void deco_cb(FL_OBJECT *, long data) case MM_APPLY: case MM_OK: { - int i = fl_get_bmtable(fd_deco->menu); + unsigned int i = fl_get_bmtable(fd_deco->menu); // ideally the callback should not be called if the index is // greater than the maxitem of the bmtable, but I do not know // how to enforce that (JMarc) diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 9bfddff022..d2b9da8516 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -79,6 +79,35 @@ int compare_no_case(string const & s, string const & s2, unsigned int len) } +static +int ascii_tolower(int c) { + if (c >= 'A' && c <= 'Z') + return c - 'A' + 'a'; + return c; +} + +int compare_ascii_no_case(string const & s, string const & s2) +{ + string::const_iterator p = s.begin(); + string::const_iterator p2 = s2.begin(); + + while (p != s.end() && p2 != s2.end()) { + int const lc1 = ascii_tolower(*p); + int const lc2 = ascii_tolower(*p2); + if (lc1 != lc2) + return (lc1 < lc2) ? -1 : 1; + ++p; + ++p2; + } + + if (s.size() == s2.size()) + return 0; + if (s.size() < s2.size()) + return -1; + return 1; +} + + bool isStrInt(string const & str) { if (str.empty()) return false; diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 559a43ec99..176bd28b9d 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -23,6 +23,9 @@ /// int compare_no_case(string const & s, string const & s2); +/// +int compare_ascii_no_case(string const & s, string const & s2); + /// int compare_no_case(string const & s, string const & s2, unsigned int len); diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C index 85182daf4c..b8f8dafe91 100644 --- a/src/support/lyxstring.C +++ b/src/support/lyxstring.C @@ -1332,6 +1332,12 @@ lyxstring & lyxstring::replace(size_type i, size_type n, } +/// FY! FY! FY! go away ! +lyxstring & lyxstring::replace(size_type i, size_type n, value_type c) +{ + return replace(i, n, 1, c); +} + lyxstring & lyxstring::replace(iterator i, iterator i2, const lyxstring & str) { TestlyxstringInvariant(this); diff --git a/src/support/lyxstring.h b/src/support/lyxstring.h index d8b0df2cbd..53d0969e10 100644 --- a/src/support/lyxstring.h +++ b/src/support/lyxstring.h @@ -441,6 +441,9 @@ public: lyxstring & replace(size_type i, size_type n, size_type n2, value_type c); + /// FY! FY! FY! go away ! + lyxstring & replace(size_type i, size_type n, value_type c); + /// lyxstring & replace(iterator i, iterator i2, const lyxstring & str);