summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jabier.arraiza@marker.es>2019-06-18 19:18:20 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-07-08 21:01:34 +0000
commit6a7e32e1b6bea253f6484136beaf21c3df0de535 (patch)
tree3c95f52c150518add2b9e5d2a1d786e78b40f19d /src
parentDisplay spiro pen preview right after backspace (diff)
downloadinkscape-6a7e32e1b6bea253f6484136beaf21c3df0de535.tar.gz
inkscape-6a7e32e1b6bea253f6484136beaf21c3df0de535.zip
Initial code to fix
Diffstat (limited to 'src')
-rw-r--r--src/inkscape.cpp94
-rw-r--r--src/inkscape.h3
-rw-r--r--src/io/resource.cpp2
-rw-r--r--src/io/resource.h2
-rw-r--r--src/ui/dialog/dialog-manager.cpp1
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp133
-rw-r--r--src/ui/dialog/inkscape-preferences.h6
-rw-r--r--src/ui/icon-loader.cpp14
-rw-r--r--src/ui/widget/color-picker.cpp12
-rw-r--r--src/ui/widget/color-picker.h12
10 files changed, 224 insertions, 55 deletions
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index 4cf8aae8e..65ef01b0d 100644
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
@@ -65,6 +65,8 @@
/* Backbones of configuration xml data */
#include "menus-skeleton.h"
+#include <fstream>
+
// Inkscape::Application static members
Inkscape::Application * Inkscape::Application::_S_inst = nullptr;
bool Inkscape::Application::_crashIsHappening = false;
@@ -363,6 +365,69 @@ void Application::autosave_init()
}
}
+void
+Application::set_higlightcolors(gchar *&colornamedsuccess, gchar *&colornamedwarning, *&gchar colornamederror)
+{
+ int colorsetsuccess = 0x4AD589ff;
+ int colorsetwarning = 0xF57900ff;
+ int colorseterror = 0xcc0000ff;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Glib::ustring themeiconname = prefs->getString("/theme/iconTheme");
+ Glib::ustring higlight = get_filename(ICONS, Glib::ustring(themeiconname + "/higlights.css").c_str(), false, false);
+ if (!higlight.empty()) {
+ std::ifstream ifs(higlight);
+ std::string content( (std::istreambuf_iterator<char>(ifs) ),
+ (std::istreambuf_iterator<char>() ) );
+ Glib::ustring result;
+ size_t startpos = content.find(".success");
+ size_t endpos = content.find("}");
+ if (startpos != std::string::npos) {
+ result = content.substr(startpos, endpos - startpos);
+ startpos = content.find("fill:");
+ endpos = content.find(";");
+ result = content.substr(startpos + 4, endpos - 1 - startpos + 4);
+ Gdk::RGBA success_color = Gdk::RGBA(result);
+ SPColor success_color_sp(success_color.get_red(),
+ success_color.get_green(),
+ success_color.get_blue());
+ colorsetsuccess = success_color_sp.toRGBA32(1);
+ }
+ startpos = content.find(".warning");
+ endpos = content.find("}");
+ if (startpos != std::string::npos) {
+ result = content.substr(startpos, endpos - startpos);
+ startpos = content.find("fill:");
+ endpos = content.find(";");
+ result = content.substr(startpos + 4, endpos - 1 - startpos + 4);
+ Gdk::RGBA warning_color = Gdk::RGBA(result);
+ SPColor warning_color_sp(warning_color.get_red(),
+ warning_color.get_green(),
+ warning_color.get_blue());
+ colorsetwarning = warning_color_sp.toRGBA32(1);
+ }
+ startpos = content.find(".error");
+ endpos = content.find("}");
+ if (startpos != std::string::npos) {
+ result = content.substr(startpos, endpos - startpos);
+ startpos = content.find("fill:");
+ endpos = content.find(";");
+ result = content.substr(startpos + 4, endpos - 1 - startpos + 4);
+ Gdk::RGBA error_color = Gdk::RGBA(result);
+ SPColor error_color_sp(error_color.get_red(),
+ error_color.get_green(),
+ error_color.get_blue());
+ colorseterror = error_color_sp.toRGBA32(1);
+ }
+ }
+ colorsetsuccess = prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", colorsetsuccess);
+ sp_svg_write_color(colornamedsuccess, sizeof(colornamedsuccess), colorsetsuccess);
+ colorsetwarning = prefs->getInt("/theme/" + themeiconname + "/symbolicWarningColor", colorsetwarning);
+ sp_svg_write_color(colornamedwarning, sizeof(colornamedwarning), colorsetwarning);
+ colorseterror = prefs->getInt("/theme/" + themeiconname + "/symbolicErrorColor", colorseterror);
+ sp_svg_write_color(colornamederror, sizeof(colornamederror), colorseterror);
+ // Use in case the special widgets have inverse theme background and symbolic
+}
+
/**
* \brief Add our CSS style sheets
*/
@@ -376,6 +441,7 @@ Application::add_gtk_css()
const gchar *gtk_font_name = "";
const gchar *gtkThemeName;
const gchar *gtkIconThemeName;
+ Glib::ustring themeiconname;
gboolean gtkApplicationPreferDarkTheme;
GtkSettings *settings = gtk_settings_get_default();
if (settings) {
@@ -392,7 +458,7 @@ Application::add_gtk_css()
} else {
prefs->setString("/theme/gtkTheme", Glib::ustring(gtkThemeName));
}
- Glib::ustring themeiconname = prefs->getString("/theme/iconTheme");
+ themeiconname = prefs->getString("/theme/iconTheme");
if (themeiconname != "") {
g_object_set(settings, "gtk-icon-theme-name", themeiconname.c_str(), NULL);
} else {
@@ -401,17 +467,18 @@ Application::add_gtk_css()
g_object_get(settings, "gtk-font-name", &gtk_font_name, NULL);
}
- auto provider = Gtk::CssProvider::create();
+
Glib::ustring style = get_filename(UIS, "style.css");
if (!style.empty()) {
- try {
- provider->load_from_path (style);
- } catch (const Gtk::CssProviderError& ex)
- {
- g_critical("CSSProviderError::load_from_path(): failed to load '%s'\n(%s)",
- style.c_str(), ex.what().c_str());
- }
- Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ auto provider = Gtk::CssProvider::create();
+ try {
+ provider->load_from_path (style);
+ } catch (const Gtk::CssProviderError& ex)
+ {
+ g_critical("CSSProviderError::load_from_path(): failed to load '%s'\n(%s)",
+ style.c_str(), ex.what().c_str());
+ }
+ Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
if (!colorizeprovider) {
colorizeprovider = Gtk::CssProvider::create();
@@ -421,7 +488,9 @@ Application::add_gtk_css()
if (!prefs->getBool("/theme/symbolicIconsDefaultColor", true)) {
gchar colornamed[64];
gchar colornamed_inverse[64];
- int colorset = prefs->getInt("/theme/symbolicColor", 0x2E3436ff);
+ set_higlightcolors(colornamedsuccess, colornamedwarning, colornamederror);
+ int colorset = 0x2E3436ff;
+ colorset = prefs->getInt("/theme/" + themeiconname + "/symbolicColor", colorset);
sp_svg_write_color(colornamed, sizeof(colornamed), colorset);
// Use in case the special widgets have inverse theme background and symbolic
int colorset_inverse = colorset ^ 0xffffff00;
@@ -445,8 +514,9 @@ Application::add_gtk_css()
g_critical("CSSProviderError::load_from_data(): failed to load '%s'\n(%s)", css_str.c_str(), ex.what().c_str());
}
Gtk::StyleContext::add_provider_for_screen(screen, colorizeprovider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
if (!strncmp(gtk_font_name, "Cantarell", 9)) {
- provider = Gtk::CssProvider::create();
+ auto provider = Gtk::CssProvider::create();
css_str = "#monoStrokeWidth,";
css_str += "#fillEmptySpace,";
css_str += "#SelectStatus,";
diff --git a/src/inkscape.h b/src/inkscape.h
index a673f0d49..583f8a599 100644
--- a/src/inkscape.h
+++ b/src/inkscape.h
@@ -139,7 +139,7 @@ public:
void selection_changed (Inkscape::Selection * selection);
void subselection_changed (SPDesktop *desktop);
void selection_set (Inkscape::Selection * selection);
-
+ void set_higlightcolors(gchar *&colornamedsuccess, gchar *&colornamedwarning, gchar *&colornamederror);
void eventcontext_set (Inkscape::UI::Tools::ToolBase * eventcontext);
// Moved document add/remove functions into public inkscape.h as they are used
@@ -179,7 +179,6 @@ public:
sigc::signal<void, SPDesktop *> signal_deactivate_desktop;
// user change theme
sigc::signal<void> signal_change_theme;
-
// these are orphaned signals (nothing emits them and nothing connects to them)
sigc::signal<void, SPDocument *> signal_destroy_document;
sigc::signal<void, SPColor *, double /*opacity*/> signal_color_set;
diff --git a/src/io/resource.cpp b/src/io/resource.cpp
index 5a15b02f3..e65bfce1c 100644
--- a/src/io/resource.cpp
+++ b/src/io/resource.cpp
@@ -141,7 +141,7 @@ Glib::ustring get_path_ustring(Domain domain, Type type, char const *filename)
* localized - Prefer a localized version of the file, i.e. default.de.svg instead of default.svg.
* (will use gettext to determine the preferred language of the user)
*/
-Glib::ustring get_filename(Type type, char const *filename, bool localized)
+Glib::ustring get_filename(Type type, char const *filename, bool localized, bool silent)
{
Glib::ustring result;
diff --git a/src/io/resource.h b/src/io/resource.h
index b1b78dbcc..e2f15c142 100644
--- a/src/io/resource.h
+++ b/src/io/resource.h
@@ -59,7 +59,7 @@ Util::ptr_shared get_path(Domain domain, Type type,
Glib::ustring get_path_ustring(Domain domain, Type type,
char const *filename=nullptr);
-Glib::ustring get_filename(Type type, char const *filename, bool localized = false);
+Glib::ustring get_filename(Type type, char const *filename, bool localized = false, bool silent = false);
Glib::ustring get_filename(Glib::ustring path, Glib::ustring filename);
std::vector<Glib::ustring> get_filenames(Type type,
diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp
index 66a682de6..5bb0575c0 100644
--- a/src/ui/dialog/dialog-manager.cpp
+++ b/src/ui/dialog/dialog-manager.cpp
@@ -34,6 +34,7 @@
#include "ui/dialog/prototype.h"
#include "ui/dialog/symbols.h"
#include "ui/dialog/tile.h"
+#include "style.h"
#if HAVE_POTRACE
# include "ui/dialog/tracedialog.h"
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 16bfee0ba..f711db03e 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -61,6 +61,7 @@
#include "ui/interface.h"
#include "ui/widget/style-swatch.h"
#include "widgets/desktop-widget.h"
+#include <fstream>
#ifdef HAVE_ASPELL
# include <aspell.h>
@@ -628,16 +629,77 @@ void InkscapePreferences::symbolicThemeCheck()
}
}
-void InkscapePreferences::symbolicDefaultColor(){
+void InkscapePreferences::symbolicChangeCustom()
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ if (!prefs->getBool("/theme/symbolicIconsDefaultColor", true))
+ {
+ Gdk::RGBA normal_color =_symbolic_color.get_style_context()->get_color();
+ Gdk::RGBA success_color =_symbolic_success_color.get_style_context()->get_color();
+ Gdk::RGBA warning_color =_symbolic_warning_color.get_style_context()->get_color();
+ Gdk::RGBA error_color =_symbolic_error_color.get_style_context()->get_color();
+ SPColor normal_color_sp(normal_color.get_red(),
+ normal_color.get_green(),
+ normal_color.get_blue());
+ _symbolic_color.setRgba32(normal_color_sp.toRGBA32(normal_color.get_alpha()));
+ SPColor success_color_sp(success_color.get_red(),
+ success_color.get_green(),
+ success_color.get_blue());
+ _symbolic_success_color.setRgba32(success_color_sp.toRGBA32(success_color.get_alpha()));
+ SPColor warning_color_sp(warning_color.get_red(),
+ warning_color.get_green(),
+ warning_color.get_blue());
+ _symbolic_warning_color.setRgba32(warning_color_sp.toRGBA32(warning_color.get_alpha()));
+ SPColor error_color_sp(error_color.get_red(),
+ error_color.get_green(),
+ error_color.get_blue());
+ _symbolic_error_color.setRgba32(error_color_sp.toRGBA32(error_color.get_alpha()));
+ _symbolic_color.setSensitive(false);
+ _symbolic_success_color.setSensitive(false);
+ _symbolic_warning_color.setSensitive(false);
+ _symbolic_error_color.setSensitive(false);
+ symbolicDefaultColor();
+ } else if (prefs->getBool("/theme/symbolicIcons", true)){
+ _symbolic_color.setSensitive(true);
+ _symbolic_success_color.setSensitive(true);
+ _symbolic_warning_color.setSensitive(true);
+ _symbolic_error_color.setSensitive(true);
+ Glib::ustring themeiconname = prefs->getString("/theme/iconTheme");
+ int colorset = prefs->getInt("/theme/" + themeiconname + "/symbolicColor", 0x2E3436ff);
+ int colorsetsuccess = prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff);
+ int colorsetwarning = prefs->getInt("/theme/" + themeiconname + "/symbolicWarningColor", 0xF57900ff);
+ int colorseterror = prefs->getInt("/theme/" + themeiconname + "/symbolicErrorColor", 0xcc0000ff);
+ _symbolic_color.setRgba32(colorset);
+ _symbolic_success_color.setRgba32(colorsetsuccess);
+ _symbolic_warning_color.setRgba32(colorsetwarning);
+ _symbolic_error_color.setRgba32(colorseterror);
+ symbolicCustomColors();
+ } else {
+ _symbolic_color.setSensitive(false);
+ _symbolic_success_color.setSensitive(false);
+ _symbolic_warning_color.setSensitive(false);
+ _symbolic_error_color.setSensitive(false);
+ }
+}
+
+void InkscapePreferences::symbolicDefaultColor()
+{
auto const screen = Gdk::Screen::get_default();
if (INKSCAPE.colorizeprovider) {
Gtk::StyleContext::remove_provider_for_screen(screen, INKSCAPE.colorizeprovider);
}
+}
+void InkscapePreferences::symbolicCustomColorsReset() {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool("/theme/symbolicIconsDefaultColor", true);
+ Glib::ustring themeiconname = prefs->getString("/theme/iconTheme");
+ prefs->setInt("/theme/" + themeiconname + "/symbolicSuccessColor",0);
+ prefs->setInt("/theme/" + themeiconname + "/symbolicErrorColor", 0);
+ prefs->setInt("/theme/" + themeiconname + "/symbolicWaringColor", 0);
+ symbolicCustomColors();
}
-void InkscapePreferences::symbolicStyling()
+
+void InkscapePreferences::symbolicCustomColors()
{
auto const screen = Gdk::Screen::get_default();
if (INKSCAPE.colorizeprovider) {
@@ -645,14 +707,15 @@ void InkscapePreferences::symbolicStyling()
}
using namespace Inkscape::IO::Resource;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool("/theme/symbolicIconsDefaultColor", false);
Gtk::Window *window = SP_ACTIVE_DESKTOP->getToplevel();
Gtk::CssProvider::create();
Glib::ustring css_str = "";
if (prefs->getBool("/theme/symbolicIcons", false)) {
gchar colornamed[64];
gchar colornamed_inverse[64];
- int colorset = prefs->getInt("/theme/symbolicColor", 0x2E3436ff);
+ INKSCAPE.set_higlightcolors(colornamedsuccess, colornamedwarning, colornamederror);
+ int colorset = 0x2E3436ff;
+ colorset = prefs->getInt("/theme/" + themeiconname + "/symbolicColor", colorset);
sp_svg_write_color(colornamed, sizeof(colornamed), colorset);
// Use in case the special widgets have inverse theme background and symbolic
int colorset_inverse = colorset ^ 0xffffff00;
@@ -691,17 +754,16 @@ void InkscapePreferences::symbolicStyling()
void InkscapePreferences::themeChange()
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- g_object_set(gtk_settings_get_default(), "gtk-theme-name", prefs->getString("/theme/gtkTheme").c_str(), NULL);
- g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme",
- prefs->getBool("/theme/darkTheme", false), NULL);
+ bool darktheme = prefs->getBool("/theme/darkTheme", false);
+ Glib::ustring themename = prefs->getString("/theme/gtkTheme");
+ GtkSettings *settings = gtk_settings_get_default();
+ g_object_set(settings, "gtk-theme-name", themename.c_str(), NULL);
+ g_object_set(settings, "gtk-application-prefer-dark-theme", darktheme, NULL);
gchar *gtkThemeName;
gboolean gtkApplicationPreferDarkTheme;
Gtk::Window *window = SP_ACTIVE_DESKTOP->getToplevel();
- GtkSettings *settings = gtk_settings_get_default();
- if (window && settings) {
- g_object_get(settings, "gtk-theme-name", &gtkThemeName, NULL);
- g_object_get(settings, "gtk-application-prefer-dark-theme", &gtkApplicationPreferDarkTheme, NULL);
- bool dark = gtkApplicationPreferDarkTheme || Glib::ustring(gtkThemeName).find(":dark") != -1;
+ if (window) {
+ bool dark = darktheme || themename.find(":dark") != -1;
if (!dark) {
Glib::RefPtr<Gtk::StyleContext> stylecontext = window->get_style_context();
Gdk::RGBA rgba;
@@ -948,20 +1010,45 @@ void InkscapePreferences::initPageUI()
_page_theme.add_line(false, _("Change icon theme:"), _icon_theme, "", "", false);
_icon_theme.signal_changed().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicThemeCheck));
}
+ Glib::ustring themeiconname = prefs->getString("/theme/iconTheme");
_symbolic_icons.init(_("Use symbolic icons"), "/theme/symbolicIcons", true);
- _symbolic_icons.signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicStyling));
+ _symbolic_icons.signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicCustomColors));
_page_theme.add_line(true, "", _symbolic_icons, "", "", true);
- _symbolic_color.init(_("Color for symbolic icons:"), "/theme/symbolicColor", 0x2E3436ff);
- Gtk::Label *_symbolic_color_label = Gtk::manage(new Gtk::Label(_("Change colors:")));
- Gtk::Button *theme_decide_color = Gtk::manage(new Gtk::Button(_("Theme decides")));
- theme_decide_color->set_tooltip_text(_("Theme decide symbolic icon color)"));
- theme_decide_color->signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicDefaultColor));
+ _symbolic_colors.init(_("Use custom colors for icons"), "/theme/symbolicIconsDefaultColor", true);
+ _symbolic_colors.signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicChangeCustom));
+ _page_theme.add_line(true, "", _symbolic_colors, "", "", true);
+ _symbolic_color.init(_("Color for symbolic icons:"), "/theme/" + themeiconname + "/symbolicColor", 0x2E3436ff);
+ _symbolic_success_color.init(_("Color for symbolic success icons:"), "/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff);
+ _symbolic_warning_color.init(_("Color for symbolic warning icons:"), "/theme/" + themeiconname + "/symbolicWarningColor", 0xF57900ff);
+ _symbolic_error_color.init(_("Color for symbolic error icons:"), "/theme/" + themeiconname + "/symbolicErrorColor", 0xcc0000ff);
+ _symbolic_color.get_style_context()->add_class("system_normal_color");
+ _symbolic_success_color.get_style_context()->add_class("system_success_color");
+ _symbolic_warning_color.get_style_context()->add_class("system_warning_color");
+ _symbolic_error_color.get_style_context()->add_class("system_error_color");
+ _symbolic_color.connectChanged(sigc::mem_fun(this, &InkscapePreferences::symbolicChangeColor));
+ _symbolic_warning_color.connectChanged(sigc::mem_fun(this, &InkscapePreferences::symbolicChangeColor));
+ _symbolic_success_color.connectChanged(sigc::mem_fun(this, &InkscapePreferences::symbolicChangeColor));
+ _symbolic_error_color.connectChanged(sigc::mem_fun(this, &InkscapePreferences::symbolicChangeColor));
+ Glib::RefPtr<Gdk::Window> window = get_parent_window();
+ if (window) {
+ _symbolic_color.setTransientFor(window);
+ _symbolic_success_color.setTransientFor(window);
+ _symbolic_warning_color.setTransientFor(window);
+ _symbolic_error_color.setTransientFor(window);
+ }
Gtk::Box *icon_buttons = Gtk::manage(new Gtk::Box());
- icon_buttons->pack_start(*_symbolic_color_label, true, true, 4);
icon_buttons->pack_start(_symbolic_color, true, true, 4);
- icon_buttons->pack_start(*theme_decide_color, true, true, 4);
- _symbolic_color.connectChanged(sigc::mem_fun(this, &InkscapePreferences::changeIconsColor));
- _page_theme.add_line(false,"", *icon_buttons, "", _("Color for symbolic icons, theme based or custom. Some icon color changes need reload"), false );
+ _page_theme.add_line(false,_("Change icon color:"), *icon_buttons, "", _("Color for symbolic icons. Some icons changes need reload"), false);
+ Gtk::Box *icon_buttons_hight = Gtk::manage(new Gtk::Box());
+ icon_buttons_hight->pack_start(_symbolic_success_color, true, true, 4);
+ icon_buttons_hight->pack_start(_symbolic_warning_color, true, true, 4);
+ icon_buttons_hight->pack_start(_symbolic_error_color, true, true, 4);
+ _page_theme.add_line(false,_("Change icon highlights:"), *icon_buttons_hight, "", _("HSet the predefined colors fro the creator of icon set"), false);
+ Gtk::Button *theme_decide_color = Gtk::manage(new Gtk::Button(_("Theme defaults")));
+ theme_decide_color->set_tooltip_text(_("Defaul colors from theme)"));
+ theme_decide_color->signal_clicked().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicCustomColorsReset));
+ _page_theme.add_line(false,_("Defaul colors:"), *icon_buttons_hight, "", _("Set the predefined colors fro the creator of icon set"), false);
+ symbolicChangeCustom();
{
Glib::ustring sizeLabels[] = { C_("Icon size", "Larger"), C_("Icon size", "Large"), C_("Icon size", "Small"),
C_("Icon size", "Smaller") };
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 3e0134e4d..036d77215 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -245,6 +245,7 @@ protected:
UI::Widget::PrefCombo _icon_theme;
UI::Widget::PrefCheckButton _dark_theme;
UI::Widget::PrefCheckButton _symbolic_icons;
+ UI::Widget::PrefCheckButton _symbolic_colors;
UI::Widget::PrefColorPicker _symbolic_color;
UI::Widget::PrefCombo _misc_small_toolbar;
UI::Widget::PrefCombo _misc_small_secondary;
@@ -589,8 +590,11 @@ private:
void themeChange();
void changeIconsColor(guint32 /*color*/);
void symbolicThemeCheck();
- void symbolicStyling();
+ void symbolicCustomColors();
void symbolicDefaultColor();
+ void symbolicChangeCustom();
+ void symbolicCustomColorsReset();
+ void symbolicChangeColor(guint32 /*color*/){symbolicChangeCustom();}
InkscapePreferences();
InkscapePreferences(InkscapePreferences const &d);
diff --git a/src/ui/icon-loader.cpp b/src/ui/icon-loader.cpp
index 2e0e11333..f452b1771 100644
--- a/src/ui/icon-loader.cpp
+++ b/src/ui/icon-loader.cpp
@@ -15,6 +15,8 @@
#include "inkscape.h"
#include "svg/svg-color.h"
#include "widgets/toolbox.h"
+#include "io/resource.h"
+#include <fstream>
#include <gdkmm/display.h>
#include <gdkmm/screen.h>
#include <gtkmm/iconinfo.h>
@@ -66,19 +68,15 @@ Glib::RefPtr<Gdk::Pixbuf> sp_get_icon_pixbuf(Glib::ustring icon_name, gint size)
bool was_symbolic = false;
Glib::ustring css_str = "";
if (!prefs->getBool("/theme/symbolicIconsDefaultColor", true)) {
+ using namespace Inkscape::IO::Resource;
gchar colornamed[64];
gchar colornamedsuccess[64];
gchar colornamedwarning[64];
gchar colornamederror[64];
- gchar colornamed_inverse[64];
- int colorset = prefs->getInt("/theme/symbolicColor", 0x2E3436ff);
+ INKSCAPE.set_higlightcolors(colornamedsuccess, colornamedwarning, colornamederror);
+ int colorset = 0x2E3436ff;
+ colorset = prefs->getInt("/theme/" + themeiconname + "/symbolicColor", colorset);
sp_svg_write_color(colornamed, sizeof(colornamed), colorset);
- int colorsetsuccess = prefs->getInt("/theme/symbolicSuccessColor", 0x4AD589ff);
- sp_svg_write_color(colornamedsuccess, sizeof(colornamedsuccess), colorsetsuccess);
- int colorsetwarning = prefs->getInt("/theme/symbolicWarningColor", 0xF57900ff);
- sp_svg_write_color(colornamedwarning, sizeof(colornamedwarning), colorsetwarning);
- int colorseterror = prefs->getInt("/theme/symbolicErrorColor", 0xcc0000ff);
- sp_svg_write_color(colornamederror, sizeof(colornamederror), colorseterror);
_icon_pixbuf =
iconinfo.load_symbolic(Gdk::RGBA(colornamed), Gdk::RGBA(colornamedsuccess),
Gdk::RGBA(colornamedwarning), Gdk::RGBA(colornamederror), was_symbolic);
diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp
index ad74a10cc..b3b6db451 100644
--- a/src/ui/widget/color-picker.cpp
+++ b/src/ui/widget/color-picker.cpp
@@ -37,7 +37,6 @@ ColorPicker::ColorPicker (const Glib::ustring& title, const Glib::ustring& tip,
_preview.show();
add (_preview);
set_tooltip_text (tip);
-
_selected_color.signal_changed.connect(sigc::mem_fun(this, &ColorPicker::_onSelectedColorChanged));
_selected_color.signal_dragged.connect(sigc::mem_fun(this, &ColorPicker::_onSelectedColorChanged));
_selected_color.signal_released.connect(sigc::mem_fun(this, &ColorPicker::_onSelectedColorChanged));
@@ -58,12 +57,21 @@ void ColorPicker::setupDialog(const Glib::ustring &title)
_colorSelectorDialog.set_border_width (4);
_color_selector = Gtk::manage(new ColorNotebook(_selected_color));
-
+ if (_transientwindow) {
+ Glib::RefPtr<Gdk::Window> window = get_parent_window();
+ if (window) {
+ window->set_transient_for(_transientwindow);
+ }
+ }
_colorSelectorDialog.get_content_area()->pack_start (
*_color_selector, true, true, 0);
_color_selector->show();
}
+void ColorPicker::setTransientFor(Glib::RefPtr<Gdk::Window> transientwindow) { _transientwindow = transientwindow; }
+
+void ColorPicker::setSensitive(bool sensitive) { _color_selector->set_sensitive(sensitive); }
+
void ColorPicker::setRgba32 (guint32 rgba)
{
if (_in_use) return;
diff --git a/src/ui/widget/color-picker.h b/src/ui/widget/color-picker.h
index f0252550b..d4005d397 100644
--- a/src/ui/widget/color-picker.h
+++ b/src/ui/widget/color-picker.h
@@ -18,11 +18,12 @@
#include <cstddef>
-#include <gtkmm/dialog.h>
-#include <gtkmm/button.h>
-#include <sigc++/sigc++.h>
#include "ui/selected-color.h"
#include "ui/widget/color-preview.h"
+#include <gtkmm/button.h>
+#include <gtkmm/dialog.h>
+#include <gtkmm/window.h>
+#include <sigc++/sigc++.h>
struct SPColorSelector;
@@ -45,9 +46,9 @@ public:
~ColorPicker() override;
void setRgba32 (guint32 rgba);
-
+ void setSensitive(bool sensitive);
void closeWindow();
-
+ void setTransientFor(Glib::RefPtr<Gdk::Window> transientwindow);
sigc::connection connectChanged (const sigc::slot<void,guint>& slot)
{ return _changed_signal.connect (slot); }
@@ -70,6 +71,7 @@ protected:
//Inkscape::UI::Dialog::Dialog _colorSelectorDialog;
Gtk::Dialog _colorSelectorDialog;
SelectedColor _selected_color;
+ Glib::RefPtr<Gdk::Window> _transientwindow;
Gtk::Widget *_color_selector;
};