summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhouz <houz@gmx.de>2016-06-02 13:12:07 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2016-06-02 13:12:07 +0000
commit86a74b4a93ab62c8ef7819dc549fe7b3ace24916 (patch)
tree26e362218ea55b81ca775b05b7acd0d8587ea16f /src
parentTranslations. Updating all translation files. (diff)
downloadinkscape-86a74b4a93ab62c8ef7819dc549fe7b3ace24916.tar.gz
inkscape-86a74b4a93ab62c8ef7819dc549fe7b3ace24916.zip
Sort color profile lists
Fixed bugs: - https://launchpad.net/bugs/1457126 (bzr r14946)
Diffstat (limited to 'src')
-rw-r--r--src/color-profile.cpp83
-rw-r--r--src/color-profile.h6
-rw-r--r--src/ui/dialog/document-properties.cpp91
-rw-r--r--src/ui/dialog/document-properties.h18
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp44
-rw-r--r--src/ui/widget/color-icc-selector.cpp17
6 files changed, 178 insertions, 81 deletions
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 523026aa5..9e545df03 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -705,7 +705,16 @@ gint Inkscape::CMSSystem::getChannelCount(ColorProfile const *profile)
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
-std::vector<Glib::ustring> ColorProfile::getBaseProfileDirs() {
+// sort home dir before the rest, and alphabetically oterhwise
+bool compareProfileBoolPair(const std::pair<Glib::ustring, bool> & a, const std::pair<Glib::ustring, bool> & b)
+{
+ if (a.second != b.second) return a.second; // a comes first iff it's home, i.e., second == true
+ return a.first < b.first;
+}
+
+// the bool return value tells if it's a user's directory or a system location
+// note that this will treat places under $HOME as system directories when they are found via $XDG_DATA_DIRS
+std::vector<std::pair<Glib::ustring, bool> > ColorProfile::getBaseProfileDirs() {
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
static bool warnSet = false;
if (!warnSet) {
@@ -715,17 +724,17 @@ std::vector<Glib::ustring> ColorProfile::getBaseProfileDirs() {
warnSet = true;
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
- std::vector<Glib::ustring> sources;
+ std::vector<std::pair<Glib::ustring, bool> > sources;
// first try user's local dir
gchar* path = g_build_filename(g_get_user_data_dir(), "color", "icc", NULL);
- sources.push_back(path);
+ sources.push_back(std::make_pair(path, true));
g_free(path);
const gchar* const * dataDirs = g_get_system_data_dirs();
for ( int i = 0; dataDirs[i]; i++ ) {
gchar* path = g_build_filename(dataDirs[i], "color", "icc", NULL);
- sources.push_back(path);
+ sources.push_back(std::make_pair(path, false));
g_free(path);
}
@@ -737,14 +746,14 @@ std::vector<Glib::ustring> ColorProfile::getBaseProfileDirs() {
possible.push_back("/Library/ColorSync/Profiles");
for ( std::vector<Glib::ustring>::const_iterator it = possible.begin(); it != possible.end(); ++it ) {
if ( g_file_test(it->c_str(), G_FILE_TEST_EXISTS) && g_file_test(it->c_str(), G_FILE_TEST_IS_DIR) ) {
- sources.push_back(it->c_str());
+ sources.push_back(std::make_pair(it->c_str(), false));
onOSX = true;
}
}
if ( onOSX ) {
gchar* path = g_build_filename(g_get_home_dir(), "Library", "ColorSync", "Profiles", NULL);
if ( g_file_test(path, G_FILE_TEST_EXISTS) && g_file_test(path, G_FILE_TEST_IS_DIR) ) {
- sources.push_back(path);
+ sources.push_back(std::make_pair(path, true));
}
g_free(path);
}
@@ -760,12 +769,17 @@ std::vector<Glib::ustring> ColorProfile::getBaseProfileDirs() {
if ( !g_utf8_validate(utf8Path, -1, NULL) ) {
g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" );
} else {
- sources.push_back(utf8Path);
+ sources.push_back(std::make_pair(utf8Path, false));
}
g_free( utf8Path );
}
#endif // WIN32
+ std::sort(sources.begin(), sources.end(), compareProfileBoolPair);
+ std::vector<std::pair<Glib::ustring, bool> >::iterator last = std::unique(sources.begin(), sources.end());
+ sources.erase(last, sources.end());
+
+
return sources;
}
@@ -808,28 +822,28 @@ static bool isIccFile( gchar const *filepath )
return isIccFile;
}
-std::vector<Glib::ustring> ColorProfile::getProfileFiles()
+std::vector<std::pair<Glib::ustring, bool> > ColorProfile::getProfileFiles()
{
- std::vector<Glib::ustring> files;
+ std::vector<std::pair<Glib::ustring, bool> > files;
- std::list<Glib::ustring> sources;
+ std::list<std::pair<Glib::ustring, bool> > sources;
{
- std::vector<Glib::ustring> tmp = ColorProfile::getBaseProfileDirs();
+ std::vector<std::pair<Glib::ustring, bool> > tmp = ColorProfile::getBaseProfileDirs();
sources.insert(sources.begin(), tmp.begin(), tmp.end());
}
- for ( std::list<Glib::ustring>::const_iterator it = sources.begin(); it != sources.end(); ++it ) {
- if ( g_file_test( it->c_str(), G_FILE_TEST_EXISTS ) && g_file_test( it->c_str(), G_FILE_TEST_IS_DIR ) ) {
+ for ( std::list<std::pair<Glib::ustring, bool> >::const_iterator it = sources.begin(); it != sources.end(); ++it ) {
+ if ( g_file_test( it->first.c_str(), G_FILE_TEST_EXISTS ) && g_file_test( it->first.c_str(), G_FILE_TEST_IS_DIR ) ) {
GError *err = 0;
- GDir *dir = g_dir_open(it->c_str(), 0, &err);
+ GDir *dir = g_dir_open(it->first.c_str(), 0, &err);
if (dir) {
for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) {
- gchar *filepath = g_build_filename(it->c_str(), file, NULL);
+ gchar *filepath = g_build_filename(it->first.c_str(), file, NULL);
if ( g_file_test( filepath, G_FILE_TEST_IS_DIR ) ) {
- sources.push_back( filepath );
+ sources.push_back( std::make_pair(filepath, it->second) );
} else {
if ( isIccFile( filepath ) ) {
- files.push_back( filepath );
+ files.push_back( std::make_pair(filepath, it->second) );
}
}
@@ -838,31 +852,44 @@ std::vector<Glib::ustring> ColorProfile::getProfileFiles()
g_dir_close(dir);
dir = 0;
} else {
- gchar *safeDir = Inkscape::IO::sanitizeString(it->c_str());
+ gchar *safeDir = Inkscape::IO::sanitizeString(it->first.c_str());
g_warning(_("Color profiles directory (%s) is unavailable."), safeDir);
g_free(safeDir);
}
}
}
+ std::sort(files.begin(), files.end(), compareProfileBoolPair);
+ std::vector<std::pair<Glib::ustring, bool> >::iterator last = std::unique(files.begin(), files.end());
+ files.erase(last, files.end());
+
return files;
}
-std::vector<std::pair<Glib::ustring, Glib::ustring> > ColorProfile::getProfileFilesWithNames()
+bool compareProfilePairByName(const std::pair<std::pair<Glib::ustring, bool>, Glib::ustring> & a,
+ const std::pair<std::pair<Glib::ustring, bool>, Glib::ustring> & b)
{
- std::vector<std::pair<Glib::ustring, Glib::ustring> > result;
+ if (a.first.second != b.first.second) return a.first.second;
+ return a.second < b.second;
+}
+
+std::vector<std::pair<std::pair<Glib::ustring, bool>, Glib::ustring> > ColorProfile::getProfileFilesWithNames()
+{
+ std::vector<std::pair<std::pair<Glib::ustring, bool>, Glib::ustring> > result;
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
- std::vector<Glib::ustring> files = getProfileFiles();
- for ( std::vector<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) {
- cmsHPROFILE hProfile = cmsOpenProfileFromFile(it->c_str(), "r");
+ std::vector<std::pair<Glib::ustring, bool> > files = getProfileFiles();
+ for ( std::vector<std::pair<Glib::ustring, bool> >::const_iterator it = files.begin(); it != files.end(); ++it ) {
+ cmsHPROFILE hProfile = cmsOpenProfileFromFile(it->first.c_str(), "r");
if ( hProfile ) {
Glib::ustring name = getNameFromProfile(hProfile);
result.push_back( std::make_pair(*it, name) );
cmsCloseProfile(hProfile);
}
}
- std::sort(result.begin(), result.end());
+
+ std::sort(result.begin(), result.end(), compareProfilePairByName);
+
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
return result;
@@ -942,12 +969,12 @@ void loadProfiles()
static bool profiles_searched = false;
if ( !profiles_searched ) {
knownProfiles.clear();
- std::vector<Glib::ustring> files = ColorProfile::getProfileFiles();
+ std::vector<std::pair<Glib::ustring, bool> > files = ColorProfile::getProfileFiles();
- for ( std::vector<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) {
- cmsHPROFILE prof = cmsOpenProfileFromFile( it->c_str(), "r" );
+ for ( std::vector<std::pair<Glib::ustring, bool> >::const_iterator it = files.begin(); it != files.end(); ++it ) {
+ cmsHPROFILE prof = cmsOpenProfileFromFile( it->first.c_str(), "r" );
if ( prof ) {
- ProfileInfo info( prof, Glib::filename_to_utf8( it->c_str() ) );
+ ProfileInfo info( prof, Glib::filename_to_utf8( it->first.c_str() ) );
cmsCloseProfile( prof );
prof = 0;
diff --git a/src/color-profile.h b/src/color-profile.h
index cb6b25945..fed8c8c13 100644
--- a/src/color-profile.h
+++ b/src/color-profile.h
@@ -33,9 +33,9 @@ public:
friend cmsHPROFILE colorprofile_get_handle( SPDocument*, unsigned int*, char const* );
friend class CMSSystem;
- static std::vector<Glib::ustring> getBaseProfileDirs();
- static std::vector<Glib::ustring> getProfileFiles();
- static std::vector<std::pair<Glib::ustring, Glib::ustring> > getProfileFilesWithNames();
+ static std::vector<std::pair<Glib::ustring, bool> > getBaseProfileDirs();
+ static std::vector<std::pair<Glib::ustring, bool> > getProfileFiles();
+ static std::vector<std::pair<std::pair<Glib::ustring, bool>, Glib::ustring> > getProfileFilesWithNames();
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
//icColorSpaceSignature getColorSpace() const;
ColorSpaceSig getColorSpace() const;
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 12eaba72a..589973162 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -283,7 +283,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con
} else {
#if WITH_GTKMM_3_0
arr[i+1]->set_hexpand();
-
+
if (yoptions & Gtk::EXPAND)
arr[i+1]->set_vexpand();
else
@@ -428,13 +428,30 @@ void DocumentProperties::build_snap()
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/// Populates the available color profiles combo box
void DocumentProperties::populate_available_profiles(){
- _combo_avail.remove_all(); // Clear any existing items in the combo box
+ _AvailableProfilesListStore->clear(); // Clear any existing items in the combo box
// Iterate through the list of profiles and add the name to the combo box.
- std::vector<std::pair<Glib::ustring, Glib::ustring> > pairs = ColorProfile::getProfileFilesWithNames();
- for ( std::vector<std::pair<Glib::ustring, Glib::ustring> >::const_iterator it = pairs.begin(); it != pairs.end(); ++it ) {
+ std::vector<std::pair<std::pair<Glib::ustring, bool>, Glib::ustring> > pairs = ColorProfile::getProfileFilesWithNames();
+ bool home = true; // initial value doesn't matter, it's just to avoid a compiler warning
+ for ( std::vector<std::pair<std::pair<Glib::ustring, bool>, Glib::ustring> >::const_iterator it = pairs.begin(); it != pairs.end(); ++it ) {
+ Gtk::TreeModel::Row row;
+ Glib::ustring file = it->first.first;
Glib::ustring name = it->second;
- _combo_avail.append(name);
+
+ // add a separator between profiles from the user's home directory and system profiles
+ if (it != pairs.begin() && it->first.second != home)
+ {
+ row = *(_AvailableProfilesListStore->append());
+ row[_AvailableProfilesListColumns.fileColumn] = "<separator>";
+ row[_AvailableProfilesListColumns.nameColumn] = "<separator>";
+ row[_AvailableProfilesListColumns.separatorColumn] = true;
+ }
+ home = it->first.second;
+
+ row = *(_AvailableProfilesListStore->append());
+ row[_AvailableProfilesListColumns.fileColumn] = file;
+ row[_AvailableProfilesListColumns.nameColumn] = name;
+ row[_AvailableProfilesListColumns.separatorColumn] = false;
}
}
@@ -442,7 +459,7 @@ void DocumentProperties::populate_available_profiles(){
* Cleans up name to remove disallowed characters.
* Some discussion at http://markmail.org/message/bhfvdfptt25kgtmj
* Allowed ASCII first characters: ':', 'A'-'Z', '_', 'a'-'z'
- * Allowed ASCII remaining chars add: '-', '.', '0'-'9',
+ * Allowed ASCII remaining chars add: '-', '.', '0'-'9',
*
* @param str the string to clean up.
*/
@@ -474,24 +491,23 @@ static void sanitizeName( Glib::ustring& str )
/// Links the selected color profile in the combo box to the document
void DocumentProperties::linkSelectedProfile()
{
-//store this profile in the SVG document (create <color-profile> element in the XML)
+ //store this profile in the SVG document (create <color-profile> element in the XML)
// TODO remove use of 'active' desktop
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (!desktop){
g_warning("No active desktop");
} else {
- // Find the index of the currently-selected row in the color profiles combobox
- int row = _combo_avail.get_active_row_number();
+ // Find the index of the currently-selected row in the color profiles combobox
+ Gtk::TreeModel::iterator iter = _AvailableProfilesList.get_active();
- if (row == -1){
+ if (!iter) {
g_warning("No color profile available.");
return;
}
- // Read the filename and description from the list of available profiles
- std::vector<std::pair<Glib::ustring, Glib::ustring> > pairs = ColorProfile::getProfileFilesWithNames();
- Glib::ustring file = pairs[row].first;
- Glib::ustring name = pairs[row].second;
+ // Read the filename and description from the list of available profiles
+ Glib::ustring file = (*iter)[_AvailableProfilesListColumns.fileColumn];
+ Glib::ustring name = (*iter)[_AvailableProfilesListColumns.nameColumn];
std::vector<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" );
for (std::vector<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
SPObject* obj = *it;
@@ -511,7 +527,7 @@ void DocumentProperties::linkSelectedProfile()
// Checks whether there is a defs element. Creates it when needed
Inkscape::XML::Node *defsRepr = sp_repr_lookup_name(xml_doc, "svg:defs");
- if (!defsRepr){
+ if (!defsRepr) {
defsRepr = xml_doc->createElement("svg:defs");
xml_doc->root()->addChild(defsRepr, NULL);
}
@@ -529,6 +545,20 @@ void DocumentProperties::linkSelectedProfile()
}
}
+struct _cmp {
+ bool operator()(const SPObject * const & a, const SPObject * const & b)
+ {
+ const Inkscape::ColorProfile &a_prof = reinterpret_cast<const Inkscape::ColorProfile &>(*a);
+ const Inkscape::ColorProfile &b_prof = reinterpret_cast<const Inkscape::ColorProfile &>(*b);
+ gchar *a_name_casefold = g_utf8_casefold(a_prof.name, -1 );
+ gchar *b_name_casefold = g_utf8_casefold(b_prof.name, -1 );
+ int result = g_strcmp0(a_name_casefold, b_name_casefold);
+ g_free(a_name_casefold);
+ g_free(b_name_casefold);
+ return result < 0;
+ }
+};
+
void DocumentProperties::populate_linked_profiles_box()
{
_LinkedProfilesListStore->clear();
@@ -536,7 +566,8 @@ void DocumentProperties::populate_linked_profiles_box()
if (! current.empty()) {
_emb_profiles_observer.set((*(current.begin()))->parent);
}
- for (std::vector<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ std::set<SPObject *, _cmp> _current (current.begin(), current.end());
+ for (std::set<SPObject *, _cmp>::const_iterator it = _current.begin(); it != _current.end(); ++it) {
SPObject* obj = *it;
Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj);
Gtk::TreeModel::Row row = *(_LinkedProfilesListStore->append());
@@ -629,6 +660,12 @@ void DocumentProperties::removeSelectedProfile(){
onColorProfileSelectRow();
}
+bool DocumentProperties::_AvailableProfilesList_separator(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::iterator& iter)
+{
+ bool separator = (*iter)[_AvailableProfilesListColumns.separatorColumn];
+ return separator;
+}
+
void DocumentProperties::build_cms()
{
_page_cms->show();
@@ -694,9 +731,9 @@ void DocumentProperties::build_cms()
row++;
#if WITH_GTKMM_3_0
- _combo_avail.set_hexpand();
- _combo_avail.set_valign(Gtk::ALIGN_CENTER);
- _page_cms->table().attach(_combo_avail, 0, row, 1, 1);
+ _AvailableProfilesList.set_hexpand();
+ _AvailableProfilesList.set_valign(Gtk::ALIGN_CENTER);
+ _page_cms->table().attach(_AvailableProfilesList, 0, row, 1, 1);
_link_btn.set_halign(Gtk::ALIGN_CENTER);
_link_btn.set_valign(Gtk::ALIGN_CENTER);
@@ -708,11 +745,17 @@ void DocumentProperties::build_cms()
_unlink_btn.set_valign(Gtk::ALIGN_CENTER);
_page_cms->table().attach(_unlink_btn, 2, row, 1, 1);
#else
- _page_cms->table().attach(_combo_avail, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
+ _page_cms->table().attach(_AvailableProfilesList, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
_page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0);
_page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0);
#endif
+ // Set up the Avialable Profiles combo box
+ _AvailableProfilesListStore = Gtk::ListStore::create(_AvailableProfilesListColumns);
+ _AvailableProfilesList.set_model(_AvailableProfilesListStore);
+ _AvailableProfilesList.pack_start(_AvailableProfilesListColumns.nameColumn);
+ _AvailableProfilesList.set_row_separator_func(sigc::mem_fun(*this, &DocumentProperties::_AvailableProfilesList_separator));
+
populate_available_profiles();
//# Set up the Linked Profiles combo box
@@ -1693,7 +1736,7 @@ void DocumentProperties::onDocUnitChange()
// Disable changing of SVG Units. The intent here is to change the units in the UI, not the units in SVG.
// This code should be moved (and fixed) once we have an "SVG Units" setting that sets what units are used in SVG data.
-#if 0
+#if 0
// Set viewBox
if (doc->getRoot()->viewBox_set) {
gdouble scale = Inkscape::Util::Quantity::convert(1, old_doc_unit, doc_unit);
@@ -1703,12 +1746,12 @@ void DocumentProperties::onDocUnitChange()
Inkscape::Util::Quantity height = doc->getHeight();
doc->setViewBox(Geom::Rect::from_xywh(0, 0, width.value(doc_unit), height.value(doc_unit)));
}
-
+
// TODO: Fix bug in nodes tool instead of switching away from it
if (tools_active(getDesktop()) == TOOLS_NODES) {
tools_switch(getDesktop(), TOOLS_SELECT);
}
-
+
// Scale and translate objects
// set transform options to scale all things with the transform, so all things scale properly after the viewbox change.
/// \todo this "low-level" code of changing viewbox/unit should be moved somewhere else
@@ -1748,7 +1791,7 @@ void DocumentProperties::onDocUnitChange()
#endif
doc->setModifiedSinceSave();
-
+
DocumentUndo::done(doc, SP_VERB_NONE, _("Changed default display unit"));
}
diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h
index 7340b67f5..7f91d9ea0 100644
--- a/src/ui/dialog/document-properties.h
+++ b/src/ui/dialog/document-properties.h
@@ -139,14 +139,26 @@ protected:
UI::Widget::RegisteredCheckButton _rcb_perp;
UI::Widget::RegisteredCheckButton _rcb_tang;
//---------------------------------------------------------------
- Gtk::ComboBoxText _combo_avail;
Gtk::Button _link_btn;
Gtk::Button _unlink_btn;
+ class AvailableProfilesColumns : public Gtk::TreeModel::ColumnRecord
+ {
+ public:
+ AvailableProfilesColumns()
+ { add(fileColumn); add(nameColumn); add(separatorColumn); }
+ Gtk::TreeModelColumn<Glib::ustring> fileColumn;
+ Gtk::TreeModelColumn<Glib::ustring> nameColumn;
+ Gtk::TreeModelColumn<bool> separatorColumn;
+ };
+ AvailableProfilesColumns _AvailableProfilesListColumns;
+ Glib::RefPtr<Gtk::ListStore> _AvailableProfilesListStore;
+ Gtk::ComboBox _AvailableProfilesList;
+ bool _AvailableProfilesList_separator(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::iterator& iter);
class LinkedProfilesColumns : public Gtk::TreeModel::ColumnRecord
{
public:
LinkedProfilesColumns()
- { add(nameColumn); add(previewColumn); }
+ { add(nameColumn); add(previewColumn); }
Gtk::TreeModelColumn<Glib::ustring> nameColumn;
Gtk::TreeModelColumn<Glib::ustring> previewColumn;
};
@@ -218,7 +230,7 @@ private:
// callback methods for buttons on grids page.
void onNewGrid();
void onRemoveGrid();
-
+
// callback for document unit change
void onDocUnitChange();
};
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 30bbd95c9..6dd62d3bb 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -514,7 +514,7 @@ void InkscapePreferences::initPageTools()
this->AddPage(_page_dropper, _("Dropper"), iter_tools, PREFS_PAGE_TOOLS_DROPPER);
this->AddSelcueCheckbox(_page_dropper, "/tools/dropper", true);
this->AddGradientCheckbox(_page_dropper, "/tools/dropper", true);
-
+
//Connector
this->AddPage(_page_connector, _("Connector"), iter_tools, PREFS_PAGE_TOOLS_CONNECTOR);
this->AddSelcueCheckbox(_page_connector, "/tools/connector", true);
@@ -665,16 +665,16 @@ void InkscapePreferences::initPageUI()
_dockbar_style.init( "/options/dock/dockbarstyle", dockbarstyleLabels, dockbarstyleValues, G_N_ELEMENTS(dockbarstyleLabels), 0);
_page_ui.add_line(false, _("Dockbar style (requires restart):"), _dockbar_style, "",
_("Selects whether the vertical bars on the dockbar will show text labels, icons, or both"), false);
-
+
Glib::ustring switcherstyleLabels[] = {_("Text only"), _("Icons only"), _("Icons and text")}; /* see bug #1098437 */
int switcherstyleValues[] = {0, 1, 2};
-
+
/* switcher style */
_switcher_style.init( "/options/dock/switcherstyle", switcherstyleLabels, switcherstyleValues, G_N_ELEMENTS(switcherstyleLabels), 0);
_page_ui.add_line(false, _("Switcher style (requires restart):"), _switcher_style, "",
_("Selects whether the dockbar switcher will show text labels, icons, or both"), false);
}
-
+
// Windows
_win_save_geom.init ( _("Save and restore window geometry for each document"), "/options/savewindowgeometry/value", 1, true, 0);
_win_save_geom_prefs.init ( _("Remember and use last window's geometry"), "/options/savewindowgeometry/value", 2, false, &_win_save_geom);
@@ -689,7 +689,7 @@ void InkscapePreferences::initPageUI()
_win_native.init ( _("Native open/save dialogs"), "/options/desktopintegration/value", 1, true, 0);
_win_gtk.init ( _("GTK open/save dialogs"), "/options/desktopintegration/value", 0, false, &_win_native);
-
+
_win_hide_task.init ( _("Dialogs are hidden in taskbar"), "/options/dialogsskiptaskbar/value", true);
_win_save_viewport.init ( _("Save and restore documents viewport"), "/options/savedocviewport/value", true);
_win_zoom_resize.init ( _("Zoom when window is resized"), "/options/stickyzoom/value", false);
@@ -1005,9 +1005,9 @@ void InkscapePreferences::initPageIO()
_page_cms.add_group_header( _("Display adjustment"));
Glib::ustring tmpStr;
- std::vector<Glib::ustring> sources = ColorProfile::getBaseProfileDirs();
- for ( std::vector<Glib::ustring>::const_iterator it = sources.begin(); it != sources.end(); ++it ) {
- gchar* part = g_strdup_printf( "\n%s", it->c_str() );
+ std::vector<std::pair<Glib::ustring, bool> > sources = ColorProfile::getBaseProfileDirs();
+ for ( std::vector<std::pair<Glib::ustring, bool> >::const_iterator it = sources.begin(); it != sources.end(); ++it ) {
+ gchar* part = g_strdup_printf( "\n%s", it->first.c_str() );
tmpStr += part;
g_free(part);
}
@@ -1377,28 +1377,28 @@ void InkscapePreferences::initPageBehavior()
_mask_mask_remove.init ( _("Remove clippath/mask object after applying"), "/options/maskobject/remove", true);
_page_mask.add_line(false, "", _mask_mask_remove, "",
_("After applying, remove the object used as the clipping path or mask from the drawing"));
-
+
_page_mask.add_group_header( _("Before applying"));
-
+
_mask_grouping_none.init( _("Do not group clipped/masked objects"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_NONE, true, 0);
_mask_grouping_separate.init( _("Put every clipped/masked object in its own group"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_SEPARATE, false, &_mask_grouping_none);
_mask_grouping_all.init( _("Put all clipped/masked objects into one group"), "/options/maskobject/grouping", PREFS_MASKOBJECT_GROUPING_ALL, false, &_mask_grouping_none);
-
+
_page_mask.add_line(true, "", _mask_grouping_none, "",
_("Apply clippath/mask to every object"));
-
+
_page_mask.add_line(true, "", _mask_grouping_separate, "",
_("Apply clippath/mask to groups containing single object"));
-
+
_page_mask.add_line(true, "", _mask_grouping_all, "",
_("Apply clippath/mask to group containing all objects"));
-
+
_page_mask.add_group_header( _("After releasing"));
-
+
_mask_ungrouping.init ( _("Ungroup automatically created groups"), "/options/maskobject/ungrouping", true);
_page_mask.add_line(true, "", _mask_ungrouping, "",
_("Ungroup groups created when setting clip/mask"));
-
+
this->AddPage(_page_mask, _("Clippaths and masks"), iter_behavior, PREFS_PAGE_BEHAVIOR_MASKS);
@@ -1411,8 +1411,8 @@ void InkscapePreferences::initPageBehavior()
_("Update marker color when object color changes"));
this->AddPage(_page_markers, _("Markers"), iter_behavior, PREFS_PAGE_BEHAVIOR_MARKERS);
-
-
+
+
_page_cleanup.add_group_header( _("Document cleanup"));
_cleanup_swatches.init ( _("Remove unused swatches when doing a document cleanup"), "/options/cleanupswatches/value", false); // text label
_page_cleanup.add_line( true, "", _cleanup_swatches, "",
@@ -1896,15 +1896,15 @@ void InkscapePreferences::initPageSpellcheck()
/* the returned pointer should _not_ need to be deleted */
AspellDictInfoList *dlist = get_aspell_dict_info_list(config);
-
+
/* config is no longer needed */
delete_aspell_config(config);
-
+
AspellDictInfoEnumeration *dels = aspell_dict_info_list_elements(dlist);
-
+
languages.push_back(Glib::ustring(C_("Spellchecker language", "None")));
langValues.push_back(Glib::ustring(""));
-
+
const AspellDictInfo *entry;
int en_index = 0;
int i = 0;
diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp
index 2e30a48b5..b422892fe 100644
--- a/src/ui/widget/color-icc-selector.cpp
+++ b/src/ui/widget/color-icc-selector.cpp
@@ -671,6 +671,20 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name)
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
+struct _cmp {
+ bool operator()(const SPObject * const & a, const SPObject * const & b)
+ {
+ const Inkscape::ColorProfile &a_prof = reinterpret_cast<const Inkscape::ColorProfile &>(*a);
+ const Inkscape::ColorProfile &b_prof = reinterpret_cast<const Inkscape::ColorProfile &>(*b);
+ gchar *a_name_casefold = g_utf8_casefold(a_prof.name, -1 );
+ gchar *b_name_casefold = g_utf8_casefold(b_prof.name, -1 );
+ int result = g_strcmp0(a_name_casefold, b_name_casefold);
+ g_free(a_name_casefold);
+ g_free(b_name_casefold);
+ return result < 0;
+ }
+};
+
void ColorICCSelectorImpl::_profilesChanged(std::string const &name)
{
GtkComboBox *combo = GTK_COMBO_BOX(_profileSel);
@@ -688,7 +702,8 @@ void ColorICCSelectorImpl::_profilesChanged(std::string const &name)
int index = 1;
std::vector<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList("iccprofile");
- for (std::vector<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
+ std::set<SPObject *, _cmp> _current(current.begin(), current.end());
+ for (std::set<SPObject *, _cmp>::const_iterator it = _current.begin(); it != _current.end(); ++it) {
SPObject *obj = *it;
Inkscape::ColorProfile *prof = reinterpret_cast<Inkscape::ColorProfile *>(obj);