diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-06-23 11:49:13 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-07-08 21:04:16 +0000 |
| commit | 9e3e079f65db48bc3805566b577aced99973a2f3 (patch) | |
| tree | b7458bc8672ec374879c940edd9afcd96f726f34 /src | |
| parent | Fix coding style (diff) | |
| download | inkscape-9e3e079f65db48bc3805566b577aced99973a2f3.tar.gz inkscape-9e3e079f65db48bc3805566b577aced99973a2f3.zip | |
comment alternate colors
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 54 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 5 | ||||
| -rw-r--r-- | src/ui/dialog/styledialog.cpp | 6 |
3 files changed, 61 insertions, 4 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 3095cb7dc..e8ff4933c 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -47,6 +47,7 @@ #include "display/canvas-grid.h" #include "display/nr-filter-gaussian.h" +#include "display/cairo-utils.h" #include "extension/internal/gdkpixbuf-input.h" @@ -660,11 +661,11 @@ void InkscapePreferences::resetIconsColors() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); if (!prefs->getBool("/theme/symbolicIcons", false)) { - _symbolic_base_colors.set_sensitive(false); +/* _symbolic_base_colors.set_sensitive(false); _symbolic_base_color.setSensitive(false); _symbolic_success_color.setSensitive(false); _symbolic_warning_color.setSensitive(false); - _symbolic_error_color.setSensitive(false); + _symbolic_error_color.setSensitive(false); */ return; } if (prefs->getBool("/theme/symbolicDefaultColors", true) || @@ -695,6 +696,7 @@ void InkscapePreferences::resetIconsColors() _symbolic_success_color.setSensitive(false); _symbolic_warning_color.setSensitive(false); _symbolic_error_color.setSensitive(false); + _complementary_colors->get_style_context()->add_class("disabled"); } changeIconsColors(); } else { @@ -702,6 +704,7 @@ void InkscapePreferences::resetIconsColors() _symbolic_success_color.setSensitive(true); _symbolic_warning_color.setSensitive(true); _symbolic_error_color.setSensitive(true); + _complementary_colors->get_style_context()->remove_class("disabled"); } } @@ -871,6 +874,50 @@ void InkscapePreferences::symbolicThemeCheck() "/theme/" + themeiconname + "/symbolicErrorColor", colorseterror); } } +/* void sp_mix_colors(cairo_t *ct, int pos, SPColor a, SPColor b) +{ + double arcEnd=2*M_PI; + cairo_set_source_rgba(ct, 1, 1, 1, 1); + cairo_arc(ct,pos,13,12,0,arcEnd); + cairo_fill(ct); + cairo_set_source_rgba(ct, a.v.c[0], a.v.c[1], a.v.c[2], 0.5); + cairo_arc(ct,pos,13,12,0,arcEnd); + cairo_fill(ct); + cairo_set_source_rgba(ct, b.v.c[0], b.v.c[1], b.v.c[2], 0.5); + cairo_arc(ct,pos,13,12,0,arcEnd); + cairo_fill(ct); +} + +Glib::RefPtr< Gdk::Pixbuf > sp_mix_colors() +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring themeiconname = prefs->getString("/theme/iconTheme"); + guint32 colorsetsuccess = prefs->getInt("/theme/" + themeiconname + "/symbolicSuccessColor", 0x4AD589ff); + guint32 colorsetwarning = prefs->getInt("/theme/" + themeiconname + "/symbolicWarningColor", 0xF57900ff); + guint32 colorseterror = prefs->getInt("/theme/" + themeiconname + "/symbolicErrorColor", 0xcc0000ff); + SPColor success(colorsetsuccess); + SPColor warning(colorsetwarning); + SPColor error(colorseterror); + cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 82, 26); + cairo_t *ct = cairo_create(s); + // success + warning + sp_mix_colors(ct, 13, success, warning); + sp_mix_colors(ct, 41, success, error); + sp_mix_colors(ct, 69, warning, error); + cairo_destroy(ct); + cairo_surface_flush(s); + + Cairo::RefPtr<Cairo::Surface> sref = Cairo::RefPtr<Cairo::Surface>(new Cairo::Surface(s)); + Glib::RefPtr<Gdk::Pixbuf> pixbuf = + Gdk::Pixbuf::create(sref, 0, 0, 82, 26); + cairo_surface_destroy(s); + return pixbuf; +} */ + +void InkscapePreferences::changeIconsColor(guint32 /*color*/) { + changeIconsColors(); +/* _complementary_colors->set(sp_mix_colors()); */ +} void InkscapePreferences::initPageUI() { @@ -1128,6 +1175,7 @@ void InkscapePreferences::initPageUI() _symbolic_success_color.setParentDialog(this); _symbolic_warning_color.setParentDialog(this); _symbolic_error_color.setParentDialog(this); + /* _complementary_colors = Gtk::manage(new Gtk::Image()); */ Gtk::Box *icon_buttons = Gtk::manage(new Gtk::Box()); icon_buttons->pack_start(_symbolic_base_color, true, true, 4); _page_theme.add_line(false, "", *icon_buttons, _("Icon color"), @@ -1136,11 +1184,13 @@ void InkscapePreferences::initPageUI() 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); + /* icon_buttons_hight->pack_start(*_complementary_colors, true, true, 4); */ _page_theme.add_line(false, "", *icon_buttons_hight, _("Highlights"), _("Highlights colors, some symbolic icon themes use it. Some icons changes need reload"), false); Gtk::Box *icon_buttons_def = Gtk::manage(new Gtk::Box()); resetIconsColors(); + changeIconsColor(0xffffffff); _page_theme.add_line(false, "", *icon_buttons_def, "", _("Reset theme colors, some symbolic icon themes use it. Some icons changes need reload"), false); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index c0b7f3938..45f302d9c 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -250,11 +250,14 @@ protected: UI::Widget::PrefColorPicker _symbolic_warning_color; UI::Widget::PrefColorPicker _symbolic_error_color; UI::Widget::PrefColorPicker _symbolic_success_color; +/* Gtk::Image *_complementary_colors; */ UI::Widget::PrefCombo _misc_small_toolbar; UI::Widget::PrefCombo _misc_small_secondary; UI::Widget::PrefCombo _misc_small_tools; UI::Widget::PrefCombo _menu_icons; + Gtk::Button _apply_theme; + UI::Widget::PrefRadioButton _win_dockable; UI::Widget::PrefRadioButton _win_floating; UI::Widget::PrefRadioButton _win_native; @@ -596,7 +599,7 @@ private: void toggleSymbolic(); void changeIconsColors(); void resetIconsColors(); - void changeIconsColor(guint32 /*color*/) { changeIconsColors(); } + void changeIconsColor(guint32 /*color*/); void get_highlight_colors(guint32 &colorsetbase, guint32 &colorsetsuccess, guint32 &colorsetwarning, guint32 &colorseterror); diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index d3fc4d203..75b44f831 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -998,7 +998,11 @@ void StyleDialog::_writeStyleElement(Glib::RefPtr<Gtk::TreeStore> store, Glib::u std::string result; std::regex_replace(std::back_inserter(result), content.begin(), content.end(), e, "$1" + styleContent + "$3"); textNode->setContent(result.c_str()); - _updateStyleSheets(); + INKSCAPE.readStyleSheets(); + for (auto iter : document->getObjectsBySelector(selector)) { + iter->style->readFromObject(iter); + iter->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); + } } _updating = false; _readStyleElement(); |
