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 /src | |
| parent | Fix adding/lookup of recent files. (diff) | |
| download | inkscape-db598f3d89b27bef694c217a11e13cc002cc8ec6.tar.gz inkscape-db598f3d89b27bef694c217a11e13cc002cc8ec6.zip | |
Allow add LPE with one click
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.cpp | 40 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.h | 2 |
2 files changed, 38 insertions, 4 deletions
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 |
