mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
* src/frontends/controllers/frontend_helpers.{cpp,h}:
- new function getSortedColors * src/frontends/qt4/QPrefs.cpp: - use that to sort the colors (bug 2571) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19235 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e9bcf4b0a7
commit
63c587190f
@ -1113,6 +1113,16 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ColorSorter
|
||||
{
|
||||
public:
|
||||
bool operator()(Color::color const & lhs,
|
||||
Color::color const & rhs) const {
|
||||
return lcolor.getGUIName(lhs) < lcolor.getGUIName(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
@ -1147,6 +1157,14 @@ vector<LanguagePair> const getLanguageData(bool character_dlg)
|
||||
return langs;
|
||||
}
|
||||
|
||||
|
||||
vector<Color_color> const getSortedColors(vector<Color_color> colors)
|
||||
{
|
||||
// sort the colors
|
||||
std::sort(colors.begin(), colors.end(), ColorSorter());
|
||||
return colors;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
using support::addName;
|
||||
|
@ -229,6 +229,8 @@ typedef std::pair<docstring, std::string> LanguagePair;
|
||||
* to the vector.
|
||||
*/
|
||||
std::vector<LanguagePair> const getLanguageData(bool character_dlg);
|
||||
/// sort colors for the gui
|
||||
std::vector<Color_color> const getSortedColors(std::vector<Color_color> colors);
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
|
@ -534,9 +534,15 @@ PrefColors::PrefColors(QPrefs * form, QWidget * parent)
|
||||
|| lc == Color::ignore) continue;
|
||||
|
||||
lcolors_.push_back(lc);
|
||||
}
|
||||
lcolors_ = frontend::getSortedColors(lcolors_);
|
||||
vector<Color_color>::const_iterator cit = lcolors_.begin();
|
||||
vector<Color_color>::const_iterator const end = lcolors_.end();
|
||||
for (; cit != end; ++cit)
|
||||
{
|
||||
// This is not a memory leak:
|
||||
/*QListWidgetItem * newItem =*/ new QListWidgetItem(QIcon(icon),
|
||||
toqstr(lcolor.getGUIName(lc)), lyxObjectsLW);
|
||||
toqstr(lcolor.getGUIName(*cit)), lyxObjectsLW);
|
||||
}
|
||||
curcolors_.resize(lcolors_.size());
|
||||
newcolors_.resize(lcolors_.size());
|
||||
|
@ -47,6 +47,9 @@ What's new
|
||||
- Fix bug with math-matrix dialog always producing 1x1 matrices on
|
||||
platforms lacking proper support for wide characters (bug 4076).
|
||||
|
||||
- Sort colors in the Preferences dialog (bug 2571).
|
||||
|
||||
|
||||
* DOCUMENTATION
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user