diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2019-05-13 11:56:31 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2019-05-13 11:56:31 +0000 |
| commit | 19c30c44fffa95b348a531e0a259417e79855097 (patch) | |
| tree | 6d7a02fcf2dfc0e7c08547b68a6174fcdf871a01 /src | |
| parent | Replace tr.po (diff) | |
| download | inkscape-19c30c44fffa95b348a531e0a259417e79855097.tar.gz inkscape-19c30c44fffa95b348a531e0a259417e79855097.zip | |
Allow easy apply last LPE used
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.cpp | 21 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-add.h | 1 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 5da748a4b..5d5517149 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -210,6 +210,7 @@ LivePathEffectAdd::LivePathEffectAdd() _LPEDialogSelector->set_transient_for(*window); _LPESelectorFlowBox->set_focus_vadjustment(_LPEScrolled->get_vadjustment()); _LPEDialogSelector->show_all_children(); + _lasteffect = nullptr; } const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *LivePathEffectAdd::getActiveData() { @@ -346,14 +347,13 @@ bool LivePathEffectAdd::apply(GdkEventButton *evt, Glib::RefPtr<Gtk::Builder> bu _to_add = to_add; Gtk::EventBox *LPESelectorEffect; builder_effect->get_widget("LPESelectorEffect", LPESelectorEffect); - if (LPESelectorEffect->get_parent()->get_style_context()->has_class("lpedisabled")) { - Gtk::FlowBoxChild *child = dynamic_cast<Gtk::FlowBoxChild *>(LPESelectorEffect->get_parent()); - if (child) { - child->grab_focus(); - } + Gtk::FlowBoxChild *flowboxchild = dynamic_cast<Gtk::FlowBoxChild *>(LPESelectorEffect->get_parent()); + _LPESelectorFlowBox->select_child(*flowboxchild); + if (flowboxchild && flowboxchild->get_style_context()->has_class("lpedisabled")) { return true; } _applied = true; + _lasteffect = flowboxchild; _LPEDialogSelector->response(Gtk::RESPONSE_APPLY); _LPEDialogSelector->hide(); return true; @@ -366,14 +366,12 @@ bool LivePathEffectAdd::on_press_enter(GdkEventKey *key, Glib::RefPtr<Gtk::Build _to_add = to_add; Gtk::EventBox *LPESelectorEffect; builder_effect->get_widget("LPESelectorEffect", LPESelectorEffect); - if (LPESelectorEffect->get_parent()->get_style_context()->has_class("lpedisabled")) { - Gtk::FlowBoxChild *child = dynamic_cast<Gtk::FlowBoxChild *>(LPESelectorEffect->get_parent()); - if (child) { - child->grab_focus(); - } + Gtk::FlowBoxChild *flowboxchild = dynamic_cast<Gtk::FlowBoxChild *>(LPESelectorEffect->get_parent()); + if (flowboxchild && flowboxchild->get_style_context()->has_class("lpedisabled")) { return true; } _applied = true; + _lasteffect = flowboxchild; _LPEDialogSelector->response(Gtk::RESPONSE_APPLY); _LPEDialogSelector->hide(); return true; @@ -635,6 +633,9 @@ void LivePathEffectAdd::show(SPDesktop *desktop) int searchlen = dial._LPEFilter->get_text().length(); if (searchlen > 0) { dial._LPEFilter->select_region (0, searchlen); + dial._LPESelectorFlowBox->unselect_all(); + } else if (dial._lasteffect) { + dial._lasteffect->grab_focus(); } dial._LPEDialogSelector->run(); dial._LPEDialogSelector->hide(); diff --git a/src/ui/dialog/livepatheffect-add.h b/src/ui/dialog/livepatheffect-add.h index d49d76b28..2dfd0ce71 100644 --- a/src/ui/dialog/livepatheffect-add.h +++ b/src/ui/dialog/livepatheffect-add.h @@ -107,6 +107,7 @@ private: Gtk::Box *_LPESelector; guint _visiblelpe; Glib::ustring _item_type; + Gtk::FlowBoxChild *_lasteffect; const LivePathEffect::EnumEffectData<LivePathEffect::EffectType> *_to_add; bool _showfavs; bool _applied; |
