From 57e89ae2bfa4c0cee3d6d8feee11651b3d37d54d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 16 Jul 2002 21:17:10 +0000 Subject: [PATCH] compile fix in XPM image loader; fix opaque handling; remove warnings; fix turkish locale problems; add shortcuts to documents menu git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4661 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 33 +++++++++++++++++++++++++++++ src/LColor.C | 4 ++-- src/MenuBackend.C | 13 +++++++----- src/ToolbarDefaults.C | 2 +- src/buffer.C | 18 ++++++++-------- src/converter.C | 9 +++++--- src/converter.h | 6 +++++- src/debug.C | 2 +- src/frontends/controllers/ChangeLog | 10 +++++++++ src/frontends/controllers/biblio.C | 6 +++--- src/graphics/ChangeLog | 13 ++++++++++++ src/graphics/GraphicsImageXPM.C | 12 ++++++++--- src/graphics/GraphicsImageXPM.h | 2 ++ src/graphics/PreviewLoader.C | 2 -- src/insets/ChangeLog | 5 +++++ src/insets/insetbib.C | 2 +- src/insets/insetcite.C | 4 ++-- src/lyxfont.C | 14 ++++++------ src/lyxlex.C | 2 +- src/lyxlex_pimpl.C | 5 ++++- src/lyxrc.C | 6 +----- src/lyxrc.h | 1 - src/support/ChangeLog | 6 ++++++ src/support/filetools.C | 4 ++-- src/support/lstrings.C | 15 +++++++++++++ src/support/lstrings.h | 3 +++ 26 files changed, 149 insertions(+), 50 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 49ae057572..eaba748c4d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,36 @@ +2002-07-16 Jean-Marc Lasgouttes + + * MenuBackend.C (expand): add numeric shortcuts to document menu + + * lyxrc.C (getDescription): remove RC_NEW_ASK_FILENAME + +2002-07-15 Jean-Marc Lasgouttes + + * lyxfont.C (setLyXFamily): + (setLyXSeries): + (setLyXShape): + (setLyXSize): + (setLyXMisc): + (lyxRead): + * debug.C (value): + * buffer.C (asciiParagraph): use ascii_lowercase + +2002-07-15 Mike Fabian + + * lyxlex_pimpl.C (search_kw): + * lyxlex.C (getLongString): + * converter.h (operator<): + * converter.C (operator<): + * buffer.C (parseSingleLyXformat2Token): + (asciiParagraph): + * ToolbarDefaults.C (read): + * MenuBackend.C (checkShortcuts): + (read): + * LColor.C (getFromGUIName): + (getFromLyXName): use the compare_ascii_no_case instead of + compare_no_case, because in turkish, 'i' is not the lowercase + version of 'I', and thus turkish locale breaks parsing of tags. + 2002-07-16 Angus Leeming * BufferView_pimpl.C (buffer): Previews::generateBufferPreviews diff --git a/src/LColor.C b/src/LColor.C index 44e3004dac..c213c79fe8 100644 --- a/src/LColor.C +++ b/src/LColor.C @@ -185,7 +185,7 @@ LColor::color LColor::getFromGUIName(string const & guiname) const InfoTab::const_iterator ici = infotab.begin(); InfoTab::const_iterator end = infotab.end(); for (; ici != end; ++ici) { - if (!compare_no_case(_(ici->second.guiname), guiname)) + if (!compare_ascii_no_case(_(ici->second.guiname), guiname)) return ici->first; } return LColor::inherit; @@ -198,7 +198,7 @@ LColor::color LColor::getFromLyXName(string const & lyxname) const InfoTab::const_iterator ici = infotab.begin(); InfoTab::const_iterator end = infotab.end(); for (; ici != end; ++ici) { - if (!compare_no_case(ici->second.lyxname, lyxname)) + if (!compare_ascii_no_case(ici->second.lyxname, lyxname)) return ici->first; } return LColor::inherit; diff --git a/src/MenuBackend.C b/src/MenuBackend.C index e3c7687777..0bb7f4c975 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -237,7 +237,7 @@ void Menu::checkShortcuts() const << "\" does not contain shortcut `" << shortcut << '\'' << endl; for (const_iterator it2 = begin(); it2 != it1 ; ++it2) { - if (!compare_no_case(it2->shortcut(), shortcut)) { + if (!compare_ascii_no_case(it2->shortcut(), shortcut)) { lyxerr << "Menu warning: menu entries " << '"' << it1->fulllabel() << "\" and \"" << it2->fulllabel() @@ -296,14 +296,17 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const break; } + int ii = 1; Strings::const_iterator docit = names.begin(); Strings::const_iterator end = names.end(); - for (; docit != end ; ++docit) { + for (; docit != end; ++docit, ++ii) { int const action = lyxaction .getPseudoAction(LFUN_SWITCHBUFFER, *docit); - string const label = - MakeDisplayPath(*docit, 30); + string label = MakeDisplayPath(*docit, 30); + if (ii < 10) + label = tostr(ii) + ". " + + label + '|' + tostr(ii); tomenu.add(MenuItem(MenuItem::Command, label, action)); } @@ -451,7 +454,7 @@ void MenuBackend::read(LyXLex & lex) }; //consistency check - if (compare_no_case(lex.getString(), "menuset")) { + if (compare_ascii_no_case(lex.getString(), "menuset")) { lyxerr << "Menubackend::read: ERROR wrong token:`" << lex.getString() << '\'' << endl; } diff --git a/src/ToolbarDefaults.C b/src/ToolbarDefaults.C index 8930ae982a..19c025217c 100644 --- a/src/ToolbarDefaults.C +++ b/src/ToolbarDefaults.C @@ -98,7 +98,7 @@ void ToolbarDefaults::init() void ToolbarDefaults::read(LyXLex & lex) { //consistency check - if (compare_no_case(lex.getString(), "toolbar")) { + if (compare_ascii_no_case(lex.getString(), "toolbar")) { lyxerr << "Toolbar::read: ERROR wrong token:`" << lex.getString() << '\'' << endl; } diff --git a/src/buffer.C b/src/buffer.C index d51ac5c27a..03f5c042ac 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -548,7 +548,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, layoutname = tclass.defaultLayoutName(); } #ifndef NO_COMPABILITY - if (compare_no_case(layoutname, "latex") == 0) { + if (compare_ascii_no_case(layoutname, "latex") == 0) { ert_comp.active = true; ert_comp.fromlayout = true; ert_comp.font = font; @@ -569,7 +569,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, #ifdef USE_CAPTION // The is the compability reading of layout caption. // It can be removed in LyX version 1.3.0. (Lgb) - if (compare_no_case(layoutname, "caption") == 0) { + if (compare_ascii_no_case(layoutname, "caption") == 0) { // We expect that the par we are now working on is // really inside a InsetText inside a InsetFloat. // We also know that captions can only be @@ -1581,7 +1581,7 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par, // This strange command allows LyX to recognize "natbib" style // citations: citet, citep, Citet etc. - if (compare_no_case(cmdName, "cite", 4) == 0) { + if (compare_ascii_no_case(cmdName.substr(0,4), "cite") == 0) { inset = new InsetCitation(inscmd); } else if (cmdName == "bibitem") { lex.printError("Wrong place for bibitem"); @@ -1958,22 +1958,22 @@ string const Buffer::asciiParagraph(Paragraph const * par, if (compare_no_case(tmp, "itemize") == 0) { ltype = 1; ltype_depth = depth + 1; - } else if (compare_no_case(tmp, "enumerate") == 0) { + } else if (compare_ascii_no_case(tmp, "enumerate") == 0) { ltype = 2; ltype_depth = depth + 1; - } else if (contains(lowercase(tmp), "ection")) { + } else if (contains(ascii_lowercase(tmp), "ection")) { ltype = 3; ltype_depth = depth + 1; - } else if (contains(lowercase(tmp), "aragraph")) { + } else if (contains(ascii_lowercase(tmp), "aragraph")) { ltype = 4; ltype_depth = depth + 1; - } else if (compare_no_case(tmp, "description") == 0) { + } else if (compare_ascii_no_case(tmp, "description") == 0) { ltype = 5; ltype_depth = depth + 1; - } else if (compare_no_case(tmp, "abstract") == 0) { + } else if (compare_ascii_no_case(tmp, "abstract") == 0) { ltype = 6; ltype_depth = 0; - } else if (compare_no_case(tmp, "bibliography") == 0) { + } else if (compare_ascii_no_case(tmp, "bibliography") == 0) { ltype = 7; ltype_depth = 0; } else { diff --git a/src/converter.C b/src/converter.C index f91c85f607..b36c0c9a34 100644 --- a/src/converter.C +++ b/src/converter.C @@ -264,10 +264,13 @@ void Converter::readFlags() bool operator<(Converter const & a, Converter const & b) { - int const i = compare_no_case(a.From->prettyname(), - b.From->prettyname()); + // use the compare_ascii_no_case instead of compare_no_case, + // because in turkish, 'i' is not the lowercase version of 'I', + // and thus turkish locale breaks parsing of tags. + int const i = compare_ascii_no_case(a.From->prettyname(), + b.From->prettyname()); if (i == 0) - return compare_no_case(a.To->prettyname(), b.To->prettyname()) + return compare_ascii_no_case(a.To->prettyname(), b.To->prettyname()) < 0; else return i < 0; diff --git a/src/converter.h b/src/converter.h index 0f507af1ac..77dc9723d0 100644 --- a/src/converter.h +++ b/src/converter.h @@ -77,7 +77,11 @@ private: inline bool operator<(Format const & a, Format const & b) { - return compare_no_case(a.prettyname(), b.prettyname()) < 0; + // use the compare_ascii_no_case instead of compare_no_case, + // because in turkish, 'i' is not the lowercase version of 'I', + // and thus turkish locale breaks parsing of tags. + + return compare_ascii_no_case(a.prettyname(), b.prettyname()) < 0; } diff --git a/src/debug.C b/src/debug.C index b629f57a0d..8506660b23 100644 --- a/src/debug.C +++ b/src/debug.C @@ -80,7 +80,7 @@ Debug::type Debug::value(string const & val) string v(val); while (!v.empty()) { string::size_type st = v.find(','); - string tmp(lowercase(v.substr(0, st))); + string tmp(ascii_lowercase(v.substr(0, st))); if (tmp.empty()) break; // Is it a number? diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 6afca5d7da..4f49ba5e43 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,13 @@ +2002-07-15 Jean-Marc Lasgouttes + + * biblio.C (parseBibTeX): use ascii_lowercase instead of lowercase + +2002-07-15 Mike Fabian + + * biblio.C (compareNoCase): use the compare_ascii_no_case instead + of compare_no_case, because in turkish, 'i' is not the lowercase + version of 'I', and thus turkish locale breaks parsing of tags. + 2002-07-04 Lars Gullik Bjønnes * ControlBibtex.C (applyParamsToInset): ws change diff --git a/src/frontends/controllers/biblio.C b/src/frontends/controllers/biblio.C index ab83d4ed1b..7ae01ac0fa 100644 --- a/src/frontends/controllers/biblio.C +++ b/src/frontends/controllers/biblio.C @@ -266,7 +266,7 @@ string const getYear(InfoMap const & map, string const & key) struct compareNoCase: public std::binary_function { bool operator()(string const & s1, string const & s2) const { - return compare_no_case(s1, s2) < 0; + return compare_ascii_no_case(s1, s2) < 0; } }; @@ -424,9 +424,9 @@ string const parseBibTeX(string data, string const & findkey) do { dummy = token(data, ',', Entries++); if (!dummy.empty()) { - found = contains(lowercase(dummy), findkey); + found = contains(ascii_lowercase(dummy), findkey); if (findkey == "title" && - contains(lowercase(dummy), "booktitle")) + contains(ascii_lowercase(dummy), "booktitle")) found = false; } } while (!found && !dummy.empty()); diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index cf8d110466..4b75a6b3e7 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,15 @@ +2002-07-16 Jean-Marc Lasgouttes + + * PreviewLoader.C (setConverter): remove unused variable + + * GraphicsImageXPM.C (isDrawable): implement + (setPixmap): the opaque color is black, not white + +2002-07-15 Jean-Marc Lasgouttes + + * GraphicsImageXPM.C (color_none_id): + (contains_color_none): use ascii_lowercase instead of lowercase + 2002-07-16 Angus Leeming * PreviewLoader.C: greater use of STL algorithms. @@ -280,6 +292,7 @@ pretty temperamemtal at the moment. 2002-04-16 Rob Lahaye + * GraphicsImageXPM.C: fix clipping for boundingbox y-coordinates 2002-04-08 Angus Leeming diff --git a/src/graphics/GraphicsImageXPM.C b/src/graphics/GraphicsImageXPM.C index ee4dc49e6d..726a56b62c 100644 --- a/src/graphics/GraphicsImageXPM.C +++ b/src/graphics/GraphicsImageXPM.C @@ -95,6 +95,12 @@ unsigned int ImageXPM::getHeight() const } +bool ImageXPM::isDrawable() const +{ + return pixmap_; +} + + Pixmap ImageXPM::getPixmap() const { if (!pixmap_status_ == PIXMAP_SUCCESS) @@ -207,7 +213,7 @@ bool ImageXPM::setPixmap(Params const & params) // some image magick versions use this xpm_col[1].name = 0; xpm_col[1].value = "opaque"; - xpm_col[1].pixel = lyxColorHandler->colorPixel(LColor::white); + xpm_col[1].pixel = lyxColorHandler->colorPixel(LColor::black); attrib.numsymbols = 2; attrib.colorsymbols = xpm_col; @@ -552,7 +558,7 @@ unsigned int ImageXPM::Data::color_none_id() const XpmColor * table = colorTable_.get(); for (size_t i = 0; i < ncolors_; ++i) { char const * const color = table[i].c_color; - if (color && lowercase(color) == "none") + if (color && ascii_lowercase(color) == "none") return uint(i); } return 0; @@ -699,7 +705,7 @@ bool contains_color_none(XpmImage const & image) { for (size_t i = 0; i < image.ncolors; ++i) { char const * const color = image.colorTable[i].c_color; - if (color && lowercase(color) == "none") + if (color && ascii_lowercase(color) == "none") return true; } return false; diff --git a/src/graphics/GraphicsImageXPM.h b/src/graphics/GraphicsImageXPM.h index 6d16019bd8..01b720d40b 100644 --- a/src/graphics/GraphicsImageXPM.h +++ b/src/graphics/GraphicsImageXPM.h @@ -48,6 +48,8 @@ public: /// Get the image height unsigned int getHeight() const; + bool isDrawable() const; + /** Load the image file into memory. * In this case (ImageXPM), the process is blocking. */ diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index 9344e69e79..4685d52392 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -605,8 +605,6 @@ string const unique_filename(string const bufferpath) Converter const * setConverter() { - Converter const * converter = 0; - string const from = "lyxpreview"; Formats::FormatList::const_iterator it = formats.begin(); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index a6afe99da0..5f5f03f60d 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-07-15 Jean-Marc Lasgouttes + + * insetcite.C (getNatbibLabel): + * insetbib.C (getKeys): use ascii_lowercase instead of lowercase + 2002-07-15 John Levon * insetgraphics.C: use ->isDrawable() diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 53b7a89d5b..2799dad562 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -259,7 +259,7 @@ vector > const InsetBibtex::getKeys(Buffer const * buffer) linebuf = subst(linebuf, '{', '('); string tmp; linebuf = split(linebuf, tmp, '('); - tmp = lowercase(tmp); + tmp = ascii_lowercase(tmp); if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble")) { linebuf = split(linebuf, tmp, ','); diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index c5cc7f21ff..ecd9aa7705 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -93,8 +93,8 @@ string const getNatbibLabel(Buffer const * buffer, bool const full = citeType[citeType.size()-1] == '*'; string const cite_type = full ? - lowercase(citeType.substr(0,citeType.size()-1)) : - lowercase(citeType); + ascii_lowercase(citeType.substr(0,citeType.size()-1)) : + ascii_lowercase(citeType); string before_str; if (!before.empty()) { diff --git a/src/lyxfont.C b/src/lyxfont.C index 8cd660eed0..362253b678 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -580,7 +580,7 @@ string const LyXFont::stateText(BufferParams * params) const // Set family according to lyx format string LyXFont & LyXFont::setLyXFamily(string const & fam) { - string const s = lowercase(fam); + string const s = ascii_lowercase(fam); int i = 0; while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") ++i; @@ -596,7 +596,7 @@ LyXFont & LyXFont::setLyXFamily(string const & fam) // Set series according to lyx format string LyXFont & LyXFont::setLyXSeries(string const & ser) { - string const s = lowercase(ser); + string const s = ascii_lowercase(ser); int i = 0; while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i; @@ -612,7 +612,7 @@ LyXFont & LyXFont::setLyXSeries(string const & ser) // Set shape according to lyx format string LyXFont & LyXFont::setLyXShape(string const & sha) { - string const s = lowercase(sha); + string const s = ascii_lowercase(sha); int i = 0; while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i; @@ -628,7 +628,7 @@ LyXFont & LyXFont::setLyXShape(string const & sha) // Set size according to lyx format string LyXFont & LyXFont::setLyXSize(string const & siz) { - string const s = lowercase(siz); + string const s = ascii_lowercase(siz); int i = 0; while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i; if (s == LyXSizeNames[i]) { @@ -643,7 +643,7 @@ LyXFont & LyXFont::setLyXSize(string const & siz) // Set size according to lyx format string LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz) { - string const s = lowercase(siz); + string const s = ascii_lowercase(siz); int i = 0; while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i; if (s == LyXMiscNames[i]) @@ -677,7 +677,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex) bool finished = false; while (!finished && lex.isOK() && !error) { lex.next(); - string const tok = lowercase(lex.getString()); + string const tok = ascii_lowercase(lex.getString()); if (tok.empty()) { continue; @@ -701,7 +701,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex) setLyXSize(ttok); } else if (tok == "misc") { lex.next(); - string const ttok = lowercase(lex.getString()); + string const ttok = ascii_lowercase(lex.getString()); if (ttok == "no_bar") { setUnderbar(OFF); diff --git a/src/lyxlex.C b/src/lyxlex.C index 04c4b23c7e..2e8e8e32f1 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -168,7 +168,7 @@ string const LyXLex::getLongString(string const & endtoken) // We do a case independent comparison, like search_kw // does. - if (compare_no_case(token, endtoken) != 0) { + if (compare_ascii_no_case(token, endtoken) != 0) { string tmpstr = getString(); if (firstline) { unsigned int i = 0; diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index 3156c864da..918513a497 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -379,8 +379,11 @@ int LyXLex::Pimpl::search_kw(char const * const tag) const keyword_item * res = lower_bound(table, table + no_items, search_tag, compare_tags()); + // use the compare_ascii_no_case instead of compare_no_case, + // because in turkish, 'i' is not the lowercase version of 'I', + // and thus turkish locale breaks parsing of tags. if (res != table + no_items - && !compare_no_case(res->tag, tag)) + && !compare_ascii_no_case(res->tag, tag)) return res->code; return LEX_UNDEF; } diff --git a/src/lyxrc.C b/src/lyxrc.C index 7ad40b5f08..f782571ee1 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -501,7 +501,7 @@ int LyXRC::read(string const & filename) case RC_DEFAULT_PAPERSIZE: if (lexrc.next()) { string const size = - lowercase(lexrc.getString()); + ascii_lowercase(lexrc.getString()); if (size == "usletter") default_papersize = BufferParams::PAPER_USLETTER; @@ -2003,10 +2003,6 @@ string const LyXRC::getDescription(LyXRCTags tag) case RC_FORMAT: break; - case RC_NEW_ASK_FILENAME: - str = _("This sets the behaviour if you want to be asked for a filename when creating a new document or wait until you save it and be asked then."); - break; - case RC_DEFAULT_LANGUAGE: str = _("New documents will be assigned this language."); break; diff --git a/src/lyxrc.h b/src/lyxrc.h index 96d243e53d..2c206d2ff6 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -116,7 +116,6 @@ enum LyXRCTags { RC_CONVERTER, RC_VIEWER, RC_FORMAT, - RC_NEW_ASK_FILENAME, RC_DEFAULT_LANGUAGE, RC_LABEL_INIT_LENGTH, RC_DISPLAY_GRAPHICS, diff --git a/src/support/ChangeLog b/src/support/ChangeLog index d1541f5dde..eb4e94c52d 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,4 +1,10 @@ +2002-07-15 Jean-Marc Lasgouttes + * filetools.C (IsLyXFilename): + (IsSGMLFilename): use ascii_lowercase instead of lowercase + + * lstrings.[Ch] (ascii_lowercase): new function + 2002-07-16 André Pönitz * FileInfo.Ch: remove unneeded code diff --git a/src/support/filetools.C b/src/support/filetools.C index 0a398e98fe..278bb797c7 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -85,13 +85,13 @@ extern string system_packageList; bool IsLyXFilename(string const & filename) { - return suffixIs(lowercase(filename), ".lyx"); + return suffixIs(ascii_lowercase(filename), ".lyx"); } bool IsSGMLFilename(string const & filename) { - return suffixIs(lowercase(filename), ".sgml"); + return suffixIs(ascii_lowercase(filename), ".sgml"); } diff --git a/src/support/lstrings.C b/src/support/lstrings.C index bcbfb48917..d5af3d18c1 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -248,6 +248,12 @@ struct local_uppercase { } }; +struct local_ascii_lowercase { + char operator()(char c) const { + return ascii_tolower(c); + } +}; + } // end of anon namespace string const lowercase(string const & a) @@ -265,6 +271,15 @@ string const uppercase(string const & a) } +string const ascii_lowercase(string const & a) +{ + string tmp(a); + transform(tmp.begin(), tmp.end(), tmp.begin(), + local_ascii_lowercase()); + return tmp; +} + + bool prefixIs(string const & a, char const * pre) { lyx::Assert(pre); diff --git a/src/support/lstrings.h b/src/support/lstrings.h index eccfcc9ebd..4e2627f85b 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -80,6 +80,9 @@ char lowercase(char c); /// char uppercase(char c); +/// same as lowercase(), but ignores locale +string const ascii_lowercase(string const &); + /// string const lowercase(string const &); -- 2.39.2