diff options
| -rw-r--r-- | NEWS.md | 6 | ||||
| -rw-r--r-- | share/icons/hicolor/scalable/actions/draw-star-ouline.svg | 133 | ||||
| -rw-r--r-- | share/icons/hicolor/symbolic/actions/draw-star-outline-symbolic.svg | 67 | ||||
| -rw-r--r-- | share/ui/dialog-filter-editor.ui (renamed from share/ui/filter-editor.glade) | 0 | ||||
| -rw-r--r-- | share/ui/dialog-livepatheffect-add-effect.ui | 118 | ||||
| -rw-r--r-- | share/ui/dialog-livepatheffect-add.ui | 140 | ||||
| -rw-r--r-- | share/ui/toolbar-commands.ui (renamed from share/ui/commands-toolbar.ui) | 0 | ||||
| -rw-r--r-- | share/ui/toolbar-select.ui (renamed from share/ui/select-toolbar.ui) | 0 | ||||
| -rw-r--r-- | share/ui/toolbar-snap.ui (renamed from share/ui/snap-toolbar.ui) | 0 | ||||
| -rw-r--r-- | share/ui/toolbar-tool.ui (renamed from share/ui/tool-toolbar.ui) | 0 | ||||
| -rw-r--r-- | src/ui/dialog/filter-editor.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 41 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.cpp | 127 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.h | 42 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 10 |
15 files changed, 580 insertions, 106 deletions
@@ -676,9 +676,9 @@ User interface customization reconfigured by users. Only one is currently supported (filter editor). • The contents of the menus can be configured by customizing the menus.xml file. - • Toolbar contents for the command bar (commands-toolbar.ui), the snap bar - (snap-toolbar.ui), the tool controls bars for each tool - (select-toolbar.ui), the toolbox (tool-toolbar.ui) is now configurable. + • Toolbar contents for the command bar (toolbar-commands.ui), the snap bar + (toolbar-snap.ui), the tool controls bars for each tool + (toolbar-select.ui), the toolbox (tool-toolbar.ui) is now configurable. • The file keybindings.rc allows you to... (TODO: do what? What does it do in comparison to keys.xml? Seems to not work at all... seems to be ancient. Can be deleted?) diff --git a/share/icons/hicolor/scalable/actions/draw-star-ouline.svg b/share/icons/hicolor/scalable/actions/draw-star-ouline.svg new file mode 100644 index 000000000..f348a88c6 --- /dev/null +++ b/share/icons/hicolor/scalable/actions/draw-star-ouline.svg @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + 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" + id="svg1" + width="18.268586" + height="17.84485" + version="1.1" + sodipodi:docname="draw-star-ouline.svg" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> + <metadata + id="metadata4103"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + id="base" + showgrid="true" + inkscape:zoom="37.406242" + inkscape:cx="9.6579675" + inkscape:cy="9.7321419" + inkscape:window-width="1280" + inkscape:window-height="960" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="svg1"> + <inkscape:grid + id="GridFromPre046Settings" + type="xygrid" + originx="0pt" + originy="0pt" + spacingx="1pt" + spacingy="1pt" + color="#3f3fff" + empcolor="#3f3fff" + opacity="0.15" + empopacity="0.38" + empspacing="5" /> + </sodipodi:namedview> + <defs + id="defs3"> + <linearGradient + gradientUnits="userSpaceOnUse" + id="linearGradient6625-4" + inkscape:collect="always" + x1="109.2829" + x2="99.93163" + xlink:href="#linearGradient6679" + y1="199.9722" + y2="190.2852" /> + <linearGradient + gradientUnits="userSpaceOnUse" + id="linearGradient6644" + inkscape:collect="always" + x1="98.53114" + x2="101.695" + xlink:href="#linearGradient5704" + y1="191.0442" + y2="195.8891" /> + <linearGradient + id="linearGradient6679"> + <stop + id="stop6681" + offset="0" + style="stop-color:#ffeb74;stop-opacity:1" /> + <stop + id="stop6683" + offset="1" + style="stop-color:#ffffff;stop-opacity:1" /> + </linearGradient> + <linearGradient + id="linearGradient5704"> + <stop + id="stop5706" + offset="0" + style="stop-color:#5a5a5a;stop-opacity:1" /> + <stop + id="stop5708" + offset="1" + style="stop-color:#000000;stop-opacity:1" /> + </linearGradient> + </defs> + <g + id="draw-star" + transform="matrix(1,0,0,1,-455.80047,-179.155581)"> + <path + d="m 109.1123,194.2458 -3.4876,2.2071 -0.019,4.1272 -3.1768,-2.6349 -3.93097,1.2577 1.52427,-3.8355 -2.41085,-3.35 4.11875,0.2644 2.441,-3.328 1.0213,3.9989 z" + id="path2669" + inkscape:flatsided="false" + inkscape:randomized="0" + inkscape:rounded="0" + sodipodi:arg1="-0.122765" + sodipodi:arg2="0.5055535" + sodipodi:cx="103" + sodipodi:cy="195" + sodipodi:r1="6.158659" + sodipodi:r2="3" + sodipodi:sides="5" + sodipodi:type="star" + style="color:#000000;fill:#fffbc5;fill-rule:evenodd;stroke:url(#linearGradient6644);stroke-width:0.6782926;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0" + transform="matrix(1.492696,-0.0409829,0.0399483,1.455015,302.9314,-91.01218)" /> + <path + d="m 107.5277,194.4445 -2.569,1.6153 -0.031,3.0747 -2.3302,-1.9442 -2.93379,0.9204 1.12889,-2.8168 -1.78192,-2.5058 3.02782,0.2032 1.8325,-2.4691 0.7424,2.9425 z" + id="path5971" + inkscape:flatsided="false" + inkscape:randomized="0" + inkscape:rounded="0" + sodipodi:arg1="-0.1220787" + sodipodi:arg2="0.4959725" + sodipodi:cx="103" + sodipodi:cy="195" + sodipodi:r1="4.561672" + sodipodi:r2="2.227037" + sodipodi:sides="5" + sodipodi:type="star" + style="color:#000000;fill:#ffffff;fill-rule:evenodd;stroke:url(#linearGradient6625-4);stroke-width:0.6782926;stroke-linecap:round;stroke-miterlimit:80" + transform="matrix(1.492696,-0.0409829,0.0399483,1.455015,302.9314,-91.01218)" /> + </g> +</svg> diff --git a/share/icons/hicolor/symbolic/actions/draw-star-outline-symbolic.svg b/share/icons/hicolor/symbolic/actions/draw-star-outline-symbolic.svg new file mode 100644 index 000000000..5aa4591a1 --- /dev/null +++ b/share/icons/hicolor/symbolic/actions/draw-star-outline-symbolic.svg @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) and export_objects.py --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + 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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="svg1" + width="16" + height="16" + viewBox="0 0 16 16" + sodipodi:docname="draw-star-outline-symbolic.svg" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> + <metadata + id="metadata10"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs8" /> + <sodipodi:namedview + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + id="namedview" + showgrid="true" + inkscape:zoom="27.166187" + inkscape:cx="9.3879532" + inkscape:cy="7.3166036" + inkscape:window-width="1280" + inkscape:window-height="960" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="svg1" + inkscape:snap-global="false"> + <inkscape:grid + type="xygrid" + id="grid" /> + </sodipodi:namedview> + <g + transform="matrix(1.000006,0,0,1.002537,-348.99376,-684.09339)" + id="draw-star-outline" + inkscape:label="00174"> + <path + inkscape:connector-curvature="0" + id="rect19962" + d="m 349,682.36218 h 15.97919 v 15.9375 H 349 Z" + style="opacity:0;fill:none" /> + <path + style="opacity:1;stroke-width:0.98073399" + d="M 7.9609375 0 L 5.7460938 5.4824219 L 0.37695312 6.1855469 L 4.3945312 10.181641 L 3.3417969 16.054688 L 8.0449219 13.064453 L 12.785156 15.990234 L 12.669922 15.380859 L 11.658203 10.130859 L 15.625 6.078125 L 10.244141 5.4511719 L 7.9609375 0 z M 7.9726562 2.5019531 L 9.578125 6.328125 L 13.402344 6.7714844 L 10.580078 9.65625 L 11.376953 13.787109 L 8.0351562 11.724609 L 4.7207031 13.833984 L 5.4628906 9.6914062 L 2.6015625 6.8476562 L 6.421875 6.3496094 L 7.9726562 2.5019531 z " + transform="matrix(0.999994,0,0,0.99746942,348.99167,682.36224)" + id="path822" /> + </g> +</svg> diff --git a/share/ui/filter-editor.glade b/share/ui/dialog-filter-editor.ui index 908e0d7e3..908e0d7e3 100644 --- a/share/ui/filter-editor.glade +++ b/share/ui/dialog-filter-editor.ui diff --git a/share/ui/dialog-livepatheffect-add-effect.ui b/share/ui/dialog-livepatheffect-add-effect.ui new file mode 100644 index 000000000..b423a32f4 --- /dev/null +++ b/share/ui/dialog-livepatheffect-add-effect.ui @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface> + <requires lib="gtk+" version="3.20"/> + <object class="GtkBox" id="LPESelectorEffect"> + <property name="width_request">200</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="double_buffered">False</property> + <property name="halign">center</property> + <property name="hexpand">False</property> + <property name="orientation">vertical</property> + <property name="baseline_position">top</property> + <child> + <object class="GtkImage" id="LPEIcon"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="valign">start</property> + <property name="pixel_size">80</property> + <property name="icon_name">align-vertical-baseline</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="LPEName"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">LPEName</property> + <property name="justify">center</property> + <style> + <class name="lpename"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="LPEDescription"> + <property name="width_request">200</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Description</property> + <property name="justify">center</property> + <property name="wrap">True</property> + <property name="max_width_chars">20</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">10</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButtonBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="layout_style">start</property> + <child> + <object class="GtkImage"> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="pixel_size">30</property> + <property name="icon_name">draw-star-outline</property> + <property name="icon_size">2</property> + <style> + <class name="fab"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">1</property> + <property name="non_homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkImage"> + <property name="can_focus">False</property> + <property name="pixel_size">30</property> + <property name="icon_name">on</property> + <property name="icon_size">2</property> + <style> + <class name="apply"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">2</property> + <property name="non_homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">3</property> + </packing> + </child> + <style> + <class name="lpeselectoreffect"/> + </style> + </object> +</interface> diff --git a/share/ui/dialog-livepatheffect-add.ui b/share/ui/dialog-livepatheffect-add.ui new file mode 100644 index 000000000..3bee689a5 --- /dev/null +++ b/share/ui/dialog-livepatheffect-add.ui @@ -0,0 +1,140 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface> + <requires lib="gtk+" version="3.20"/> + <object class="GtkDialog" id="LPEDialogSelector"> + <property name="name">LPEDialogSelector</property> + <property name="height_request">500</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="title" translatable="yes">Live Path Effect Selector</property> + <property name="modal">True</property> + <property name="window_position">center-on-parent</property> + <property name="destroy_with_parent">True</property> + <property name="type_hint">dialog</property> + <property name="gravity">center</property> + <child> + <placeholder/> + </child> + <child internal-child="vbox"> + <object class="GtkBox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="LPESelector"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="orientation">vertical</property> + <property name="baseline_position">top</property> + <child> + <object class="GtkSearchBar"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="search_mode_enabled">True</property> + <child> + <object class="GtkSearchEntry" id="LPEFilter"> + <property name="width_request">400</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="primary_icon_name">edit-find-symbolic</property> + <property name="primary_icon_activatable">False</property> + <property name="primary_icon_sensitive">False</property> + <style> + <class name="iconymbolic"/> + </style> + </object> + </child> + <style> + <class name="searchbar"/> + </style> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="LPEInfo"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Message</property> + <property name="justify">center</property> + <property name="ellipsize">end</property> + <style> + <class name="lpeinfo"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <property name="min_content_width">800</property> + <property name="min_content_height">10</property> + <property name="propagate_natural_height">True</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkFlowBox" id="LPESelectorFlowBox"> + <property name="name">lpeflow</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="column_spacing">10</property> + <property name="row_spacing">10</property> + <property name="min_children_per_line">3</property> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <style> + <class name="iconsymbolic"/> + <class name="colordefault"/> + </style> + </object> +</interface> diff --git a/share/ui/commands-toolbar.ui b/share/ui/toolbar-commands.ui index c2b1ed965..c2b1ed965 100644 --- a/share/ui/commands-toolbar.ui +++ b/share/ui/toolbar-commands.ui diff --git a/share/ui/select-toolbar.ui b/share/ui/toolbar-select.ui index abb3e6080..abb3e6080 100644 --- a/share/ui/select-toolbar.ui +++ b/share/ui/toolbar-select.ui diff --git a/share/ui/snap-toolbar.ui b/share/ui/toolbar-snap.ui index 90fa6bd61..90fa6bd61 100644 --- a/share/ui/snap-toolbar.ui +++ b/share/ui/toolbar-snap.ui diff --git a/share/ui/tool-toolbar.ui b/share/ui/toolbar-tool.ui index a5dedad56..a5dedad56 100644 --- a/share/ui/tool-toolbar.ui +++ b/share/ui/toolbar-tool.ui diff --git a/src/ui/dialog/filter-editor.cpp b/src/ui/dialog/filter-editor.cpp index 6ad9dca61..ba2c7357a 100644 --- a/src/ui/dialog/filter-editor.cpp +++ b/src/ui/dialog/filter-editor.cpp @@ -69,7 +69,7 @@ FilterEditorDialog::FilterEditorDialog() : UI::Widget::Panel("/dialogs/filtereff { const std::string req_widgets[] = {"FilterEditor", "FilterList", "FilterFERX", "FilterFERY", "FilterFERH", "FilterFERW", "FilterPreview", "FilterPrimitiveDescImage", "FilterPrimitiveList", "FilterPrimitiveDescText", "FilterPrimitiveAdd"}; - Glib::ustring gladefile = get_filename(UIS, "filter-editor.glade"); + Glib::ustring gladefile = get_filename(UIS, "dialog-filter-editor.ui"); try { builder = Gtk::Builder::create_from_file(gladefile); } catch(const Glib::Error& ex) { diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9248b5944..86529fbbb 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -44,6 +44,7 @@ #include "selection.h" #include "shortcuts.h" #include "verbs.h" +#include "inkscape-window.h" #include "display/canvas-grid.h" #include "display/nr-filter-gaussian.h" @@ -687,7 +688,6 @@ void InkscapePreferences::symbolicAddClass() auto const screen = Gdk::Screen::get_default(); auto provider = Gtk::CssProvider::create(); Glib::ustring css_str = ""; - gchar colornamed[64]; gchar colornamed_inverse[64]; int colorset = prefs->getInt("/theme/symbolicColor", 0x000000ff); @@ -728,23 +728,24 @@ void InkscapePreferences::symbolicAddClass() // is more understandable than record previously applied Glib::ustring style = get_filename(UIS, "style.css"); if (!style.empty()) { - auto provider = Gtk::CssProvider::create(); - - // From 3.16, throws an error which we must catch. - try { - provider->load_from_path(style); - } -#if GTK_CHECK_VERSION(3, 16, 0) - // Gtk::CssProviderError not defined until 3.16. - catch (const Gtk::CssProviderError &ex) { - g_critical("CSSProviderError::load_from_path(): failed to load '%s'\n(%s)", style.c_str(), - ex.what().c_str()); - } + auto provider = Gtk::CssProvider::create(); + + // From 3.16, throws an error which we must catch. + try { + provider->load_from_path (style); + } +#if GTK_CHECK_VERSION(3,16,0) + // Gtk::CssProviderError not defined until 3.16. + catch (const Gtk::CssProviderError& ex) + { + g_critical("CSSProviderError::load_from_path(): failed to load '%s'\n(%s)", + style.c_str(), ex.what().c_str()); + } #else - catch (...) { - } + catch (...) + {} #endif - Gtk::StyleContext::add_provider_for_screen(screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } } void InkscapePreferences::themeChange() @@ -756,15 +757,15 @@ void InkscapePreferences::themeChange() gchar *gtkThemeName; gboolean gtkApplicationPreferDarkTheme; Gtk::Window *window = SP_ACTIVE_DESKTOP->getToplevel(); - GtkSettings *settings = gtk_settings_get_default(); + GtkSettings *settings = gtk_settings_get_default(); if (window && settings) { g_object_get(settings, "gtk-theme-name", >kThemeName, NULL); g_object_get(settings, "gtk-application-prefer-dark-theme", >kApplicationPreferDarkTheme, NULL); bool dark = gtkApplicationPreferDarkTheme || Glib::ustring(gtkThemeName).find(":dark") != -1; if (!dark) { - Glib::RefPtr<Gtk::StyleContext> stylecontext = window->get_style_context(); - Gdk::RGBA rgba; - bool background_set = stylecontext->lookup_color("theme_bg_color", rgba); + Glib::RefPtr<Gtk::StyleContext> stylecontext = window->get_style_context(); + Gdk::RGBA rgba; + bool background_set = stylecontext->lookup_color("theme_bg_color", rgba); if (background_set && rgba.get_red() + rgba.get_green() + rgba.get_blue() < 1.0) { dark = true; } diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 1fae9a513..630008606 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -23,44 +23,43 @@ namespace UI { namespace Dialog { LivePathEffectAdd::LivePathEffectAdd() : - add_button(_("_Add"), true), - close_button(_("_Cancel"), true), - converter(Inkscape::LivePathEffect::LPETypeConverter), - applied(false) + converter(Inkscape::LivePathEffect::LPETypeConverter) { - set_title(_("Add Path Effect")); - - /** - * Scrolled Window - */ - scrolled_window.add(effectlist_treeview); - scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - scrolled_window.set_shadow_type(Gtk::SHADOW_IN); - scrolled_window.set_size_request(250, 200); - scrolled_window.set_can_focus(); - - /** - * Effect Store and Tree - */ - effectlist_store = Gtk::ListStore::create(_columns); - effectlist_store->set_sort_column (_columns.name, Gtk::SORT_ASCENDING ); - - effectlist_treeview.set_model(effectlist_store); - effectlist_treeview.set_headers_visible(false); - effectlist_treeview.append_column("Name", _columns.name); - //effectlist_treeview.set_activates_default(true); + const std::string req_widgets[] = {"LPEDialogSelector", "LPESelector", "LPESelectorFlowBox"}; + Glib::ustring gladefile = get_filename(Inkscape::IO::Resource::UIS, "dialog-livepatheffect-add.ui"); + try { + _builder = Gtk::Builder::create_from_file(gladefile); + } catch(const Glib::Error& ex) { + g_warning("Glade file loading failed for filter effect dialog"); + return; + } + Gtk::Object* test; + for(std::string w:req_widgets) { + _builder->get_widget(w,test); + if(!test){ + g_warning("Required widget %s does not exist", w.c_str()); + return; + } + } + _builder->get_widget("LPEDialogSelector", _LPEDialogSelector); /** * Initialize Effect list */ - int show = LivePathEffect::ATTACH_PATH; -#ifdef LPE_ENABLE_TEST_EFFECTS - //TODO: Handle when showing the experimental effects without setting flag - show = LivePathEffect::ANGLE_BISECTOR; -#elif WITH_LPETOOL - //TODO: Handle when showing the experimental effects without setting flag - show = LivePathEffect::ANGLE_BISECTOR; -#endif + _builder->get_widget("LPESelectorFlowBox", _LPESelectorFlowBox); + _builder->get_widget("LPEFilter", _LPEFilter); + _builder->get_widget("LPEInfo", _LPEInfo); + _LPEFilter->signal_search_changed().connect(sigc::mem_fun(*this, &LivePathEffectAdd::on_search)); + const std::string le_widgets[] = {"LPESelectorEffect", "LPEName","LPEDescription"}; + Glib::ustring le_gladefile = get_filename(Inkscape::IO::Resource::UIS, "dialog-livepatheffect-add-effect.ui"); + for(int i = 0; i < static_cast<int>(converter._length); ++i) { + + try { + _builder = Gtk::Builder::create_from_file(le_gladefile); + } catch(const Glib::Error& ex) { + g_warning("Glade file loading failed for filter effect dialog"); + return; + } for(int i = 0; i < static_cast<int>(converter._length); ++i) { Gtk::TreeModel::Row row = *(effectlist_store->append()); @@ -71,14 +70,55 @@ LivePathEffectAdd::LivePathEffectAdd() : Glib::RefPtr<Gtk::TreeSelection> select = effectlist_treeview.get_selection(); select->select(row); } + const LivePathEffect::EnumEffectData<LivePathEffect::EffectType>* data = &converter.data(i); + Gtk::Label * LPEName; + _builder->get_widget("LPEName", LPEName); + Glib::ustring newid = "LPEName_" + Glib::ustring::format(i); + (*LPEName).set_name(newid); + (*LPEName).set_text(converter.get_label(data->id).c_str()); + Gtk::Label * LPEDescription; + _builder->get_widget("LPEDescription", LPEDescription); + newid = "LPEDescription_" + Glib::ustring::format(i); + (*LPEDescription).set_name(newid); + (*LPEDescription).set_text(converter.get_description(data->id)); + Gtk::Image * LPEIcon; + _builder->get_widget("LPEIcon", LPEIcon); + newid = "LPEIcon_" + Glib::ustring::format(i); + (*LPEIcon).set_name(newid); + (*LPEIcon).set_from_icon_name(converter.get_icon(data->id),Gtk::BuiltinIconSize(Gtk::ICON_SIZE_DIALOG)); + Gtk::Box * LPESelectorEffect; + _builder->get_widget("LPESelectorEffect", LPESelectorEffect); + newid = "LPESelectorEffect" + Glib::ustring::format(i); + (*LPESelectorEffect).set_name(newid); + _LPESelectorFlowBox->insert(*LPESelectorEffect, i); } + _visiblelpe = _LPESelectorFlowBox->get_children().size(); + _LPESelectorFlowBox->signal_child_activated().connect(sigc::mem_fun(*this, &LivePathEffectAdd::on_activate)); + _LPEDialogSelector->set_title(_("Live Efects Selector")); + _LPEDialogSelector->show_all_children(); + _LPEInfo->set_visible(false); +} - /** - * Buttons - */ - //close_button.set_can_default(); - add_button.set_use_underline(true); - add_button.set_can_default(); +void LivePathEffectAdd::on_activate(Gtk::FlowBoxChild *child){ + for (auto i:_LPESelectorFlowBox->get_children()) { + Gtk::FlowBoxChild * leitem = dynamic_cast<Gtk::FlowBoxChild *>(i); + leitem->get_style_context()->remove_class("lpeactive"); + leitem->get_style_context()->remove_class("colorinverse"); + leitem->get_style_context()->remove_class("backgroundinverse"); + Gtk::Box *box = dynamic_cast<Gtk::Box *>(leitem->get_child()); + if (box) { + std::vector<Gtk::Widget*> contents = box->get_children(); + Gtk::Box *actions = dynamic_cast<Gtk::Box *>(contents[3]); + if (actions) { + actions->set_visible(false); + } + } + } + child->get_style_context()->add_class("lpeactive"); + child->get_style_context()->add_class("colorinverse"); + child->get_style_context()->add_class("backgroundinverse"); + child->show_all_children(); +} auto mainVBox = get_content_area(); @@ -109,7 +149,7 @@ void LivePathEffectAdd::onAdd() void LivePathEffectAdd::onClose() { - hide(); + _LPEDialogSelector->hide(); } void LivePathEffectAdd::onKeyEvent(GdkEventKey* evt) @@ -146,12 +186,7 @@ LivePathEffectAdd::getActiveData() void LivePathEffectAdd::show(SPDesktop *desktop) { LivePathEffectAdd &dial = instance(); - dial.applied=false; - dial.set_modal(true); - desktop->setWindowTransient (dial.gobj()); - dial.property_destroy_with_parent() = true; - dial.effectlist_treeview.grab_focus(); - dial.run(); + dial._LPEDialogSelector->run(); } } // namespace Dialog diff --git a/src/ui/dialog/livepatheffect-add.h b/src/ui/dialog/livepatheffect-add.h index 84901385c..671751ed2 100644 --- a/src/ui/dialog/livepatheffect-add.h +++ b/src/ui/dialog/livepatheffect-add.h @@ -72,37 +72,17 @@ protected: */ void onKeyEvent(GdkEventKey* evt); private: - - Gtk::TreeView effectlist_treeview; - Gtk::ScrolledWindow scrolled_window; - Gtk::Button add_button; - Gtk::Button close_button; - - class ModelColumns : public Gtk::TreeModel::ColumnRecord - { - public: - ModelColumns() - { - add(name); - //add(desc); - add(data); - } - ~ModelColumns() override = default; - - Gtk::TreeModelColumn<Glib::ustring> name; - /** - * TODO - Get detailed descriptions of each Effect to show in the dialog - */ - //Gtk::TreeModelColumn<Glib::ustring> desc; - Gtk::TreeModelColumn<const Util::EnumData<LivePathEffect::EffectType>*> data; - }; - - ModelColumns _columns; - Glib::RefPtr<Gtk::ListStore> effectlist_store; - const Util::EnumDataConverter<LivePathEffect::EffectType>& converter; - - bool applied; - + Gtk::Button _add_button; + Gtk::Button _close_button; + Gtk::Dialog *_LPEDialogSelector; + Glib::RefPtr<Gtk::Builder> _builder; + Gtk::FlowBox *_LPESelectorFlowBox; + Gtk::SearchEntry *_LPEFilter; + Gtk::Label *_LPEInfo; + Gtk::Box *_LPESelector; + guint _visiblelpe; + class Effect; + const LivePathEffect::EnumEffectDataConverter<LivePathEffect::EffectType>& converter; static LivePathEffectAdd &instance() { static LivePathEffectAdd instance_; return instance_; diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 140f87dc7..12b5c58d3 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -695,7 +695,7 @@ void ToolboxFactory::setOrientation(GtkWidget* toolbox, GtkOrientation orientati void setup_tool_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { setupToolboxCommon( toolbox, desktop, - "tool-toolbar.ui", + "toolbar-tool.ui", "/ui/ToolToolbar", "/toolbox/tools/small"); } @@ -743,12 +743,12 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) Glib::RefPtr<Gtk::ActionGroup> mainActions = create_or_fetch_actions( desktop ); // The UI Manager creates widgets based on the definitions in the - // "select-toolbar.ui" file. This is only used with the "prep" + // "toolbar-select.ui" file. This is only used with the "prep" // method of toolbar-creation GtkUIManager* mgr = gtk_ui_manager_new(); GError *err = nullptr; gtk_ui_manager_insert_action_group( mgr, mainActions->gobj(), 0 ); - Glib::ustring filename = get_filename(UIS, "select-toolbar.ui"); + Glib::ustring filename = get_filename(UIS, "toolbar-select.ui"); guint ret = gtk_ui_manager_add_ui_from_file(mgr, filename.c_str(), &err); if(err) { g_warning("Failed to load aux toolbar %s: %s", filename.c_str(), err->message); @@ -932,7 +932,7 @@ void update_aux_toolbox(SPDesktop * /*desktop*/, ToolBase *eventcontext, GtkWidg void setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop) { setupToolboxCommon( toolbox, desktop, - "commands-toolbar.ui", + "toolbar-commands.ui", "/ui/CommandsToolbar", "/toolbox/small" ); } @@ -1246,7 +1246,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop) } setupToolboxCommon( toolbox, desktop, - "snap-toolbar.ui", + "toolbar-snap.ui", "/ui/SnapToolbar", "/toolbox/secondary" ); } |
