X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FIndicesList.cpp;h=52fbbde51e6f0eda0b2a2239b39c11fa5ad09d46;hb=62af7ee772f16f154225d2d0b65d77f4376b6001;hp=a73dbb90b042be053f81db83c8e918fc46d7b223;hpb=c52bd08442214e4d768ee73886dee68e2b812cd1;p=lyx.git diff --git a/src/IndicesList.cpp b/src/IndicesList.cpp index a73dbb90b0..52fbbde51e 100644 --- a/src/IndicesList.cpp +++ b/src/IndicesList.cpp @@ -30,7 +30,9 @@ namespace { class IndexNamesEqual : public std::unary_function { public: - IndexNamesEqual(docstring const & name) : name_(name) {} + IndexNamesEqual(docstring const & name) + : name_(name) + {} bool operator()(Index const & index) const { @@ -44,7 +46,9 @@ private: class IndexHasShortcut : public std::unary_function { public: - IndexHasShortcut(docstring const & shortcut) : shortc_(shortcut) {} + IndexHasShortcut(docstring const & shortcut) + : shortc_(shortcut) + {} bool operator()(Index const & index) const { @@ -54,7 +58,7 @@ private: docstring shortc_; }; -} +} // namespace ///////////////////////////////////////////////////////////////////// @@ -69,6 +73,8 @@ Index::Index() // no theApp() with command line export if (theApp()) theApp()->getRgbColor(Color_indexlabel, color_); + else + frontend::Application::getRgbColorUncached(Color_indexlabel, color_); } @@ -112,9 +118,14 @@ void Index::setColor(string const & str) { if (str.size() == 7 && str[0] == '#') color_ = rgbFromHexName(str); - else + else { // no color set or invalid color -- use predefined color - theApp()->getRgbColor(Color_indexlabel, color_); + // no theApp() with command line export + if (theApp()) + theApp()->getRgbColor(Color_indexlabel, color_); + else + frontend::Application::getRgbColorUncached(Color_indexlabel, color_); + } } @@ -179,11 +190,11 @@ bool IndicesList::add(docstring const & n, docstring const & s) docstring sc = s.empty() ? trim(lowercase(name.substr(0, 3))) : s; if (findShortcut(sc) != 0) { - int i = 1; - docstring scn = sc + convert(i); + int k = 1; + docstring scn = sc + convert(k); while (findShortcut(scn) != 0) { - ++i; - scn = sc + convert(i); + ++k; + scn = sc + convert(k); } in.setShortcut(scn); } else