From 9e3e079f65db48bc3805566b577aced99973a2f3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sun, 23 Jun 2019 13:49:13 +0200 Subject: comment alternate colors --- .../symbolic/actions/draw-cuboid-symbolic.svg | 240 +++++++++++++++------ .../draw-cuboid-symbolic.svg-rect860-201.png | Bin 0 -> 131563 bytes .../draw-cuboid-symbolic.svg-rect860-978.png | Bin 0 -> 262 bytes share/ui/style.css | 3 +- src/ui/dialog/inkscape-preferences.cpp | 54 ++++- src/ui/dialog/inkscape-preferences.h | 5 +- src/ui/dialog/styledialog.cpp | 6 +- 7 files changed, 238 insertions(+), 70 deletions(-) create mode 100644 share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-201.png create mode 100644 share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-978.png diff --git a/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg b/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg index b9927c2e0..84a10a583 100644 --- a/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg +++ b/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg @@ -5,15 +5,17 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - inkscape:version="1.0alpha2 (119fb3b5e8, 2019-06-21, custom)" - sodipodi:docname="draw-cuboid-symbolic.svg" - viewBox="0 0 16 16" - height="16" - width="16" + enable-background="new" + version="1.1" id="svg1" - version="1.1"> + width="16" + height="16" + viewBox="0 0 16 16" + sodipodi:docname="draw-cuboid-symbolic.svg" + inkscape:version="1.0alpha2 (cb09233d29, 2019-06-21, custom)"> @@ -22,6 +24,7 @@ image/svg+xml + @@ -38,73 +41,180 @@ + + + + + + + + + is_visible="true" + linecap_type="butt" + line_width="1.5" + linejoin_type="round" + miter_limit="100" + attempt_force_join="true" /> + + + + + + + + + + + + + + + gridtolerance="10" + guidetolerance="10" + id="namedview" + showgrid="false" + inkscape:zoom="15.362302" + inkscape:cx="13.234269" + inkscape:cy="9.6401433" + inkscape:window-width="1360" + inkscape:window-height="704" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="g881" + inkscape:document-rotation="0"> + type="xygrid" + id="grid" /> - - - - - + + style="fill:none;fill-opacity:1;stroke-width:1.18599" /> + + + + diff --git a/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-201.png b/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-201.png new file mode 100644 index 000000000..cee4fe012 Binary files /dev/null and b/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-201.png differ diff --git a/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-978.png b/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-978.png new file mode 100644 index 000000000..1542db545 Binary files /dev/null and b/share/icons/nextgen/symbolic/actions/draw-cuboid-symbolic.svg-rect860-978.png differ diff --git a/share/ui/style.css b/share/ui/style.css index 25bde06f1..a3a753324 100644 --- a/share/ui/style.css +++ b/share/ui/style.css @@ -153,8 +153,9 @@ image { color: @success_color; } +image.disabled, .symboliccolors:disabled * { - opacity: 0.2; + opacity: 0.35; } GtkWidget, 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 sref = Cairo::RefPtr(new Cairo::Surface(s)); + Glib::RefPtr 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 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(); -- cgit v1.2.3