diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-03-27 19:03:52 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-03-27 19:03:52 +0000 |
| commit | db598f3d89b27bef694c217a11e13cc002cc8ec6 (patch) | |
| tree | 702fd748d93195039db1e16a081d5ef09ab12d85 | |
| parent | Fix adding/lookup of recent files. (diff) | |
| download | inkscape-db598f3d89b27bef694c217a11e13cc002cc8ec6.tar.gz inkscape-db598f3d89b27bef694c217a11e13cc002cc8ec6.zip | |
Allow add LPE with one click
| -rw-r--r-- | share/ui/dialog-livepatheffect-add-effect.ui | 33 | ||||
| -rw-r--r-- | share/ui/style.css | 2 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.cpp | 40 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.h | 2 |
4 files changed, 71 insertions, 6 deletions
diff --git a/share/ui/dialog-livepatheffect-add-effect.ui b/share/ui/dialog-livepatheffect-add-effect.ui index 08488e454..e1d85cebd 100644 --- a/share/ui/dialog-livepatheffect-add-effect.ui +++ b/share/ui/dialog-livepatheffect-add-effect.ui @@ -123,6 +123,37 @@ </packing> </child> <child> + <object class="GtkEventBox" id="LPESelectorEffectEventExpander"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <child> + <object class="GtkImage" id="LPESelectorEffectExpander"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="margin_left">5</property> + <property name="margin_right">5</property> + <property name="margin_top">5</property> + <property name="margin_bottom">5</property> + <property name="pixel_size">16</property> + <property name="icon_name">go-down</property> + <property name="icon_size">2</property> + <style> + <class name="info"/> + </style> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> <object class="GtkButtonBox" id="LPESelectorButtonBox"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -226,7 +257,7 @@ <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> <style> diff --git a/share/ui/style.css b/share/ui/style.css index 78fc3877c..ca21e9d4c 100644 --- a/share/ui/style.css +++ b/share/ui/style.css @@ -61,7 +61,7 @@ * ".backgrounddefault" use default window color * ".backgroundinverse" invert window colors * ".backgroundbright" force bright colors no matter the UI is dark or bright - * ".backgrounddark" same but dark + * ".backgrounddark" same but daLPESelectorButtonBoxk * :::::::: Icon Based. * :::::::: apply to color (foreground) * :::::::: scope widget and all nested images diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 452138aa0..02578efab 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -120,6 +120,14 @@ LivePathEffectAdd::LivePathEffectAdd() LPESelectorEffect->signal_button_press_event().connect( sigc::bind<Glib::RefPtr<Gtk::Builder>, const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *>( sigc::mem_fun(*this, &LivePathEffectAdd::apply), builder_effect, &converter.data(i))); + Gtk::EventBox *LPESelectorEffectEventExpander; + builder_effect->get_widget("LPESelectorEffectEventExpander", LPESelectorEffectEventExpander); + LPESelectorEffectEventExpander->signal_button_press_event().connect( + sigc::bind<Glib::RefPtr<Gtk::Builder>>(sigc::mem_fun(*this, &LivePathEffectAdd::expand), builder_effect)); + LPESelectorEffectEventExpander->signal_enter_notify_event().connect(sigc::bind<GtkWidget *>( + sigc::mem_fun(*this, &LivePathEffectAdd::mouseover), GTK_WIDGET(LPESelectorEffect->gobj()))); + LPESelectorEffectEventExpander->signal_leave_notify_event().connect(sigc::bind<GtkWidget *>( + sigc::mem_fun(*this, &LivePathEffectAdd::mouseout), GTK_WIDGET(LPESelectorEffect->gobj()))); Gtk::Label *LPEName; builder_effect->get_widget("LPEName", LPEName); const Glib::ustring label = converter.get_label(data->id); @@ -219,10 +227,25 @@ void LivePathEffectAdd::on_activate(Gtk::FlowBoxChild *child) Gtk::Box *box = dynamic_cast<Gtk::Box *>(eventbox->get_child()); if (box) { std::vector<Gtk::Widget *> contents = box->get_children(); - Gtk::Box *actions = dynamic_cast<Gtk::Box *>(contents[4]); + Gtk::Box *actions = dynamic_cast<Gtk::Box *>(contents[5]); if (actions) { actions->set_visible(false); } + Gtk::EventBox *expander = dynamic_cast<Gtk::EventBox *>(contents[4]); + if (expander) { + expander->set_visible(true); + } + } + } + } + Gtk::EventBox *eventbox = dynamic_cast<Gtk::EventBox *>(child->get_child()); + if (eventbox) { + Gtk::Box *box = dynamic_cast<Gtk::Box *>(eventbox->get_child()); + if (box) { + std::vector<Gtk::Widget *> contents = box->get_children(); + Gtk::EventBox *expander = dynamic_cast<Gtk::EventBox *>(contents[4]); + if (expander) { + expander->set_visible(false); } } } @@ -313,15 +336,13 @@ bool LivePathEffectAdd::show_fav_toggler(GdkEventButton *evt) reload_effect_list(); return true; } - bool LivePathEffectAdd::apply(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect, const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *to_add) { _to_add = to_add; Gtk::EventBox *LPESelectorEffect; builder_effect->get_widget("LPESelectorEffect", LPESelectorEffect); - if (!LPESelectorEffect->get_parent()->get_style_context()->has_class("lpeactive") || - LPESelectorEffect->get_parent()->get_style_context()->has_class("lpedisabled")) { + if (LPESelectorEffect->get_parent()->get_style_context()->has_class("lpedisabled")) { Gtk::FlowBoxChild *child = dynamic_cast<Gtk::FlowBoxChild *>(LPESelectorEffect->get_parent()); if (child) { on_activate(child); @@ -334,6 +355,17 @@ bool LivePathEffectAdd::apply(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> bu return true; } +bool LivePathEffectAdd::expand(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect) +{ + Gtk::EventBox *LPESelectorEffect; + builder_effect->get_widget("LPESelectorEffect", LPESelectorEffect); + Gtk::FlowBoxChild *child = dynamic_cast<Gtk::FlowBoxChild *>(LPESelectorEffect->get_parent()); + if (child) { + on_activate(child); + } + return true; +} + bool LivePathEffectAdd::on_filter(Gtk::FlowBoxChild *child) diff --git a/src/ui/dialog/livepatheffect-add.h b/src/ui/dialog/livepatheffect-add.h index 938eb768a..a605967a0 100644 --- a/src/ui/dialog/livepatheffect-add.h +++ b/src/ui/dialog/livepatheffect-add.h @@ -71,6 +71,7 @@ class LivePathEffectAdd { bool fav_toggler(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect); bool apply(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect, const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *to_add); + bool expand(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> builder_effect); bool show_fav_toggler(GdkEventButton *evt); bool mouseover(GdkEventCrossing *evt, GtkWidget *wdg); bool mouseout(GdkEventCrossing *evt, GtkWidget *wdg); @@ -134,3 +135,4 @@ private: End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : +expand
\ No newline at end of file |
